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'"
This commit is contained in:
parent
2c61717e10
commit
cd2fc2f890
@ -31,8 +31,8 @@ WARNING: Following changes may create regression for some external modules, but
|
|||||||
Dolibarr better:
|
Dolibarr better:
|
||||||
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
|
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
|
||||||
trigger ORDER_SUPPLIER_CREATE instead.
|
trigger ORDER_SUPPLIER_CREATE instead.
|
||||||
- printLeftBlock is now compliant with hook development rules. It is an "addreplace" hook so you must
|
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
|
||||||
return content by doing ->resprints='mycontent' and not by doing return 'mycontent'
|
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.7 compared to 3.6.* *****
|
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||||
|
|||||||
@ -1346,9 +1346,9 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// by
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
// hook
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
|
|||||||
@ -1680,9 +1680,9 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// by
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
// hook
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
|
|||||||
@ -253,7 +253,7 @@ if (empty($reshook))
|
|||||||
$object->contactid = GETPOST('contactid');
|
$object->contactid = GETPOST('contactid');
|
||||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
if (! empty($origin) && ! empty($originid))
|
if (! empty($origin) && ! empty($originid))
|
||||||
{
|
{
|
||||||
@ -523,7 +523,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
@ -1726,8 +1726,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// by hook
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
@ -1988,10 +1989,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
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);
|
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 $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 3;
|
$cols = 3;
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
@ -2243,10 +2244,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cancel order
|
// 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->cloturer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -324,7 +324,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
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 $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
|
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$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) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// hook
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
@ -3389,10 +3390,10 @@ if ($action == 'create')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
print $langs->trans('IncotermLabel');
|
||||||
@ -3406,7 +3407,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
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 $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1210,7 +1210,9 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if (!$formconfirm)
|
if (!$formconfirm)
|
||||||
{
|
{
|
||||||
$parameters=array('lineid'=>$lineid);
|
$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
|
// Print form confirm
|
||||||
|
|||||||
@ -1733,7 +1733,9 @@ elseif (! empty($object->id))
|
|||||||
|
|
||||||
if (!$formconfirm) {
|
if (!$formconfirm) {
|
||||||
$parameters=array('lineid'=>$lineid);
|
$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
|
// Print form confirm
|
||||||
|
|||||||
@ -1716,7 +1716,9 @@ else
|
|||||||
|
|
||||||
if (!$formconfirm) {
|
if (!$formconfirm) {
|
||||||
$parameters=array('lineid'=>$lineid);
|
$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
|
// Print form confirm
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user