Merge pull request #11526 from atm-ph/fix_9.0_missing_hook

Fix missing hook then can't interact with actions
This commit is contained in:
Laurent Destailleur 2019-07-18 17:24:08 +02:00 committed by GitHub
commit b0baba3293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 51 deletions

View File

@ -61,13 +61,22 @@ if ($id > 0 || ! empty($ref))
} }
} }
$hookmanager->initHooks(array('directdebitcard','globalcard'));
/* /*
* Actions * Actions
*/ */
if ($action == "new") $parameters = array('socid' => $socid);
$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 (empty($reshook))
{ {
if ($action == "new")
{
if ($object->id > 0) if ($object->id > 0)
{ {
$db->begin(); $db->begin();
@ -86,10 +95,10 @@ if ($action == "new")
} }
} }
$action=''; $action='';
} }
if ($action == "delete") if ($action == "delete")
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
$result = $object->demande_prelevement_delete($user, GETPOST('did')); $result = $object->demande_prelevement_delete($user, GETPOST('did'));
@ -99,6 +108,7 @@ if ($action == "delete")
exit; exit;
} }
} }
}
} }

View File

@ -51,20 +51,30 @@ $page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page; $offset = $limit * $page;
$hookmanager->initHooks(array('directdebitcreatecard','globalcard'));
/* /*
* Actions * Actions
*/ */
// Change customer bank information to withdraw $parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
if ($action == 'modify') $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 (empty($reshook))
{ {
// Change customer bank information to withdraw
if ($action == 'modify')
{
for ($i = 1 ; $i < 9 ; $i++) for ($i = 1 ; $i < 9 ; $i++)
{ {
dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"),'chaine',0,'',$conf->entity); dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"),'chaine',0,'',$conf->entity);
} }
} }
if ($action == 'create') if ($action == 'create')
{ {
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
$bprev = new BonPrelevement($db); $bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
@ -88,6 +98,7 @@ if ($action == 'create')
{ {
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
} }
}
} }