diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php
index 67d6298863a..deaecd95526 100644
--- a/dev/skeletons/skeleton_page.php
+++ b/dev/skeletons/skeleton_page.php
@@ -114,8 +114,8 @@ if ($action == 'add')
}
{
// Creation KO
- if (! empty($object->errors)) setEventMessage($object->errors, 'errors');
- else setEventMessage($object->error, 'errors');
+ if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
+ else setEventMessages($object->error, null, 'errors');
$action='create';
}
}
@@ -139,7 +139,7 @@ if ($action == 'update' && ! GETPOST('cancel'))
if (empty($object->ref))
{
$error++;
- setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors');
+ setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors');
}
if (! $error)
@@ -152,8 +152,8 @@ if ($action == 'update' && ! GETPOST('cancel'))
else
{
// Creation KO
- if (! empty($object->errors)) setEventMessage($object->errors, 'errors');
- else setEventMessage($object->error, 'errors');
+ if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
+ else setEventMessages($object->error, null, 'errors');
$action='edit';
}
}
@@ -170,14 +170,14 @@ if ($action == 'confirm_delete')
if ($result > 0)
{
// Delete OK
- setEventMessage($langs->trans("RecordDeleted"));
+ setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1));
exit;
}
else
{
- if (! empty($object->errors)) setEventMessage($object->errors,'errors');
- else setEventMessage($object->error,'errors');
+ if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
+ else setEventMessages($object->error,null,'errors');
}
}
@@ -327,6 +327,8 @@ if ($id && (empty($action) || $action == 'view'))
print '
'."\n";
$parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
if (empty($reshook))
{
if ($user->rights->mymodule->write)
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 3b1f61df5b5..1c9de056acc 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -117,6 +117,7 @@ $hookmanager->initHooks(array('membercard'));
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
$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 ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
{
diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index a21f7a53699..d1fe7848564 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -102,7 +102,7 @@ $hookmanager->initHooks(array('categorycard'));
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 5ad90cd24de..f1d27b791e6 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -78,6 +78,7 @@ $object = new Societe($db);
$parameters = array('socid' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($action == 'setcustomeraccountancycode')
diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php
index 18f03f28ca9..ac354d4d08d 100644
--- a/htdocs/comm/list.php
+++ b/htdocs/comm/list.php
@@ -73,6 +73,7 @@ $hookmanager->initHooks(array('customerlist'));
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
@@ -269,7 +270,7 @@ if ($result)
print '
'.$thirdpartystatic->getLibStatut(3);
print '
';
print '
';
-
+
$parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index 441e51ef293..efff271a08c 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -101,6 +101,7 @@ $object->substitutionarrayfortest=array(
$parameters=array();
$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');
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 3eac57a64b4..19be47d5b5f 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -105,8 +105,8 @@ $permissionnote = $user->rights->propale->creer; // Used by the include of actio
*/
$parameters = array('socid' => $socid);
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
- // hooks
+$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');
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 4b43eadeebf..51c07eaa5b2 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -91,6 +91,7 @@ $hookmanager->initHooks(array('propallist'));
$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');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php
index 6e138c1153c..7dada3e115f 100644
--- a/htdocs/comm/prospect/list.php
+++ b/htdocs/comm/prospect/list.php
@@ -161,6 +161,7 @@ $hookmanager->initHooks(array('prospectlist'));
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($action == 'cstc')
{
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 3119205fda8..6c8c54791bf 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -100,6 +100,7 @@ $permissionnote = $user->rights->commande->creer; // Used by the include of acti
$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');
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index d699192acbf..0010195605c 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -78,6 +78,7 @@ $hookmanager->initHooks(array('orderlist'));
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
@@ -423,7 +424,7 @@ if ($resql)
print ''."\n";
print ' '.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).' ';
-
+
$db->free($resql);
}
else
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 00c927bad99..c5d341c0e27 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -111,6 +111,7 @@ $permissionnote = $user->rights->facture->creer; // Used by the include of actio
$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');
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index f5dbd8186cd..07ebfa5ad7d 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -108,6 +108,7 @@ $now=dol_now();
$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');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index cabaf87e4d0..c7af3458fcb 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -71,10 +71,13 @@ $hookmanager->initHooks(array('paiementcard'));
$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');
+
/*
* Actions
*/
+
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
{
$error = 0;
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index ce607091267..f4d42dbaca0 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -83,7 +83,7 @@ $hookmanager->initHooks(array('contactcard'));
$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
@@ -142,10 +142,10 @@ if (empty($reshook))
{
setEventMessage($object->error,'errors');
}
- else
+ else
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
- exit;
+ exit;
}
}
@@ -157,11 +157,11 @@ if (empty($reshook))
{
setEventMessage($object->error,'errors');
}
- else
+ else
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
- exit;
- }
+ exit;
+ }
}
// Add contact
@@ -380,7 +380,7 @@ else
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
dol_fiche_head($head, 'card', $title, 0, 'contact');
-
+
dol_htmloutput_events();
}
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index b0c6991dcf3..ade0014708d 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -88,6 +88,7 @@ $hookmanager->initHooks(array('expeditioncard'));
*/
$parameters=array();
$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 ($action == 'add')
{
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index e5d4aa96856..bcc50d32aca 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -97,9 +97,12 @@ $permissionnote=$user->rights->ficheinter->creer; // Used by the include of acti
/*
* Actions
*/
+
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer)
{
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 313f82547e7..c31dc5525f7 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -54,6 +54,7 @@ $object = new Fournisseur($db);
$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 ($action == 'setsupplieraccountancycode')
{
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 72cc500e187..2591bba4838 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -110,6 +110,7 @@ $permissionnote=$user->rights->fournisseur->commande->creer; // Used by the incl
$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');
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index ff1e713384a..c9926cd59dd 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -88,6 +88,7 @@ $permissionnote=$user->rights->fournisseur->facture->creer; // Used by the inclu
$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');
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index adc62ee4cd8..302570330b7 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -68,10 +68,13 @@ $hookmanager->initHooks(array('paymentsupplier'));
$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');
+
/*
* Actions
*/
+
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
{
$error = 0;
diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php
index 571c4a9925c..e3c7effebbf 100644
--- a/htdocs/fourn/list.php
+++ b/htdocs/fourn/list.php
@@ -66,6 +66,7 @@ $hookmanager->initHooks(array('supplierlist'));
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/*
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 1ddc6dac50b..28b0db5efe9 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -101,7 +101,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barc
$parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=$hookmanager->errors;
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 1e8c7b7cd9a..6ca92968e8d 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -75,6 +75,7 @@ $modulepart='produit';
$parameters=array('id'=>$id);
$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');
/*
@@ -101,7 +102,7 @@ if ($object->id)
dol_fiche_head($head, 'documents', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
-
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 037bb2b1f8b..8720c9cf892 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -64,10 +64,6 @@ $hookmanager->initHooks(array('pricesuppliercard'));
$product = new ProductFournisseur($db);
$product->fetch($id,$ref);
-$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=$hookmanager->errors;
-
-
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@@ -80,8 +76,8 @@ if (! $sortorder) $sortorder="ASC";
*/
$parameters=array('socid'=>$socid, 'id_prod'=>$id);
-$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($action == 'remove_pf')
{
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 82483d59805..bf96d63459e 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -67,10 +67,10 @@ if ($id > 0 || ! empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
-
+
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
- $error=$hookmanager->error; $errors=$hookmanager->errors;
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("","",$langs->trans("CardProduct".$product->type));
@@ -83,8 +83,9 @@ if ($id > 0 || ! empty($ref))
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
-
+
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '
';
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index f9056187cec..93c880695d3 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -67,10 +67,10 @@ if ($id > 0 || ! empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
-
+
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
- $error=$hookmanager->error; $errors=$hookmanager->errors;
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("","",$langs->trans("CardProduct".$product->type));
@@ -80,8 +80,9 @@ if ($id > 0 || ! empty($ref))
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
-
+
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '
';
@@ -147,7 +148,7 @@ if ($id > 0 || ! empty($ref))
print "\n";
$commandestatic=new CommandeFournisseur($db);
-
+
if ($num > 0)
{
$var=True;
@@ -155,7 +156,7 @@ if ($id > 0 || ! empty($ref))
{
$objp = $db->fetch_object($result);
$var=!$var;
-
+
$commandestatic->id=$objp->commandeid;
$commandestatic->ref=$objp->ref;
$commandestatic->statut=$objp->statut;
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index 60d3b9b50c8..6c73d0183fa 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -73,7 +73,7 @@ if ($id > 0 || ! empty($ref))
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
- $error=$hookmanager->error; $errors=$hookmanager->errors;
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("","",$langs->trans("CardProduct".$product->type));
@@ -85,6 +85,7 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '
';
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 376263e122d..1959d53035e 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -72,9 +72,10 @@ if ($id > 0 || ! empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
-
+
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("","",$langs->trans("CardProduct".$product->type));
@@ -87,8 +88,9 @@ if ($id > 0 || ! empty($ref))
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
-
+
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '
';
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 2f1d37602ce..1b07ce3d1ba 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -72,10 +72,10 @@ if ($id > 0 || ! empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
-
+
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
- $error=$hookmanager->error; $errors=$hookmanager->errors;
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("","",$langs->trans("CardProduct".$product->type));
@@ -88,9 +88,9 @@ if ($id > 0 || ! empty($ref))
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
-
- $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '
';
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index ad81e93e299..3368efa2b56 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -66,9 +66,10 @@ if ($id > 0 || ! empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
-
+
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("","",$langs->trans("CardProduct".$product->type));
@@ -78,9 +79,9 @@ if ($id > 0 || ! empty($ref))
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre,0,$picto);
-
- $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '
';
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 6be174a1dd4..273784faf92 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -74,7 +74,7 @@ $date_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendd
$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php
index 38562557e3a..ed48f7e1b04 100755
--- a/htdocs/resource/card.php
+++ b/htdocs/resource/card.php
@@ -60,6 +60,7 @@ $object = new Resource($db);
$hookmanager->initHooks(array('resource_card'));
$parameters=array('resource_id'=>$id);
$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');
/*******************************************************************
@@ -86,7 +87,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write
$object->ref = $ref;
$object->description = $description;
$object->fk_code_type_resource = $fk_code_type_resource;
-
+
$result=$object->update($user);
if ($result > 0)
{
@@ -98,9 +99,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write
setEventMessage('
';
@@ -215,8 +216,8 @@ if ( $object->fetch($id) > 0 )
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
- if (empty($reshook))
- {
+ if (empty($reshook))
+ {
if ($action != "edit" )
{
// Edit resource
diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php
index c5329edd1f3..02a24735454 100644
--- a/htdocs/resource/element_resource.php
+++ b/htdocs/resource/element_resource.php
@@ -138,11 +138,12 @@ if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->dele
$parameters=array('resource_id'=>resource_id);
$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');
$parameters=array('resource_id'=>$resource_id);
$reshook=$hookmanager->executeHooks('getElementResources',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/***************************************************
diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php
index 3fde7b52999..9a0fca19781 100644
--- a/htdocs/resource/list.php
+++ b/htdocs/resource/list.php
@@ -53,9 +53,6 @@ $object = new Resource($db);
$hookmanager->initHooks(array('resource_list'));
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-
if (empty($sortorder)) $sortorder="DESC";
if (empty($sortfield)) $sortfield="t.rowid";
if (empty($arch)) $arch = 0;
@@ -72,12 +69,20 @@ $pagenext = $page + 1;
if( ! $user->rights->resource->read)
accessforbidden();
-/***************************************************
- * VIEW
-*
-* Put here all code to build page
-****************************************************/
+/*
+ * Action
+ */
+
+$parameters=array();
+$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
+ */
$pagetitle=$langs->trans('ResourcePageIndex');
llxHeader('',$pagetitle,'');
@@ -129,7 +134,7 @@ else
print '
';
print $resource->ref;
print '
';
-
+
print '
';
print $resource->type_label;
print '
';
diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php
index b25129580ff..742039176b8 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -47,8 +47,7 @@ $hookmanager->initHooks(array('agendathirdparty'));
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
-
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php
index 14eab2ee038..5436e03274b 100644
--- a/htdocs/societe/commerciaux.php
+++ b/htdocs/societe/commerciaux.php
@@ -57,8 +57,7 @@ if($_GET["socid"] && $_GET["commid"])
$parameters=array('id'=>$_GET["commid"]);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action); // Note that $action and $object may have been modified by some hooks
- $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
-
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) $soc->add_commercial($user, $_GET["commid"]);
@@ -84,8 +83,7 @@ if($_GET["socid"] && $_GET["delcommid"])
$parameters=array('id'=>$_GET["delcommid"]);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action); // Note that $action and $object may have been modified by some hooks
- $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
-
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) $soc->del_commercial($user, $_GET["delcommid"]);
diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php
index 446a4f415fb..305936e6f56 100644
--- a/htdocs/societe/info.php
+++ b/htdocs/societe/info.php
@@ -48,7 +48,7 @@ $hookmanager->initHooks(array('infothirdparty'));
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index cf801c0b3dd..e45ce6eee7b 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -86,7 +86,7 @@ $hookmanager->initHooks(array('thirdpartycard'));
$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{