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

Fix missing hook
This commit is contained in:
Laurent Destailleur 2019-07-22 18:41:55 +02:00 committed by GitHub
commit 56851f475e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,34 +63,41 @@ $object = new BonPrelevement($db,"");
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
$hookmanager->initHooks(array('directdebitprevcard','globalcard'));
/* /*
* Actions * Actions
*/ */
if ( $action == 'confirm_delete' ) $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 == 'confirm_delete' )
{
$res=$object->delete($user); $res=$object->delete($user);
if ($res > 0) if ($res > 0)
{ {
header("Location: index.php"); header("Location: index.php");
exit; exit;
} }
} }
// Seems to no be used and replaced with $action == 'infocredit // Seems to no be used and replaced with $action == 'infocredit
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes') if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
{ {
$res=$object->set_credite(); $res=$object->set_credite();
if ($res >= 0) if ($res >= 0)
{ {
header("Location: card.php?id=".$id); header("Location: card.php?id=".$id);
exit; exit;
} }
} }
if ($action == 'infotrans' && $user->rights->prelevement->bons->send) if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
@ -121,11 +128,11 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
header("Location: card.php?id=".$id."&error=$error"); header("Location: card.php?id=".$id."&error=$error");
exit; exit;
} }
} }
// Set direct debit order to credited, create payment and close invoices // Set direct debit order to credited, create payment and close invoices
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
{ {
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$error = $object->set_infocredit($user, $dt); $error = $object->set_infocredit($user, $dt);
@ -135,6 +142,7 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
header("Location: card.php?id=".$id."&error=$error"); header("Location: card.php?id=".$id."&error=$error");
exit; exit;
} }
}
} }