From e45d5c1d0dc3fd955016e5b96840a84ede68a6a5 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Fri, 9 Jul 2021 18:36:21 +0200 Subject: [PATCH] NEW add hookmanager on note pages --- htdocs/adherents/note.php | 9 +++++++-- htdocs/asset/note.php | 6 +++++- htdocs/bom/bom_note.php | 7 ++++++- htdocs/comm/propal/note.php | 11 ++++++++++- htdocs/commande/card.php | 7 ++++--- htdocs/commande/note.php | 11 ++++++++++- htdocs/compta/facture/note.php | 9 ++++++++- htdocs/contact/note.php | 10 ++++++++-- htdocs/contrat/note.php | 15 ++++++++++----- htdocs/don/note.php | 9 ++++++++- .../conferenceorboothattendee_note.php | 6 +++++- htdocs/expedition/note.php | 9 ++++++++- htdocs/expensereport/note.php | 10 ++++++++-- htdocs/fichinter/note.php | 8 +++++++- htdocs/fourn/commande/note.php | 11 ++++++++--- htdocs/fourn/facture/note.php | 10 +++++++++- .../knowledgemanagement/knowledgerecord_note.php | 7 ++++++- htdocs/loan/note.php | 10 +++++++++- htdocs/modulebuilder/template/myobject_note.php | 7 ++++++- htdocs/mrp/mo_note.php | 8 +++++++- htdocs/partnership/partnership_note.php | 6 +++++- htdocs/product/note.php | 9 ++++++++- htdocs/projet/note.php | 8 +++++++- htdocs/projet/tasks/note.php | 10 +++++++++- htdocs/reception/note.php | 12 +++++++++++- .../recruitment/recruitmentcandidature_note.php | 7 ++++++- .../recruitment/recruitmentjobposition_note.php | 7 ++++++- htdocs/resource/note.php | 10 +++++++++- htdocs/societe/note.php | 6 ++++++ htdocs/supplier_proposal/note.php | 12 +++++++++++- htdocs/workstation/workstation_note.php | 6 +++++- 31 files changed, 232 insertions(+), 41 deletions(-) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index cc216d794d1..b351cd2b67d 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -68,15 +68,20 @@ if ($id) { $caneditfieldmember = $user->rights->adherent->creer; } +$hookmanager->initHooks(array('membernote')); + // Security check $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0); - /* * Actions */ +$reshook = $hookmanager->executeHooks('doActions', array(), $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 include_once +if (empty($reshook)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 752591ade9e..eaf888fde05 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -70,8 +70,12 @@ $permissionnote = 1; * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* * View diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 539eb654751..6cd0d8e0692 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -70,7 +70,12 @@ restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft); * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 6dd62a9990d..d9ff0603e9f 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -52,6 +52,10 @@ if ($user->socid > 0) { $socid = $user->socid; $object->id = $user->socid; } + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('propalnote')); + restrictedArea($user, 'propal', $object->id, 'propal'); @@ -61,7 +65,12 @@ restrictedArea($user, 'propal', $object->id, 'propal'); $permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6d0badf6380..db3d4ee621e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -91,6 +91,10 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($con if (!empty($user->socid)) { $socid = $user->socid; } + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('ordercard', 'globalcard')); + $result = restrictedArea($user, 'commande', $id); $object = new Commande($db); @@ -102,9 +106,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('ordercard', 'globalcard')); - $usercanread = $user->rights->commande->lire; $usercancreate = $user->rights->commande->creer; $usercandelete = $user->rights->commande->supprimer; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 6872990a3ec..8fa66913922 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -45,6 +45,10 @@ $socid = 0; if ($user->socid) { $socid = $user->socid; } + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('ordernote')); + $result = restrictedArea($user, 'commande', $id, ''); @@ -61,7 +65,12 @@ $permissionnote = $user->rights->commande->creer; // Used by the include of acti * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index f019d822529..0e6ab39f5ca 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -54,6 +54,8 @@ $socid = 0; if ($user->socid) { $socid = $user->socid; } +$hookmanager->initHooks(array('invoicenote')); + $result = restrictedArea($user, 'facture', $id, ''); @@ -61,7 +63,12 @@ $result = restrictedArea($user, 'facture', $id, ''); * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index c301ef02276..167ee7ef4a3 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -49,13 +49,19 @@ if ($id > 0) { $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('contactcard')); +// $hookmanager->initHooks(array('contactcard')); -> Name conflict with product/card.php +$hookmanager->initHooks(array('contactnote')); + /* * Actions */ +$reshook = $hookmanager->executeHooks('doActions', array(), $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 +if (empty($reshook)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once /* diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index eab56b97a16..a41a33af6c7 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -44,6 +44,10 @@ $ref = GETPOST('ref', 'alpha'); if ($user->socid) { $socid = $user->socid; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +//$hookmanager->initHooks(array('contractcard', 'globalcard')); -> Conflict with contrat\card.php +$hookmanager->initHooks(array('contractnote')); + $result = restrictedArea($user, 'contrat', $id); $object = new Contrat($db); @@ -51,16 +55,17 @@ $object->fetch($id, $ref); $permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('contractcard', 'globalcard')); - - /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once diff --git a/htdocs/don/note.php b/htdocs/don/note.php index 2e153d73b95..fdf70350680 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -47,6 +47,8 @@ $socid = 0; if ($user->socid) { $socid = $user->socid; } +$hookmanager->initHooks(array('donnote')); + $result = restrictedArea($user, 'don', $id, ''); $object = new Don($db); @@ -58,7 +60,12 @@ $permissionnote = $user->rights->don->creer; // Used by the include of actions_s /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once if ($action == 'classin' && $user->rights->don->creer) { $object->fetch($id); diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 46620112311..02312ded462 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -115,8 +115,12 @@ $permissiontoadd = $user->rights->eventorganization->conferenceorboothattendee-> * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* * View diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index a9076162015..4aebfdc7da5 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -69,6 +69,8 @@ $permissionnote = $user->rights->expedition->creer; // Used by the include of ac if ($user->socid) { $socid = $user->socid; } + +$hookmanager->initHooks(array('expeditionnote')); $result = restrictedArea($user, 'expedition', $object->id, ''); @@ -76,7 +78,12 @@ $result = restrictedArea($user, 'expedition', $object->id, ''); * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php index b0156c6a475..24ea0dd4643 100644 --- a/htdocs/expensereport/note.php +++ b/htdocs/expensereport/note.php @@ -44,6 +44,8 @@ $socid = 0; if ($user->socid) { $socid = $user->socid; } +$hookmanager->initHooks(array('expensereportnote')); + $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); @@ -68,12 +70,16 @@ if ($object->id > 0) { } } - /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index fcc790bf8c2..b671aacf252 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -42,6 +42,7 @@ $action = GETPOST('action', 'aZ09'); if ($user->socid) { $socid = $user->socid; } +$hookmanager->initHooks(array('fichinternote')); $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); @@ -53,7 +54,12 @@ $permissionnote = $user->rights->ficheinter->creer; // Used by the include of ac * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index d9b0904c7ef..22c93256cbb 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -43,13 +43,13 @@ $action = GETPOST('action', 'aZ09'); if ($user->socid) { $socid = $user->socid; } + +$hookmanager->initHooks(array('ordersuppliercardnote')); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); $object = new CommandeFournisseur($db); $object->fetch($id, $ref); -$hookmanager->initHooks(array('ordersuppliercardnote')); - $permissionnote = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); // Used by the include of actions_setnotes.inc.php @@ -57,7 +57,12 @@ $permissionnote = ($user->rights->fournisseur->commande->creer || $user->rights- * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 5bbf1fdcba6..cede169b8c6 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -44,6 +44,9 @@ $action = GETPOST('action', 'aZ09'); if ($user->socid) { $socid = $user->socid; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('invoicesuppliernote')); + $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $object = new FactureFournisseur($db); @@ -56,7 +59,12 @@ $permissionnote = ($user->rights->fournisseur->facture->creer || $user->rights-> * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once // Set label if ($action == 'setlabel' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index a6a9974a9c8..93be4e841ec 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -66,7 +66,12 @@ $permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; / * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/loan/note.php b/htdocs/loan/note.php index f7930b64c9a..3bf520a3ae0 100644 --- a/htdocs/loan/note.php +++ b/htdocs/loan/note.php @@ -41,6 +41,8 @@ $langs->loadLangs(array("loan")); // Security check $id = GETPOST('id', 'int'); + +$hookmanager->initHooks(array('loannote')); $result = restrictedArea($user, 'loan', $id, '&loan'); $object = new Loan($db); @@ -55,7 +57,13 @@ $permissionnote = $user->rights->loan->write; // Used by the include of actions_ * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index f5fc29a2591..48f78c4d37e 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -117,7 +117,12 @@ $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the incl * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index 6bbfc503453..e7c08d4378f 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -68,7 +68,13 @@ $permissionnote = $user->rights->mrp->write; // Used by the include of actions_s * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index b9607e5aeb6..90f2e54933d 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -65,8 +65,12 @@ $permissiontoadd = $user->rights->partnership->write; // Used by the include of /* * Actions */ +$reshook = $hookmanager->executeHooks('doActions', array(), $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 include_once +if (empty($reshook)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/product/note.php b/htdocs/product/note.php index b758f414035..12e1d80774a 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -63,11 +63,18 @@ if ($object->id > 0) { } +$hookmanager->initHooks(array('productnote')); + + /* * Actions */ +$reshook = $hookmanager->executeHooks('doActions', array(), $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 +if (empty($reshook)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once /* diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 8b65156570a..e93e361eb64 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -46,6 +46,7 @@ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob // Security check $socid = 0; //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. +$hookmanager->initHooks(array('projetnote')); $result = restrictedArea($user, 'projet', $id, 'projet&project'); $permissionnote = $user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php @@ -55,7 +56,12 @@ $permissionnote = $user->rights->projet->creer; // Used by the include of action * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 4d581afc30a..8c3e43b578f 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -44,6 +44,9 @@ $socid = 0; if (!$user->rights->projet->lire) { accessforbidden(); } + +$hookmanager->initHooks(array('projettasknote')); + //$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification $object = new Task($db); @@ -89,7 +92,12 @@ $permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->c * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index f343e56e14d..90c448294d7 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -67,6 +67,11 @@ $permissionnote = $user->rights->reception->creer; // Used by the include of act if ($user->socid > 0) { $socid = $user->socid; } + + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('receptionnote')); + if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); } else { @@ -87,7 +92,12 @@ if ($origin == 'reception') { * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php index d4c18155c5d..3b92802d5b1 100644 --- a/htdocs/recruitment/recruitmentcandidature_note.php +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -94,7 +94,12 @@ $result = restrictedArea($user, 'recruitment', $object->id, 'recruitment_recruit * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/recruitment/recruitmentjobposition_note.php b/htdocs/recruitment/recruitmentjobposition_note.php index 9dbcd0e1180..8911fd55361 100644 --- a/htdocs/recruitment/recruitmentjobposition_note.php +++ b/htdocs/recruitment/recruitmentjobposition_note.php @@ -99,7 +99,12 @@ $result = restrictedArea($user, 'recruitment', $object->id, 'recruitment_recruit * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/resource/note.php b/htdocs/resource/note.php index 07819b1d0b4..1f58cc348f4 100644 --- a/htdocs/resource/note.php +++ b/htdocs/resource/note.php @@ -40,6 +40,9 @@ $action = GETPOST('action', 'aZ09'); if ($user->socid) { $socid = $user->socid; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('resourcenote')); + $result = restrictedArea($user, 'resource', $id, 'resource'); $object = new DolResource($db); @@ -52,7 +55,12 @@ $permissionnote = $user->rights->resource->write; // Used by the include of acti * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index d4396738966..ee2eeed65a5 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -56,6 +56,12 @@ $result = restrictedArea($user, 'societe', $object->id, '&societe'); /* * Actions */ +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index d16bc90033e..e463fbcb26c 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -43,6 +43,11 @@ $action = GETPOST('action', 'aZ09'); if ($user->socid) { $socid = $user->socid; } + + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('supplier_proposalnote')); + $result = restrictedArea($user, 'supplier_proposal', $id, 'supplier_proposal'); $object = new SupplierProposal($db); @@ -55,7 +60,12 @@ $object = new SupplierProposal($db); $permissionnote = $user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$reshook = $hookmanager->executeHooks('doActions', array(), $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)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /* diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php index 18fa87b5ea6..f1198e971ab 100755 --- a/htdocs/workstation/workstation_note.php +++ b/htdocs/workstation/workstation_note.php @@ -68,8 +68,12 @@ restrictedArea($user, $object->element, $object->id, $object->table_element, 'wo /* * Actions */ +$reshook = $hookmanager->executeHooks('doActions', array(), $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 include_once +if (empty($reshook)) + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once /*