NEW do actions hook on bank card

This commit is contained in:
lvessiller 2021-06-10 16:18:20 +02:00
parent 39fe315e3f
commit ed53301cec

View File

@ -73,11 +73,17 @@ $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '',
* Actions * Actions
*/ */
if ($cancel) { $parameters = array();
$action = ''; $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
} if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($action == 'add') { if (empty($reshook)) {
if ($cancel) {
$action = '';
}
if ($action == 'add') {
$error = 0; $error = 0;
$db->begin(); $db->begin();
@ -176,9 +182,9 @@ if ($action == 'add') {
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
// Update account // Update account
@ -272,9 +278,9 @@ if ($action == 'update') {
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->banque->configurer) { if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->banque->configurer) {
// Delete // Delete
$object = new Account($db); $object = new Account($db);
$object->fetch(GETPOST("id", "int")); $object->fetch(GETPOST("id", "int"));
@ -282,15 +288,15 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights-
if ($result > 0) { if ($result > 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".DOL_URL_ROOT."/compta/bank/list.php"); header("Location: " . DOL_URL_ROOT . "/compta/bank/list.php");
exit; exit;
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = ''; $action = '';
} }
}
} }
/* /*
* View * View
*/ */