Browse Source

Debug v18

Laurent Destailleur 2 years ago
parent
commit
ebfe632efe

+ 2 - 1
htdocs/adherents/note.php

@@ -85,7 +85,8 @@ $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid
 /*
  * Actions
  */
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/asset/depreciation.php

@@ -75,7 +75,8 @@ if ($result < 0) {
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/asset/depreciation_options.php

@@ -73,7 +73,8 @@ if ($result < 0) {
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/asset/disposal.php

@@ -66,7 +66,8 @@ if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbi
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/asset/model/note.php

@@ -68,7 +68,8 @@ if (!$permissiontoread) accessforbidden();
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/asset/note.php

@@ -65,7 +65,8 @@ if (!isModEnabled('asset')) accessforbidden();
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/bom/bom_note.php

@@ -74,7 +74,8 @@ restrictedArea($user, 'bom', $object->id, $object->table_element, '', '', 'rowid
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/comm/propal/note.php

@@ -68,7 +68,8 @@ $usercancreate = $user->hasRight("propal", "creer");
 
 $permissionnote = $user->rights->propal->creer; // Used by the include of actions_setnotes.inc.php
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/commande/note.php

@@ -68,7 +68,8 @@ if (!$object->fetch($id, $ref) > 0) {
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 3 - 1
htdocs/contact/note.php

@@ -61,7 +61,9 @@ $hookmanager->initHooks(array('contactnote'));
 /*
  * Actions
  */
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+
+$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');
 }

+ 3 - 2
htdocs/core/boxes/box_dolibarr_state_board.php

@@ -78,9 +78,10 @@ class box_dolibarr_state_board extends ModeleBoxes
 		if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
 			$hookmanager = new HookManager($this->db);
 			$hookmanager->initHooks(array('index'));
-			$object = new stdClass;
+			$object = new stdClass();
 			$action = '';
-			$hookmanager->executeHooks('addStatisticLine', array(), $object, $action);
+			$parameters =array();
+			$hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action);
 			$boxstatItems = array();
 			$boxstatFromHook = '';
 			$boxstatFromHook = $hookmanager->resPrint;

+ 4 - 0
htdocs/core/class/hookmanager.class.php

@@ -158,6 +158,10 @@ class HookManager
 		if (!is_array($this->hooks) || empty($this->hooks)) {
 			return 0; // No hook available, do nothing.
 		}
+		if (!is_array($parameters)) {
+			dol_syslog('executeHooks was called with a non array $parameters. Surely a bug.', LOG_WARNING);
+			$parameters = array();
+		}
 
 		$parameters['context'] = join(':', $this->contextarray);
 		//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);

+ 4 - 1
htdocs/index.php

@@ -130,7 +130,10 @@ if (empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) {
 		//if (!empty($message)) $message.='<br>';
 		$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
 	}
-	$reshook = $hookmanager->executeHooks('infoadmin', $action); // Note that $action and $object may have been modified by some hooks
+
+	$object = new stdClass();
+	$parameters = array();
+	$reshook = $hookmanager->executeHooks('infoadmin', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
 	if ($reshook == 0) {
 		$message .= $hookmanager->resPrint;
 	}

+ 4 - 2
htdocs/main.inc.php

@@ -1079,7 +1079,8 @@ if (!defined('NOLOGIN')) {
 			}
 
 			$action = '';
-			$reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action);
+			$parameters = array();
+			$reshook = $hookmanager->executeHooks('updateSession', $parameters, $user, $action);
 			if ($reshook < 0) {
 				setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
 			}
@@ -3708,7 +3709,8 @@ if (!function_exists("llxFooter")) {
 			}
 		}
 
-		$reshook = $hookmanager->executeHooks('beforeBodyClose'); // Note that $action and $object may have been modified by some hooks
+		$parameters = array();
+		$reshook = $hookmanager->executeHooks('beforeBodyClose', $parameters); // Note that $action and $object may have been modified by some hooks
 		if ($reshook > 0) {
 			print $hookmanager->resPrint;
 		}

+ 2 - 1
htdocs/partnership/partnership_note.php

@@ -76,7 +76,8 @@ if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') ac
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 4
htdocs/product/card.php

@@ -358,12 +358,10 @@ if (empty($reshook)) {
 
 				// External modules should update their ones too
 				if (!$error) {
+					$parameters = array('soc_origin' => $productOrigin->id, 'soc_dest' => $object->id);
 					$reshook = $hookmanager->executeHooks(
 						'replaceProduct',
-						array(
-							'soc_origin' => $productOrigin->id,
-							'soc_dest' => $object->id,
-						),
+						$parameters,
 						$object,
 						$action
 					);

+ 3 - 1
htdocs/product/note.php

@@ -70,7 +70,9 @@ $hookmanager->initHooks(array('productnote'));
 /*
  * Actions
  */
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+
+$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');
 }

+ 2 - 2
htdocs/product/stock/productlot_note.php

@@ -64,8 +64,8 @@ $permissionnote = $user->rights->produit->lire; // Used by the include of action
 /*
  * Actions
  */
-
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/projet/note.php

@@ -57,7 +57,8 @@ $permissionnote = $user->hasRight('projet', 'creer'); // 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
+$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');
 }

+ 2 - 1
htdocs/projet/tasks/note.php

@@ -98,7 +98,8 @@ $permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->c
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/reception/note.php

@@ -103,7 +103,8 @@ if ($origin == 'reception') {
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 1
htdocs/resource/note.php

@@ -58,7 +58,8 @@ $permissionnote = $user->rights->resource->write; // Used by the include of acti
  * Actions
  */
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 4
htdocs/societe/card.php

@@ -320,10 +320,8 @@ if (empty($reshook)) {
 
 				// External modules should update their ones too
 				if (!$error) {
-					$reshook = $hookmanager->executeHooks('replaceThirdparty', array(
-						'soc_origin' => $soc_origin->id,
-						'soc_dest' => $object->id
-					), $object, $action);
+					$parameters = array('soc_origin' => $soc_origin->id, 'soc_dest' => $object->id);
+					$reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $object, $action);
 
 					if ($reshook < 0) {
 						setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

+ 2 - 4
htdocs/societe/class/api_thirdparties.class.php

@@ -475,10 +475,8 @@ class Thirdparties extends DolibarrApi
 
 		// External modules should update their ones too
 		if (!$error) {
-			$reshook = $hookmanager->executeHooks('replaceThirdparty', array(
-				'soc_origin' => $soc_origin->id,
-				'soc_dest' => $object->id
-			), $soc_dest, $action);
+			$parameters = array('soc_origin' => $soc_origin->id, 'soc_dest' => $object->id);
+			$reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $soc_dest, $action);
 
 			if ($reshook < 0) {
 				//setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

+ 3 - 1
htdocs/societe/note.php

@@ -65,7 +65,9 @@ $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
+
+$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');
 }

+ 2 - 1
htdocs/supplier_proposal/note.php

@@ -63,7 +63,8 @@ $usercancreate = $user->hasRight("supplier_propal", "write");
 
 $permissionnote = $user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php
 
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
 }

+ 2 - 2
htdocs/workstation/workstation_note.php

@@ -65,8 +65,8 @@ 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
+$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');
 }