Skip to content

Commit

Permalink
Fix deadlock situation by adding a constant in hope to save user
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 30, 2024
1 parent 9467267 commit fde37d8
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions htdocs/accountancy/admin/fiscalyear_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}

if ($action == 'confirm_delete' && $confirm == "yes") {
if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontoadd) {
$result = $object->delete($id);
if ($result >= 0) {
header("Location: fiscalyear.php");
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'add') {
} elseif ($action == 'add' && $permissiontoadd) {
if (!GETPOST('cancel', 'alpha')) {
$error = 0;

Expand Down Expand Up @@ -144,7 +144,7 @@
header("Location: ./fiscalyear.php");
exit();
}
} elseif ($action == 'update') {
} elseif ($action == 'update' && $permissiontoadd) {
// Update record
if (!GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id);
Expand All @@ -166,8 +166,19 @@
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit();
}
}
} elseif ($action == 'reopen' && $permissiontoadd && getDolGlobalString('ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD')) {
$result = $object->fetch($id);

$object->status = GETPOST('status', 'int');
$result = $object->update($user);

if ($result > 0) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}


/*
Expand Down Expand Up @@ -345,6 +356,10 @@
if ($user->hasRight('accounting', 'fiscalyear', 'write')) {
print '<div class="tabsAction">';

if (getDolGlobalString('ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD') && $object->status == $object::STATUS_CLOSED) {
print dolGetButtonAction($langs->trans("ReOpen"), '', 'reopen', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), 'reopen', $permissiontoadd);
}

print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';

//print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
Expand Down

0 comments on commit fde37d8

Please sign in to comment.