Merge pull request #11529 from atm-ph/fix_9.0_missing_hook
Fix missing hook
This commit is contained in:
commit
56851f475e
@ -63,78 +63,86 @@ $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))
|
||||||
{
|
{
|
||||||
$res=$object->delete($user);
|
if ( $action == 'confirm_delete' )
|
||||||
if ($res > 0)
|
{
|
||||||
{
|
$res=$object->delete($user);
|
||||||
header("Location: index.php");
|
if ($res > 0)
|
||||||
exit;
|
{
|
||||||
}
|
header("Location: index.php");
|
||||||
}
|
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'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
||||||
{
|
{
|
||||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||||
|
|
||||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
||||||
{
|
{
|
||||||
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: card.php?id=".$id);
|
header("Location: card.php?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Fichier invalide",LOG_WARNING);
|
dol_syslog("Fichier invalide",LOG_WARNING);
|
||||||
$mesg='BadFile';
|
$mesg='BadFile';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
header("Location: card.php?id=".$id."&error=$error");
|
header("Location: card.php?id=".$id."&error=$error");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user