Update tests and code.

This commit is contained in:
James Cole
2018-12-21 16:38:10 +01:00
parent a5520d45e7
commit 2c7d94e5e9
24 changed files with 378 additions and 150 deletions

View File

@@ -332,14 +332,17 @@ trait AccountServiceTrait
* @param string $note
*
* @return bool
* @throws \Exception
*/
public function updateNote(Account $account, string $note): bool
{
if ('' === $note) {
$dbNote = $account->notes()->first();
if (null !== $dbNote) {
$dbNote->delete();
try {
$dbNote->delete();
} catch (\Exception $e) {
Log::debug($e->getMessage());
}
}
return true;
@@ -365,7 +368,7 @@ trait AccountServiceTrait
public function validIBData(array $data): bool
{
$data['openingBalance'] = (string)($data['openingBalance'] ?? '');
if (isset($data['openingBalance'], $data['openingBalanceDate']) && \strlen($data['openingBalance']) > 0) {
if ('' !== $data['openingBalance'] && isset($data['openingBalance'], $data['openingBalanceDate'])) {
Log::debug('Array has valid opening balance data.');
return true;