From a2446e51dbde79ff97966b57d40235adbf8e9894 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis.houssin@capnetworks.com>
Date: Mon, 6 Oct 2014 07:20:58 +0200
Subject: [PATCH] New: add context "globalcard" for declaring only once all
 cards

---
 htdocs/adherents/card.php          | 2 +-
 htdocs/adherents/type.php          | 2 +-
 htdocs/categories/categorie.php    | 2 +-
 htdocs/comm/action/card.php        | 2 +-
 htdocs/comm/card.php               | 2 +-
 htdocs/comm/mailing/card.php       | 2 +-
 htdocs/comm/propal.php             | 2 +-
 htdocs/commande/card.php           | 2 +-
 htdocs/compta/deplacement/card.php | 2 +-
 htdocs/compta/dons/card.php        | 2 +-
 htdocs/compta/facture.php          | 2 +-
 htdocs/compta/paiement.php         | 2 +-
 htdocs/compta/salaries/card.php    | 2 +-
 htdocs/compta/tva/card.php         | 2 +-
 htdocs/contact/card.php            | 2 +-
 htdocs/contrat/card.php            | 2 +-
 htdocs/expedition/card.php         | 2 +-
 htdocs/fichinter/card.php          | 2 +-
 htdocs/fourn/card.php              | 2 +-
 htdocs/fourn/commande/card.php     | 2 +-
 htdocs/fourn/facture/card.php      | 2 +-
 htdocs/livraison/card.php          | 2 +-
 htdocs/product/card.php            | 2 +-
 htdocs/product/fournisseurs.php    | 2 +-
 htdocs/product/stock/card.php      | 2 +-
 htdocs/projet/card.php             | 2 +-
 htdocs/projet/tasks.php            | 2 +-
 htdocs/projet/tasks/task.php       | 2 +-
 htdocs/resource/card.php           | 2 +-
 htdocs/societe/commerciaux.php     | 2 +-
 htdocs/societe/soc.php             | 2 +-
 htdocs/user/card.php               | 2 +-
 32 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 60b90a9cf31..ca7706989e0 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -108,7 +108,7 @@ if ($rowid)
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('membercard'));
+$hookmanager->initHooks(array('membercard','globalcard'));
 
 
 /*
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index d9b04e3c506..0ffdc8b7e7f 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -70,7 +70,7 @@ if (GETPOST('button_removefilter'))
 
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('membertypecard'));
+$hookmanager->initHooks(array('membertypecard','globalcard'));
 
 /*
  *	Actions
diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index d1fe7848564..52e352779ba 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -93,7 +93,7 @@ if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('categorycard'));
+$hookmanager->initHooks(array('categorycard','globalcard'));
 
 
 /*
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 5f663d076ec..e4c0fe78aa9 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -81,7 +81,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 //var_dump($_POST);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('actioncard'));
+$hookmanager->initHooks(array('actioncard','globalcard'));
 
 
 /*
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index f1d27b791e6..d0dd842cd7c 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -68,7 +68,7 @@ if (! $sortorder) $sortorder="ASC";
 if (! $sortfield) $sortfield="nom";
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('commcard'));
+$hookmanager->initHooks(array('commcard','globalcard'));
 
 $object = new Societe($db);
 
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index efff271a08c..678ea8f622d 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -52,7 +52,7 @@ $extrafields = new ExtraFields($db);
 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('mailingcard'));
+$hookmanager->initHooks(array('mailingcard','globalcard'));
 
 // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
 $object->substitutionarray=array(
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 19be47d5b5f..34adf5d5f68 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref)) {
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('propalcard'));
+$hookmanager->initHooks(array('propalcard','globalcard'));
 
 $permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
 
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 6c8c54791bf..92fed596819 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -90,7 +90,7 @@ if ($id > 0 || ! empty($ref)) {
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('ordercard'));
+$hookmanager->initHooks(array('ordercard','globalcard'));
 
 $permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
 
diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php
index 80d1858d167..20433118bbf 100644
--- a/htdocs/compta/deplacement/card.php
+++ b/htdocs/compta/deplacement/card.php
@@ -47,7 +47,7 @@ $confirm = GETPOST('confirm','alpha');
 $object = new Deplacement($db);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('tripsandexpensescard'));
+$hookmanager->initHooks(array('tripsandexpensescard','globalcard'));
 
 $permissionnote=$user->rights->deplacement->creer;	// Used by the include of actions_setnotes.inc.php
 
diff --git a/htdocs/compta/dons/card.php b/htdocs/compta/dons/card.php
index a9c8a42448b..e453ef623c3 100644
--- a/htdocs/compta/dons/card.php
+++ b/htdocs/compta/dons/card.php
@@ -50,7 +50,7 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
 $result = restrictedArea($user, 'don', $id);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('doncard'));
+$hookmanager->initHooks(array('doncard','globalcard'));
 
 
 /*
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index f41ac9ef4e5..a358598264e 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -101,7 +101,7 @@ if ($id > 0 || ! empty($ref)) {
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('invoicecard'));
+$hookmanager->initHooks(array('invoicecard','globalcard'));
 
 $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
 
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index c7af3458fcb..21b2eb9e154 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -67,7 +67,7 @@ if ($facid > 0)
 }
 
 // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('paiementcard'));
+$hookmanager->initHooks(array('paiementcard','globalcard'));
 
 $parameters=array('socid'=>$socid);
 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php
index 2cef32b136e..3ee796c6134 100644
--- a/htdocs/compta/salaries/card.php
+++ b/htdocs/compta/salaries/card.php
@@ -44,7 +44,7 @@ $result = restrictedArea($user, 'salaries', '', '', '');
 $sal = new PaymentSalary($db);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('salarycard'));
+$hookmanager->initHooks(array('salarycard','globalcard'));
 
 
 
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index c87530e6511..268a1af8e66 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -42,7 +42,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
 $tva = new Tva($db);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('taxvatcard'));
+$hookmanager->initHooks(array('taxvatcard','globalcard'));
 
 
 
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 2df9986dba0..f3abf9e2bfe 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -74,7 +74,7 @@ if (! empty($canvas))
 $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('contactcard'));
+$hookmanager->initHooks(array('contactcard','globalcard'));
 
 
 /*
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 8dbf4d35fa4..1b47912fa41 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -66,7 +66,7 @@ $result=restrictedArea($user,'contrat',$id);
 $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('contractcard'));
+$hookmanager->initHooks(array('contractcard','globalcard'));
 
 $object = new Contrat($db);
 $extrafields = new ExtraFields($db);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index e9083b77e21..c2649e5f8df 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -82,7 +82,7 @@ if ($id > 0 || ! empty($ref))
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('expeditioncard'));
+$hookmanager->initHooks(array('expeditioncard','globalcard'));
 
 /*
  * Actions
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 1cf9ce563ed..70d425d04a1 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -77,7 +77,7 @@ if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('interventioncard'));
+$hookmanager->initHooks(array('interventioncard','globalcard'));
 
 $object = new Fichinter($db);
 $extrafields = new ExtraFields($db);
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 840151b6001..9bbc27ca51c 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -50,7 +50,7 @@ $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe');
 $object = new Fournisseur($db);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('suppliercard'));
+$hookmanager->initHooks(array('suppliercard','globalcard'));
 
 /*
  * Action
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 1c699b21711..d6be5491f54 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -72,7 +72,7 @@ if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('ordersuppliercard'));
+$hookmanager->initHooks(array('ordersuppliercard','globalcard'));
 
 $object = new CommandeFournisseur($db);
 $extrafields = new ExtraFields($db);
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index c9926cd59dd..b58c17dcf62 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -69,7 +69,7 @@ if (! empty($user->societe_id)) $socid=$user->societe_id;
 $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('invoicesuppliercard'));
+$hookmanager->initHooks(array('invoicesuppliercard','globalcard'));
 
 $object=new FactureFournisseur($db);
 
diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php
index 772ab34c291..98f08803af4 100644
--- a/htdocs/livraison/card.php
+++ b/htdocs/livraison/card.php
@@ -65,7 +65,7 @@ if ($id > 0 || ! empty($ref)) {
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('deliverycard'));
+$hookmanager->initHooks(array('deliverycard','globalcard'));
 
 /*
  * Actions
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 856d4a477fb..a9f533ba40b 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -88,7 +88,7 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
 $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype,$objcanvas);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('productcard'));
+$hookmanager->initHooks(array('productcard','globalcard'));
 
 
 
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 8720c9cf892..9832e57eb6d 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -60,7 +60,7 @@ if ($user->societe_id) $socid=$user->societe_id;
 $result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('pricesuppliercard'));
+$hookmanager->initHooks(array('pricesuppliercard','globalcard'));
 $product = new ProductFournisseur($db);
 $product->fetch($id,$ref);
 
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index b95fe58d752..051a0575aaa 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -49,7 +49,7 @@ if (! $sortorder) $sortorder="DESC";
 $result=restrictedArea($user,'stock');
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('warehousecard'));
+$hookmanager->initHooks(array('warehousecard','globalcard'));
 
 
 /*
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 273784faf92..df67d9d8fa1 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -45,7 +45,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0;
 //if (! $user->rights->projet->all->lire) $mine=1;	// Special for projects
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('projectcard'));
+$hookmanager->initHooks(array('projectcard','globalcard'));
 
 $object = new Project($db);
 $extrafields = new ExtraFields($db);
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 6b5cc453cbf..d1d5092628e 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -64,7 +64,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
 $result = restrictedArea($user, 'projet', $id);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('projecttaskcard'));
+$hookmanager->initHooks(array('projecttaskcard','globalcard'));
 
 $progress=GETPOST('progress', 'int');
 $label=GETPOST('label', 'alpha');
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index c8f60cde7a1..8e5b664759e 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -50,7 +50,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
 if (! $user->rights->projet->lire) accessforbidden();
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('projecttaskcard'));
+$hookmanager->initHooks(array('projecttaskcard','globalcard'));
 
 $object = new Task($db);
 $extrafields = new ExtraFields($db);
diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php
index ed48f7e1b04..b2ee3ae1814 100755
--- a/htdocs/resource/card.php
+++ b/htdocs/resource/card.php
@@ -57,7 +57,7 @@ if( ! $user->rights->resource->read)
 
 $object = new Resource($db);
 
-$hookmanager->initHooks(array('resource_card'));
+$hookmanager->initHooks(array('resource_card','globalcard'));
 $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');
diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php
index 5436e03274b..498257ea496 100644
--- a/htdocs/societe/commerciaux.php
+++ b/htdocs/societe/commerciaux.php
@@ -37,7 +37,7 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
 if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'societe','','');
 
-$hookmanager->initHooks(array('salesrepresentativescard'));
+$hookmanager->initHooks(array('salesrepresentativescard','globalcard'));
 
 /*
  *	Actions
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index e45ce6eee7b..c6909aa7cae 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -77,7 +77,7 @@ if (! empty($canvas))
 $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('thirdpartycard'));
+$hookmanager->initHooks(array('thirdpartycard','globalcard'));
 
 
 /*
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 996d7e7440d..01b6ec32f52 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -89,7 +89,7 @@ $extrafields = new ExtraFields($db);
 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('usercard'));
+$hookmanager->initHooks(array('usercard','globalcard'));
 
 
 
-- 
GitLab