monitor default currency

This commit is contained in:
denisdulici 2020-02-28 15:51:33 +03:00
parent 5114f560a3
commit 28c44c03f6
2 changed files with 18 additions and 1 deletions

View File

@ -56,6 +56,12 @@ class DeleteCurrency extends Job
'transactions' => 'transactions', 'transactions' => 'transactions',
]; ];
return $this->countRelationships($this->currency, $rels); $relationships = $this->countRelationships($this->currency, $rels);
if ($this->currency->code == setting('default.currency')) {
$relationships[] = strtolower(trans_choice('general.companies', 1));
}
return $relationships;
} }
} }

View File

@ -32,8 +32,19 @@ class UpdateCurrency extends Job
{ {
$this->authorize(); $this->authorize();
// Force the rate to be 1 for default currency
if ($this->request->get('default_currency')) {
$this->request['rate'] = '1';
}
$this->currency->update($this->request->all()); $this->currency->update($this->request->all());
// Update default currency setting
if ($this->request->get('default_currency')) {
setting()->set('default.currency', $this->request->get('code'));
setting()->save();
}
return $this->currency; return $this->currency;
} }