Explorar el Código

MMIShipping : add Hook to update label in reception getnomurl & other

Mathieu Moulin hace 1 año
padre
commit
827abbe28f
Se han modificado 2 ficheros con 11 adiciones y 3 borrados
  1. 1 1
      htdocs/custom/mmishipping
  2. 10 2
      htdocs/reception/class/reception.class.php

+ 1 - 1
htdocs/custom/mmishipping

@@ -1 +1 @@
-Subproject commit 991e21fef564c6d2c8dc3d38b44e2df383b6fae9
+Subproject commit 4abf5b982ad0818e8b811df1a13184bbcce397b8

+ 10 - 2
htdocs/reception/class/reception.class.php

@@ -1240,6 +1240,16 @@ class Reception extends CommonObject
 		$label = img_picto('', $this->picto).' <u>'.$langs->trans("Reception").'</u>';
 		$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
 		$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.($this->ref_supplier ? $this->ref_supplier : '');
+		// MMI Hook
+		global $action;
+		$hookmanager->initHooks(array($this->element . 'dao'));
+		$parameters = array('id'=>$this->id, 'label' => &$label);
+		$reshook = $hookmanager->executeHooks('getLabel', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+		if ($reshook > 0) {
+			$label = $hookmanager->resPrint;
+		} else {
+			$label .= $hookmanager->resPrint;
+		}
 
 		$url = DOL_URL_ROOT.'/reception/card.php?id='.$this->id;
 
@@ -1269,8 +1279,6 @@ class Reception extends CommonObject
 		}
 		$result .= $linkstart.$this->ref.$linkend;
 
-		global $action;
-		$hookmanager->initHooks(array($this->element . 'dao'));
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
 		if ($reshook > 0) {