Skip to content

Commit

Permalink
Fixed update Account, Contact, Dashboard, Category, Currency, Tax ena…
Browse files Browse the repository at this point in the history
…bled column issue..

( b93f938330374edd918091dd642ec179 )
  • Loading branch information
cuneytsenturk committed Feb 14, 2024
1 parent fc83075 commit 2d825b2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Jobs/Banking/UpdateAccount.php
Expand Up @@ -38,7 +38,7 @@ public function authorize(): void
{
$relationships = $this->getRelationships();

if (! $this->request->get('enabled') && ($this->model->id == setting('default.account'))) {
if (($this->request->has('enabled') && ! $this->request->get('enabled')) && ($this->model->id == setting('default.account'))) {
$relationships[] = strtolower(trans_choice('general.companies', 1));

$message = trans('messages.warning.disabled', ['name' => $this->model->name, 'text' => implode(', ', $relationships)]);
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Common/UpdateContact.php
Expand Up @@ -54,7 +54,7 @@ public function handle(): Contact
*/
public function authorize(): void
{
if (($this->request['enabled'] == 0) && ($relationships = $this->getRelationships())) {
if (($this->request->has('enabled') && ! $this->request->get('enabled')) && ($relationships = $this->getRelationships())) {
$message = trans('messages.warning.disabled', ['name' => $this->model->name, 'text' => implode(', ', $relationships)]);

throw new \Exception($message);
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Common/UpdateDashboard.php
Expand Up @@ -32,7 +32,7 @@ public function handle(): Dashboard
public function authorize(): void
{
// Can't disable last dashboard for any shared user
if ($this->request->has('enabled') && !$this->request->get('enabled')) {
if ($this->request->has('enabled') && ! $this->request->get('enabled')) {
foreach ($this->model->users as $user) {
if ($user->dashboards()->enabled()->count() > 1) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Setting/UpdateCategory.php
Expand Up @@ -40,7 +40,7 @@ public function authorize(): void
throw new \Exception($message);
}

if (! $this->request->get('enabled')) {
if ($this->request->has('enabled') && ! $this->request->get('enabled')) {
$message = trans('messages.warning.disabled', ['name' => $this->model->name, 'text' => implode(', ', $relationships)]);

throw new \Exception($message);
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Setting/UpdateCurrency.php
Expand Up @@ -51,7 +51,7 @@ public function authorize(): void
throw new \Exception($message);
}

if (! $this->request->get('enabled')) {
if ($this->request->has('enabled') && ! $this->request->get('enabled')) {
$message = trans('messages.warning.disable_code', ['name' => $this->model->name, 'text' => implode(', ', $relationships)]);

throw new \Exception($message);
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Setting/UpdateTax.php
Expand Up @@ -40,7 +40,7 @@ public function authorize(): void
throw new \Exception($message);
}

if (! $this->request->get('enabled')) {
if ($this->request->has('enabled') && ! $this->request->get('enabled')) {
$message = trans('messages.warning.disabled', ['name' => $this->model->name, 'text' => implode(', ', $relationships)]);

throw new \Exception($message);
Expand Down

0 comments on commit 2d825b2

Please sign in to comment.