mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Catch various errors.
This commit is contained in:
@@ -41,17 +41,18 @@ class AccountUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function update(Account $account, array $data): Account
|
||||
{
|
||||
// update the account itself:
|
||||
$account->name = $data['name'];
|
||||
$account->active = $data['active'];
|
||||
$account->virtual_balance = trim($data['virtualBalance']) === '' ? '0' : $data['virtualBalance'];
|
||||
$account->virtual_balance = '' === trim($data['virtualBalance']) ? '0' : $data['virtualBalance'];
|
||||
$account->iban = $data['iban'];
|
||||
$account->save();
|
||||
|
||||
if (isset($data['currency_id']) && $data['currency_id'] === 0) {
|
||||
if (isset($data['currency_id']) && 0 === $data['currency_id']) {
|
||||
unset($data['currency_id']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user