diff --git a/ChangeLog b/ChangeLog index e499c5b4e1c..b641ebf3ddb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,8 +31,8 @@ WARNING: Following changes may create regression for some external modules, but Dolibarr better: - Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the trigger ORDER_SUPPLIER_CREATE instead. -- printLeftBlock is now compliant with hook development rules. It is an "addreplace" hook so you must -return content by doing ->resprints='mycontent' and not by doing return 'mycontent' +- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are + "addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'" ***** ChangeLog for 3.7 compared to 3.6.* ***** diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index f2ca52f1f89..cbd0436e2ef 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1346,9 +1346,9 @@ if ($action == 'create') if (! $formconfirm) { $parameters = array('lineid' => $lineid); - $formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified - // by - // hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index de68313e6f8..c9d5170f7e6 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1680,9 +1680,9 @@ if ($action == 'create') if (! $formconfirm) { $parameters = array('lineid' => $lineid); - $formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified - // by - // hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bef752f5954..aa72ec9bf68 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -253,7 +253,7 @@ if (empty($reshook)) $object->contactid = GETPOST('contactid'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); - + // If creation from another object of another module (Example: origin=propal, originid=1) if (! empty($origin) && ! empty($originid)) { @@ -523,7 +523,7 @@ if (empty($reshook)) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } - + // bank account else if ($action == 'setbankaccount' && $user->rights->commande->creer) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); @@ -1726,8 +1726,9 @@ if ($action == 'create' && $user->rights->commande->creer) if (! $formconfirm) { $parameters = array('lineid' => $lineid); - $formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified - // by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm @@ -1988,10 +1989,10 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; } - + // Incoterms if (!empty($conf->incoterm->enabled)) - { + { print ''; print ''; } - + // Other attributes $cols = 3; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -2243,10 +2244,10 @@ if ($action == 'create' && $user->rights->commande->creer) } // Cancel order - if ($object->statut == 1 && + if ($object->statut == 1 && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler))) - ) + ) { print '
' . $langs->trans('Cancel') . '
'; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d38519bf6d5..f87f797509b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -324,7 +324,7 @@ if (empty($reshook)) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } - + // bank account else if ($action == 'setbankaccount' && $user->rights->facture->creer) { @@ -2289,7 +2289,7 @@ if ($action == 'create') print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); print ''; } - + // Other attributes $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by @@ -2749,8 +2749,9 @@ if ($action == 'create') if (! $formconfirm) { $parameters = array('lineid' => $lineid); - $formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by - // hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm @@ -3389,10 +3390,10 @@ if ($action == 'create') print ''; print ''; } - + // Incoterms if (!empty($conf->incoterm->enabled)) - { + { print '
'; print $langs->trans('IncotermLabel'); @@ -2005,13 +2006,13 @@ if ($action == 'create' && $user->rights->commande->creer) { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); } - else + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print '
'; print '
'; print $langs->trans('IncotermLabel'); @@ -3406,7 +3407,7 @@ if ($action == 'create') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); } - else + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 661ffc9af30..9eb9b243830 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1210,7 +1210,9 @@ else if ($id > 0 || ! empty($ref)) if (!$formconfirm) { $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 41d06bebf43..3f6877d8d14 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1733,7 +1733,9 @@ elseif (! empty($object->id)) if (!$formconfirm) { $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1a37baa9937..cd6a9f64abd 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1716,7 +1716,9 @@ else if (!$formconfirm) { $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } // Print form confirm