Make sure sorting doesnt break opening balance.

This commit is contained in:
James Cole
2020-07-26 15:05:48 +02:00
parent c86673f3ec
commit fdea25051c
11 changed files with 162 additions and 9 deletions

View File

@@ -162,6 +162,27 @@ trait AccountServiceTrait
return false;
}
/**
* Returns true if the data in the array is submitted but empty.
*
* @param array $data
*
* @return bool
*/
public function isEmptyOBData(array $data): bool
{
if (!isset($data['opening_balance']) && !isset($data['opening_balance_date'])) {
// not set, so false.
return false;
}
// if isset, but is empty:
if ('' === $data['opening_balance'] && '' === $data['opening_balance_date']) {
return true;
}
return false;
}
/**
* @param Account $account
* @param array $data