more default account fixes #1659
This commit is contained in:
parent
8b352b5608
commit
9deac6b1f3
@ -52,7 +52,17 @@ class UpdateAccount extends Job
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if (!$relationships = $this->getRelationships()) {
|
||||
$relationships = $this->getRelationships();
|
||||
|
||||
if (!$this->request->get('enabled') && ($this->account->id == setting('default.account'))) {
|
||||
$relationships[] = strtolower(trans_choice('general.companies', 1));
|
||||
|
||||
$message = trans('messages.warning.disabled', ['name' => $this->account->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
if (!$relationships) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -61,14 +71,6 @@ class UpdateAccount extends Job
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
if (!$this->request->get('enabled')) {
|
||||
$relationships[] = strtolower(trans_choice('general.companies', 1));
|
||||
|
||||
$message = trans('messages.warning.disabled', ['name' => $this->account->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
throw new \Exception($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function getRelationships()
|
||||
@ -77,12 +79,6 @@ class UpdateAccount extends Job
|
||||
'transactions' => 'transactions',
|
||||
];
|
||||
|
||||
$relationships = $this->countRelationships($this->account, $rels);
|
||||
|
||||
if ($this->account->id == setting('default.account')) {
|
||||
$relationships[] = strtolower(trans_choice('general.companies', 1));
|
||||
}
|
||||
|
||||
return $relationships;
|
||||
return $this->countRelationships($this->account, $rels);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user