fix: add hook management into product translation tab

This commit is contained in:
Florian HENRY 2021-07-30 09:38:29 +02:00
parent 57d637ac71
commit 8ea6fc3174

View File

@ -62,11 +62,20 @@ if ($object->id > 0) {
restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('producttranslationcard', 'globalcard'));
/*
* Actions
*/
$parameters = array('id'=>$id, 'ref'=>$ref);
$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)) {
// retour a l'affichage des traduction si annulation
if ($cancel == $langs->trans("Cancel")) {
$action = '';
@ -156,6 +165,7 @@ if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && ($user->rights
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
$object = new Product($db);
$result = $object->fetch($id, $ref);
@ -216,6 +226,9 @@ print dol_get_fiche_end();
*/
print "\n".'<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
if (empty($reshook)) {
if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/product/traduction.php?action=add&id=' . $object->id . '">' . $langs->trans("Add") . '</a>';
@ -224,6 +237,7 @@ if ($action == '') {
}
}
}
}
print "\n".'</div>'."\n";
@ -263,6 +277,9 @@ if ($action == 'edit') {
}
}
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print '<br>';
print '<div class="center">';
@ -334,6 +351,9 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
}
print '</table>';
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print dol_get_fiche_end();
print '<div class="center">';