Fix hook implementation on some thirdparty pages

This commit is contained in:
Laurent Destailleur 2015-12-23 14:31:42 +01:00
parent 932c3f9172
commit 2d3915b88c
3 changed files with 143 additions and 102 deletions

View File

@ -49,6 +49,21 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.datef"; if (! $sortfield) $sortfield="f.datef";
$object = new Societe($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('thirdpartymargins','globalcard'));
/*
* Actions
*/
$parameters=array('id'=>$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');
/* /*
* View * View

View File

@ -56,11 +56,23 @@ if (! $sortfield) $sortfield="c.lastname";
$now=dol_now(); $now=dol_now();
$object = new Societe($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('thirdpartynotification','globalcard'));
/* /*
* Actions * Actions
*/ */
$parameters=array('id'=>$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))
{
// Add a notification // Add a notification
if ($action == 'add') if ($action == 'add')
{ {
@ -116,6 +128,7 @@ if ($action == 'delete')
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"];
$db->query($sql); $db->query($sql);
} }
}
@ -150,7 +163,7 @@ if ($result > 0)
print '</td></tr>'; print '</td></tr>';
// Alias names (commercial, trademark or alias names) // Alias names (commercial, trademark or alias names)
print '<tr><td valign="top">'.$langs->trans('AliasNames').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('AliasNames').'</td><td colspan="3">';
print $object->name_alias; print $object->name_alias;
print "</td></tr>"; print "</td></tr>";

View File

@ -49,11 +49,23 @@ if ($user->societe_id)
$socid = $user->societe_id; $socid = $user->societe_id;
$result = restrictedArea($user, 'societe', $socid, '&societe'); $result = restrictedArea($user, 'societe', $socid, '&societe');
$object = new Societe($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('thirdpartycustomerprice','globalcard'));
/* /*
* Actions * Actions
*/ */
$parameters=array('id'=>$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 == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
$update_child_soc = GETPOST('updatechildprice'); $update_child_soc = GETPOST('updatechildprice');
@ -113,6 +125,7 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user-
$action = ''; $action = '';
} }
}
/* /*