--- /tmp/dsg/dolibarr/htdocs/ecm/class/github_19.0.3_ecmdirectory.class.php
+++ /tmp/dsg/dolibarr/htdocs/ecm/class/client_ecmdirectory.class.php
@@ -28 +28 @@
-class EcmDirectory extends CommonObject

+class EcmDirectory // extends CommonObject

@@ -38 +38 @@
-	public $table_element = 'ecm_directories';

+	//public $table_element='ecm_directories';

@@ -43 +43 @@
-	public $picto = 'folder-open';

+	public $picto = 'dir';

@@ -51,7 +51,7 @@
-	 * @var string ECM directories label

-	 */

-	public $label;

-

-	/**

-	 * @var int ID

-	 */

+     * @var string ECM directories label

+     */

+    public $label;

+

+    /**

+     * @var int ID

+     */

@@ -65,3 +64,0 @@
-	/**

-	 * @var int cache nb of doc

-	 */

@@ -69,4 +65,0 @@
-

-	/**

-	 * @var int date_c

-	 */

@@ -74,4 +66,0 @@
-

-	/**

-	 * @var int date_m

-	 */

@@ -81,2 +70,2 @@
-	 * @var int ID

-	 */

+     * @var int ID

+     */

@@ -86,2 +75,2 @@
-	 * @var int ID

-	 */

+     * @var int ID

+     */

@@ -95,3 +83,0 @@
-	/**

-	 * @var array array of categories

-	 */

@@ -99,4 +84,0 @@
-

-	/**

-	 * @var array array of children categories

-	 */

@@ -105,3 +86,0 @@
-	/**

-	 * @var array array of forbidden chars

-	 */

@@ -109,4 +87,0 @@
-

-	/**

-	 * @var array array of forbidden chars for dir

-	 */

@@ -115,3 +89,0 @@
-	/**

-	 * @var int 1 if full arbo loaded

-	 */

@@ -120,0 +93,11 @@
+	 * @var string Error code (or message)

+	 */

+	public $error;

+

+	/**

+	 * @var string[] Error codes (or messages)

+	 */

+	public $errors = array();

+

+

+	/**

@@ -127,0 +111 @@
+		return 1;

@@ -135 +119 @@
-	 *  @return     int      			Return integer <0 if KO, >0 if OK

+	 *  @return     int      			<0 if KO, >0 if OK

@@ -145,0 +130 @@
+		$this->fk_parent = trim($this->fk_parent);

@@ -149,3 +134 @@
-		if ($this->fk_parent <= 0) {

-			$this->fk_parent = 0;

-		}

+		if ($this->fk_parent <= 0) $this->fk_parent = 0;

@@ -156 +139,2 @@
-		if ($this->fk_parent > 0) {

+		if ($this->fk_parent)

+		{

@@ -167 +151,2 @@
-		foreach ($cate_arbo as $key => $categ) {

+		foreach ($cate_arbo as $key => $categ)

+		{

@@ -170 +155,2 @@
-			if ($path == $relativepath) {

+			if ($path == $relativepath)

+			{

@@ -176 +162,2 @@
-		if ($pathfound) {

+		if ($pathfound)

+		{

@@ -180 +167,3 @@
-		} else {

+		}

+		else

+		{

@@ -195 +184 @@
-			$sql .= " ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").",";

+			$sql .= " '".$this->db->escape($this->fk_parent)."',";

@@ -197 +186 @@
-			$sql .= " ".((int) $this->cachenbofdoc).",";

+			$sql .= " ".$this->cachenbofdoc.",";

@@ -199 +188 @@
-			$sql .= " ".($this->fk_user_c > 0 ? ((int) $this->fk_user_c) : "null");

+			$sql .= " '".$this->db->escape($this->fk_user_c)."'";

@@ -204 +193,2 @@
-			if ($resql) {

+			if ($resql)

+			{

@@ -209,13 +199,9 @@
-				if ($result < 0) {

-					$error++;

-					$this->error = "ErrorFailedToCreateDir";

-				}

-

-				// Call trigger

-				$result = $this->call_trigger('MYECMDIR_CREATE', $user);

-				if ($result < 0) {

-					$error++;

-				}

-				// End call triggers

-

-				if (!$error) {

+				if ($result < 0) { $error++; $this->error = "ErrorFailedToCreateDir"; }

+

+                // Call trigger

+                $result = $this->call_trigger('MYECMDIR_CREATE', $user);

+                if ($result < 0) { $error++; }

+                // End call triggers

+

+				if (!$error)

+				{

@@ -224 +210,3 @@
-				} else {

+				}

+				else

+				{

@@ -228 +216,3 @@
-			} else {

+			}

+			else

+			{

@@ -241 +231 @@
-	 *  @return int 			       	Return integer <0 if KO, >0 if OK

+	 *  @return int 			       	<0 if KO, >0 if OK

@@ -250,0 +241 @@
+		$this->fk_parent = trim($this->fk_parent);

@@ -252,3 +243,3 @@
-		if ($this->fk_parent <= 0) {

-			$this->fk_parent = 0;

-		}

+

+		// Check parameters

+		// Put here code to add control on parameters values

@@ -260,4 +251,4 @@
-		$sql .= " label = '".$this->db->escape($this->label)."',";

-		$sql .= " fk_parent = ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").",";

-		$sql .= " description = '".$this->db->escape($this->description)."'";

-		$sql .= " WHERE rowid = ".((int) $this->id);

+		$sql .= " label='".$this->db->escape($this->label)."',";

+		$sql .= " fk_parent='".$this->db->escape($this->fk_parent)."',";

+		$sql .= " description='".$this->db->escape($this->description)."'";

+		$sql .= " WHERE rowid=".$this->id;

@@ -267 +258,2 @@
-		if (!$resql) {

+		if (!$resql)

+		{

@@ -272,10 +264,10 @@
-		if (!$error && !$notrigger) {

-			// Call trigger

-			$result = $this->call_trigger('MYECMDIR_MODIFY', $user);

-			if ($result < 0) {

-				$error++;

-			}

-			// End call triggers

-		}

-

-		if (!$error) {

+		if (!$error && !$notrigger)

+		{

+            // Call trigger

+            $result = $this->call_trigger('MYECMDIR_MODIFY', $user);

+            if ($result < 0) { $error++; }

+            // End call triggers

+		}

+

+		if (!$error)

+		{

@@ -284 +276,3 @@
-		} else {

+		}

+		else

+		{

@@ -295 +289 @@
-	 *  @return int		         	Return integer <0 if KO, >0 if OK

+	 *  @return int		         	<0 if KO, >0 if OK

@@ -301,6 +295,3 @@
-		if (preg_match('/[0-9]+/', $value)) {

-			$sql .= " cachenbofdoc = ".(int) $value;

-		} else {

-			$sql .= " cachenbofdoc = cachenbofdoc ".$value." 1";

-		}

-		$sql .= " WHERE rowid = ".((int) $this->id);

+		if (preg_match('/[0-9]+/', $value)) $sql .= " cachenbofdoc = ".(int) $value;

+		else $sql .= " cachenbofdoc = cachenbofdoc ".$value." 1";

+		$sql .= " WHERE rowid = ".$this->id;

@@ -310 +301,2 @@
-		if (!$resql) {

+		if (!$resql)

+		{

@@ -313,8 +305,6 @@
-		} else {

-			if (preg_match('/[0-9]+/', $value)) {

-				$this->cachenbofdoc = (int) $value;

-			} elseif ($value == '+') {

-				$this->cachenbofdoc++;

-			} elseif ($value == '-') {

-				$this->cachenbofdoc--;

-			}

+		}

+		else

+		{

+		    if (preg_match('/[0-9]+/', $value)) $this->cachenbofdoc = (int) $value;

+		    elseif ($value == '+') $this->cachenbofdoc++;

+		    elseif ($value == '-') $this->cachenbofdoc--;

@@ -331 +321 @@
-	 *  @return int 		        Return integer <0 if KO, 0 if not found, >0 if OK

+	 *  @return int 		        <0 if KO, 0 if not found, >0 if OK

@@ -344 +334 @@
-		$sql .= " t.tms as date_m";

+		$sql .= " t.date_m as date_m";

@@ -346 +336 @@
-		$sql .= " WHERE t.rowid = ".((int) $id);

+		$sql .= " WHERE t.rowid = ".$id;

@@ -350 +340,2 @@
-		if ($resql) {

+		if ($resql)

+		{

@@ -352 +343,2 @@
-			if ($obj) {

+			if ($obj)

+			{

@@ -366,4 +357,0 @@
-			// Retrieve all extrafields for ecm_files

-			// fetch optionals attributes and labels

-			$this->fetch_optionals();

-

@@ -373 +361,3 @@
-		} else {

+		}

+		else

+		{

@@ -386 +376 @@
-	 *	@return	int								Return integer <0 if KO, >0 if OK

+	 *	@return	int								<0 if KO, >0 if OK

@@ -391 +381 @@
-		require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

+        require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

@@ -395,3 +385 @@
-		if ($mode != 'databaseonly') {

-			$relativepath = $this->getRelativePath(1); // Ex: dir1/dir2/dir3

-		}

+		if ($mode != 'databaseonly') $relativepath = $this->getRelativePath(1); // Ex: dir1/dir2/dir3

@@ -404 +392 @@
-		$sql .= " WHERE rowid=".((int) $this->id);

+		$sql .= " WHERE rowid=".$this->id;

@@ -408 +396,2 @@
-		if (!$resql) {

+		if (!$resql)

+		{

@@ -412,11 +401,15 @@
-		} else {

-			// Call trigger

-			$result = $this->call_trigger('MYECMDIR_DELETE', $user);

-			if ($result < 0) {

-				$this->db->rollback();

-				return -2;

-			}

-			// End call triggers

-		}

-

-		if ($mode != 'databaseonly') {

+		}

+		else

+		{

+            // Call trigger

+            $result = $this->call_trigger('MYECMDIR_DELETE', $user);

+            if ($result < 0)

+            {

+            	$this->db->rollback();

+            	return -2;

+            }

+            // End call triggers

+		}

+

+		if ($mode != 'databaseonly')

+		{

@@ -424 +417,2 @@
-			if ($deletedirrecursive) {

+			if ($deletedirrecursive)

+			{

@@ -426 +420,3 @@
-			} else {

+			}

+			else

+			{

@@ -431 +427,2 @@
-		if ($result || !@is_dir(dol_osencode($file))) {

+		if ($result || !@is_dir(dol_osencode($file)))

+		{

@@ -433 +430,3 @@
-		} else {

+		}

+		else

+		{

@@ -440,14 +439,11 @@
-		if (!$error) {

-			return 1;

-		} else {

-			return -1;

-		}

-	}

-

-

-	/**

-	 *  Initialise an instance with random values.

-	 *  Used to build previews or test instances.

-	 *	id must be 0 if object instance is a specimen.

-	 *

-	 *  @return	void

+		if (!$error) return 1;

+		else return -1;

+	}

+

+

+	/**

+     *  Initialise an instance with random values.

+     *  Used to build previews or test instances.

+     *	id must be 0 if object instance is a specimen.

+     *

+     *  @return	void

@@ -472 +468 @@
-	 *  @param	int		$notooltip		1=Disable tooltip

+     *  @param	int		$notooltip		1=Disable tooltip

@@ -477 +473 @@
-		global $langs, $hookmanager;

+		global $langs;

@@ -480,16 +476,10 @@
-		//$newref=str_replace('_',' ',$this->ref);

-		$newref = $this->ref;

-		$label = $langs->trans("ShowECMSection").': '.$newref;

-		$linkclose = '"'.($more ? ' '.$more : '').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';

-

-		$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/dir_card.php?section='.$this->id.$linkclose;

-		if ($option == 'index') {

-			$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;

-		}

-		if ($option == 'indexexpanded') {

-			$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false'.$linkclose;

-		}

-		if ($option == 'indexnotexpanded') {

-			$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;

-		}

-		$linkend = '</a>';

+        //$newref=str_replace('_',' ',$this->ref);

+        $newref = $this->ref;

+        $label = $langs->trans("ShowECMSection").': '.$newref;

+        $linkclose = '"'.($more ? ' '.$more : '').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';

+

+        $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/dir_card.php?section='.$this->id.$linkclose;

+        if ($option == 'index') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;

+        if ($option == 'indexexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false'.$linkclose;

+        if ($option == 'indexnotexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;

+        $linkend = '</a>';

@@ -501,6 +491,2 @@
-		if ($withpicto) {

-			$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);

-		}

-		if ($withpicto != 2) {

-			$result .= ($max ? dol_trunc($newref, $max, 'middle') : $newref);

-		}

+		if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);

+		if ($withpicto != 2) $result .= ($max ?dol_trunc($newref, $max, 'middle') : $newref);

@@ -509,9 +494,0 @@
-		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) {

-			$result = $hookmanager->resPrint;

-		} else {

-			$result .= $hookmanager->resPrint;

-		}

@@ -537,2 +514,4 @@
-			foreach ($this->cats as $key => $val) {

-				if ($this->cats[$key]['id'] == $idtosearch) {

+			foreach ($this->cats as $key => $val)

+			{

+				if ($this->cats[$key]['id'] == $idtosearch)

+				{

@@ -545 +524,2 @@
-			if ($cursorindex >= 0) {

+			if ($cursorindex >= 0)

+			{

@@ -552 +532,2 @@
-		} while ($cursorindex >= 0 && !empty($idtosearch) && $i < 100); // i avoid infinite loop

+		}

+		while ($cursorindex >= 0 && !empty($idtosearch) && $i < 100); // i avoid infinite loop

@@ -557 +538 @@
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

@@ -561 +542 @@
-	 *	@return		int		Return integer <0 if KO, >0 if OK

+	 *	@return		int		<0 if KO, >0 if OK

@@ -565 +546 @@
-		// phpcs:enable

+        // phpcs:enable

@@ -578 +559,2 @@
-		if ($resql) {

+		if ($resql)

+		{

@@ -580 +562,2 @@
-			while ($obj = $this->db->fetch_object($resql)) {

+			while ($obj = $this->db->fetch_object($resql))

+			{

@@ -584 +567,3 @@
-		} else {

+		}

+		else

+		{

@@ -592,3 +577,3 @@
-	 *  Return the label of the status

-	 *

-	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto

+	 *  Retourne le libelle du status d'un user (actif, inactif)

+	 *

+	 *  @param	int		$mode          0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto

@@ -602 +587 @@
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

@@ -612 +597 @@
-		// phpcs:enable

+        // phpcs:enable

@@ -618 +603 @@
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

@@ -630,4 +615,4 @@
-	 * 				fullpath	        Full path of id (Added by buildPathFromId call)

-	 *              fullrelativename    Full path name (Added by buildPathFromId call)

-	 * 				fulllabel	        Full label (Added by buildPathFromId call)

-	 * 				level		        Level of line (Added by buildPathFromId call)

+	 * 				fullpath	        Full path of id (Added by build_path_from_id_categ call)

+     *              fullrelativename    Full path name (Added by build_path_from_id_categ call)

+	 * 				fulllabel	        Full label (Added by build_path_from_id_categ call)

+	 * 				level		        Level of line (Added by build_path_from_id_categ call)

@@ -636 +621 @@
-	 *	@return	array|int			        Tableau de array if OK, -1 if KO

+	 *	@return	array			        Tableau de array

@@ -640 +625 @@
-		// phpcs:enable

+        // phpcs:enable

@@ -643 +628,2 @@
-		if (empty($force) && !empty($this->full_arbo_loaded)) {

+		if (empty($force) && !empty($this->full_arbo_loaded))

+		{

@@ -656 +641,0 @@
-		$sql .= " u.statut as statut_c,";

@@ -667 +652,2 @@
-		if ($resql) {

+		if ($resql)

+		{

@@ -671 +657,2 @@
-			while ($obj = $this->db->fetch_object($resql)) {

+			while ($obj = $this->db->fetch_object($resql))

+			{

@@ -678,2 +665 @@
-				$this->cats[$obj->rowid]['fk_user_c'] = (int) $obj->fk_user_c;

-				$this->cats[$obj->rowid]['statut_c'] = (int) $obj->statut_c;

+				$this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;

@@ -682,2 +668,4 @@
-				if (!empty($obj->rowid_fille)) {

-					if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children'])) {

+				if (!empty($obj->rowid_fille))

+				{

+					if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children']))

+					{

@@ -687 +675,3 @@
-					} else {

+					}

+					else

+					{

@@ -694 +684,3 @@
-		} else {

+		}

+		else

+		{

@@ -700,5 +692,4 @@
-		foreach ($this->cats as $key => $val) {

-			if (isset($this->motherof[$key])) {

-				continue;

-			}

-			$this->buildPathFromId($key, 0);

+		foreach ($this->cats as $key => $val)

+		{

+			if (isset($motherof[$key])) continue;

+			$this->build_path_from_id_categ($key, 0);

@@ -712,0 +704 @@
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

@@ -721,2 +713,3 @@
-	private function buildPathFromId($id_categ, $protection = 0)

-	{

+	public function build_path_from_id_categ($id_categ, $protection = 0)

+	{

+        // phpcs:enable

@@ -724 +717,2 @@
-		if (!empty($this->cats[$id_categ]['id_mere'])) {

+		if (!empty($this->cats[$id_categ]['id_mere']))

+		{

@@ -727,2 +721,2 @@
-			$this->cats[$id_categ]['fullrelativename'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullrelativename'];

-			$this->cats[$id_categ]['fullrelativename'] .= '/'.$this->cats[$id_categ]['label'];

+            $this->cats[$id_categ]['fullrelativename'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullrelativename'];

+            $this->cats[$id_categ]['fullrelativename'] .= '/'.$this->cats[$id_categ]['label'];

@@ -731 +725,3 @@
-		} else {

+		}

+		else

+		{

@@ -733 +729 @@
-			$this->cats[$id_categ]['fullrelativename'] = $this->cats[$id_categ]['label'];

+            $this->cats[$id_categ]['fullrelativename'] = $this->cats[$id_categ]['label'];

@@ -739 +735 @@
-		// Process children

+		// Traite ces enfants

@@ -741,6 +737,6 @@
-		if ($protection > 20) {

-			return; // We never go more than 20 levels

-		}

-		if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) {

-			foreach ($this->cats[$id_categ]['id_children'] as $key => $val) {

-				$this->buildPathFromId($val, $protection);

+		if ($protection > 20) return; // On ne traite pas plus de 20 niveaux

+		if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children']))

+		{

+			foreach ($this->cats[$id_categ]['id_children'] as $key => $val)

+			{

+				$this->build_path_from_id_categ($val, $protection);

@@ -771,3 +767,6 @@
-		if (empty($all)) {  // By default

-			$sql .= " WHERE rowid = ".((int) $this->id);

-		} else {

+		if (empty($all))  // By default

+		{

+			$sql .= " WHERE rowid = ".$this->id;

+		}

+		else

+		{

@@ -779 +778,2 @@
-		if ($resql) {

+		if ($resql)

+		{

@@ -782 +782,3 @@
-		} else {

+		}

+		else

+		{

@@ -788,30 +790,33 @@
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

-	/**

-	 * Call trigger based on this instance.

-	 * We implement it here because this class doe not extend CommonObject.

-	 *

-	 * NB1: Error from trigger are stacked in errors

-	 * NB2: if trigger fail, action should be canceled.

-	 * NB3: Should be deleted if EcmDirectory extend CommonObject

-	 *

-	 * @param   string    $triggerName   trigger's name to execute

-	 * @param   User      $user           Object user

-	 * @return  int                       Result of run_triggers

-	 */

-	public function call_trigger($triggerName, $user)

-	{

-		// phpcs:enable

-		global $langs, $conf;

-

-		include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';

-		$interface = new Interfaces($this->db);

-		$result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf);

-		if ($result < 0) {

-			if (!empty($this->errors)) {

-				$this->errors = array_merge($this->errors, $interface->errors);

-			} else {

-				$this->errors = $interface->errors;

-			}

-		}

-		return $result;

-	}

+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

+	/**

+     * Call trigger based on this instance.

+     * We implement it here because this class doe not extend CommonObject.

+     *

+     * NB1: Error from trigger are stacked in errors

+     * NB2: if trigger fail, action should be canceled.

+     * NB3: Should be deleted if EcmDirectory extend CommonObject

+     *

+     * @param   string    $triggerName   trigger's name to execute

+     * @param   User      $user           Object user

+     * @return  int                       Result of run_triggers

+     */

+    public function call_trigger($triggerName, $user)

+    {

+        // phpcs:enable

+        global $langs, $conf;

+

+        include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';

+        $interface = new Interfaces($this->db);

+        $result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf);

+        if ($result < 0) {

+            if (!empty($this->errors))

+            {

+                $this->errors = array_merge($this->errors, $interface->errors);

+            }

+            else

+            {

+                $this->errors = $interface->errors;

+            }

+        }

+        return $result;

+    }

--- /tmp/dsg/dolibarr/htdocs/ecm/class/github_19.0.3_ecmfiles.class.php
+++ /tmp/dsg/dolibarr/htdocs/ecm/class/client_ecmfiles.class.php
@@ -50 +50 @@
-	public $picto = 'folder-open';

+	public $picto = 'generic';

@@ -59,8 +59,5 @@
-	 * @var string Ecm Files label

-	 */

-	public $label;

-

-	/**

-	 * @var string hash for file sharing, empty by default (example: getRandomPassword(true))

-	 */

-	public $share;

+     * @var string Ecm Files label

+     */

+    public $label;

+

+	public $share; // hash for file sharing, empty by default (example: getRandomPassword(true))

@@ -73,8 +70 @@
-	/**

-	 * @var string filename, Note: Into ecm database record, the entry $filename never ends with .noexe

-	 */

-	public $filename;

-

-	/**

-	 * @var string filepath

-	 */

+	public $filename;			// Note: Into ecm database record, the entry $filename never ends with .noexe

@@ -82,4 +71,0 @@
-

-	/**

-	 * @var string fullpath origin

-	 */

@@ -93,3 +78,0 @@
-	/**

-	 * @var string keywords

-	 */

@@ -97,4 +79,0 @@
-

-	/**

-	 * @var string cover

-	 */

@@ -102,4 +80,0 @@
-

-	/**

-	 * @var int position

-	 */

@@ -107,9 +82 @@
-

-	/**

-	 * @var string can be 'generated', 'uploaded', 'unknown'

-	 */

-	public $gen_or_uploaded;

-

-	/**

-	 * @var string extraparams

-	 */

+	public $gen_or_uploaded; // can be 'generated', 'uploaded', 'unknown'

@@ -117,4 +83,0 @@
-

-	/**

-	 * @var int|string date create

-	 */

@@ -122,4 +84,0 @@
-

-	/**

-	 * @var int|string date modify

-	 */

@@ -129,2 +88,2 @@
-	 * @var int ID

-	 */

+     * @var int ID

+     */

@@ -134,2 +93,2 @@
-	 * @var int ID

-	 */

+     * @var int ID

+     */

@@ -138,3 +96,0 @@
-	/**

-	 * @var string acl

-	 */

@@ -142,4 +97,0 @@
-

-	/**

-	 * @var string src object type

-	 */

@@ -147,4 +98,0 @@
-

-	/**

-	 * @var int src object id

-	 */

@@ -152,31 +99,0 @@
-

-	/**

-	 * @var int section_id		ID of section = ID of EcmDirectory, directory of manual ECM (not stored into database)

-	 */

-	public $section_id;

-

-	public $fields = array(

-		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),

-		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>-1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"contains hash from filename+filepath"),

-		'label' => array('type'=>'varchar(128)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>-1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1', 'comment'=>"contains hash of file content"),

-		'share' => array('type'=>'varchar(128)', 'label'=>'Share', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>-1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1', 'comment' => "contains hash for file sharing"),

-		'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 50, 'index' => 1),

-		'filepath' => array('type'=>'varchar(255)', 'label'=>'FilePath', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>0, 'searchall'=>0, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1','comment'=> "relative to dolibarr document dir. Example module/def"),

-		'filename' => array('type'=>'varchar(255)', 'label'=>'FileName', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1','comment'=>"file name only without any directory"),

-		'src_object_type' => array('type'=>'varchar(64)', 'label'=>'SourceType', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>0, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1','comment'=> "Source object type ('proposal', 'invoice', ...)"),

-		'src_object_id' => array('type' => 'integer', 'label' => 'SourceID', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 90, 'index' => 1, 'comment' => "Source object id"),

-		'fullpath_orig' => array('type'=>'varchar(750)', 'label'=>'FullPathOrig', 'enabled'=>'1', 'position'=>100, 'notnull'=>0, 'visible'=>0, 'searchall'=>0, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1','comment'=>"full path of original filename, when file is uploaded from a local computer"),

-		'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 0, 'position' => 110),

-		'keywords' => array('type'=>'varchar(750)', 'label'=>'Keywords', 'enabled'=>'1', 'position'=>120, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1','comment'=>"list of keywords, separated with comma. Must be limited to most important keywords."),

-		'cover' => array('type' => 'text', 'label' => 'Cover', 'enabled' => 1, 'visible' => 0, 'position' => 130, 'comment'=>"is this file a file to use for a cover"),

-		'position' => array('type' => 'integer', 'label' => 'Position', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 140, 'index' => 1, 'comment' => "position of file among others"),

-		'gen_or_uploaded' => array('type'=>'varchar(12)', 'label'=>'GenOrUpload', 'enabled'=>'1', 'position'=>150, 'notnull'=>0, 'visible'=>-1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1','comment'=>"'generated' or 'uploaded'"),

-		'extraparams' => array('type'=>'varchar(255)', 'label'=>'ExtraParams', 'enabled'=>'1', 'position'=>160, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1', 'comment' => "for stocking other parameters with json format"),

-		'date_c' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170),

-		'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175),

-		'fk_user_c' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),

-		'fk_user_m' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),

-		'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),

-		'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),

-		'acl' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160, 'comment' => "for future permission 'per file'"),

-	);

@@ -200 +117 @@
-	 * @return int 				Return integer <0 if KO, Id of created object if OK

+	 * @return int 				<0 if KO, Id of created object if OK

@@ -212 +129 @@
-			$this->ref = trim($this->ref);

+			 $this->ref = trim($this->ref);

@@ -215 +132 @@
-			$this->label = trim($this->label);

+			 $this->label = trim($this->label);

@@ -218 +135 @@
-			$this->share = trim($this->share);

+			 $this->share = trim($this->share);

@@ -221 +138 @@
-			$this->entity = (int) $this->entity;

+			 $this->entity = trim($this->entity);

@@ -224 +141 @@
-			$this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));

+			 $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));

@@ -227,2 +144,2 @@
-			$this->filepath = trim($this->filepath);

-			$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /

+			 $this->filepath = trim($this->filepath);

+			 $this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /

@@ -231 +148 @@
-			$this->fullpath_orig = trim($this->fullpath_orig);

+			 $this->fullpath_orig = trim($this->fullpath_orig);

@@ -234 +151 @@
-			$this->description = trim($this->description);

+			 $this->description = trim($this->description);

@@ -237 +154 @@
-			$this->keywords = trim($this->keywords);

+			 $this->keywords = trim($this->keywords);

@@ -240 +157 @@
-			$this->cover = trim($this->cover);

+			 $this->cover = trim($this->cover);

@@ -243 +160 @@
-			$this->gen_or_uploaded = trim($this->gen_or_uploaded);

+			 $this->gen_or_uploaded = trim($this->gen_or_uploaded);

@@ -246 +163 @@
-			$this->extraparams = trim($this->extraparams);

+			 $this->extraparams = trim($this->extraparams);

@@ -249 +166 @@
-			$this->fk_user_c = (int) $this->fk_user_c;

+			 $this->fk_user_c = trim($this->fk_user_c);

@@ -252 +169 @@
-			$this->fk_user_m = (int) $this->fk_user_m;

+			 $this->fk_user_m = trim($this->fk_user_m);

@@ -255 +172 @@
-			$this->acl = trim($this->acl);

+			 $this->acl = trim($this->acl);

@@ -260,6 +177,2 @@
-		if (empty($this->date_c)) {

-			$this->date_c = dol_now();

-		}

-		if (empty($this->date_m)) {

-			$this->date_m = dol_now();

-		}

+		if (empty($this->date_c)) $this->date_c = dol_now();

+		if (empty($this->date_m)) $this->date_m = dol_now();

@@ -268 +181,6 @@
-		if (empty($this->ref)) {

+		$ref = '';

+		if (!empty($this->ref))

+		{

+			$ref = $this->ref;

+		}

+		else {

@@ -270 +188 @@
-			$this->ref = dol_hash($this->filepath.'/'.$this->filename, 3);

+			$ref = dol_hash($this->filepath.'/'.$this->filename, 3);

@@ -274,2 +192,2 @@
-		if (empty($this->position)) {

-			// Get max used

+		if (empty($this->position))   // Get max used

+		{

@@ -280 +198,2 @@
-			if ($resql) {

+			if ($resql)

+			{

@@ -283 +202,3 @@
-			} else {

+			}

+			else

+			{

@@ -288 +209,3 @@
-		} else {

+		}

+		else

+		{

@@ -293 +216,2 @@
-		if (empty($this->filename) || empty($this->filepath)) {

+		if (empty($this->filename) || empty($this->filepath))

+		{

@@ -297 +221,2 @@
-		if (!isset($this->entity)) {

+		if (!isset($this->entity))

+		{

@@ -318 +243 @@
-		$sql .= 'tms,';

+		$sql .= 'date_m,';

@@ -325 +250 @@
-		$sql .= " '".$this->db->escape($this->ref)."', ";

+		$sql .= " '".$ref."', ";

@@ -328 +253 @@
-		$sql .= ' '.((int) $this->entity).',';

+		$sql .= ' '.$this->entity.',';

@@ -335 +260 @@
-		$sql .= ' '.((int) $maxposition).',';

+		$sql .= ' '.$maxposition.',';

@@ -338 +263 @@
-		$sql .= " '".$this->db->idate($this->date_c)."',";

+		$sql .= ' '."'".$this->db->idate($this->date_c)."'".',';

@@ -352,5 +277 @@
-			if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {

-				$this->errors[] = 'Error DB_ERROR_RECORD_ALREADY_EXISTS : '.$this->db->lasterror();

-			} else {

-				$this->errors[] = 'Error '.$this->db->lasterror();

-			}

+			$this->errors[] = 'Error '.$this->db->lasterror();

@@ -365 +286,2 @@
-			if (!$notrigger) {

+			if (!$notrigger)

+			{

@@ -368,3 +290 @@
-				if ($result < 0) {

-					$error++;

-				}

+				if ($result < 0) { $error++; }

@@ -392 +312 @@
-	 * @param  string $relativepath    	Relative path of file from document directory. Example: 'path/path2/file' or 'path/path2/*'

+	 * @param  string $relativepath    	Relative path of file from document directory. Example: path/path2/file

@@ -394,2 +314,2 @@
-	 * @param  string $hashforshare    	Hash of file sharing, or 'shared'

-	 * @param  string $src_object_type 	src_object_type to search (value of object->table_element)

+	 * @param  string $hashforshare    	Hash of file sharing.

+	 * @param  string $src_object_type 	src_object_type to search

@@ -397 +317 @@
-	 * @return int                 	   	Return integer <0 if KO, 0 if not found, >0 if OK

+	 * @return int                 	   	<0 if KO, 0 if not found, >0 if OK

@@ -421 +341 @@
-		$sql .= " t.tms as date_m,";

+		$sql .= " t.date_m,";

@@ -424,2 +343,0 @@
-		$sql .= ' t.note_private,';

-		$sql .= ' t.note_public,';

@@ -432,4 +350,3 @@
-		 if (isModEnabled('multicompany')) {

-		 $sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";

-		 }*/

-		$filterfound = 0;

+		if (! empty($conf->multicompany->enabled)) {

+		    $sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";

+		}*/

@@ -437,6 +354,2 @@
-			$relativepathwithnoexe = preg_replace('/\.noexe$/', '', $relativepath); // We must never have the .noexe into the database

-			$sql .= " AND t.filepath = '".$this->db->escape(dirname($relativepath))."'";

-			$filename = basename($relativepathwithnoexe);

-			if ($filename != '*') {

-				$sql .= " AND t.filename = '".$this->db->escape($filename)."'";

-			}

+			$relativepathwithnoexe = preg_replace('/\.noexe$/', '', $relativepath);		// We must never have the .noexe into the database

+			$sql .= " AND t.filepath = '".$this->db->escape(dirname($relativepath))."' AND t.filename = '".$this->db->escape(basename($relativepathwithnoexe))."'";

@@ -444,3 +357,2 @@
-			$filterfound++;

-		}

-		if (!empty($ref)) {		// hash of file path

+		}

+		elseif (!empty($ref)) {		// hash of file path

@@ -449,3 +361,2 @@
-			$filterfound++;

-		}

-		if (!empty($hashoffile)) {	// hash of content

+		}

+		elseif (!empty($hashoffile)) {	// hash of content

@@ -454,8 +365,3 @@
-			$filterfound++;

-		}

-		if (!empty($hashforshare)) {

-			if ($hashforshare != 'shared') {

-				$sql .= " AND t.share = '".$this->db->escape($hashforshare)."'";

-			} else {

-				$sql .= " AND t.share IS NOT NULL AND t.share <> ''";

-			}

+		}

+		elseif (!empty($hashforshare)) {

+			$sql .= " AND t.share = '".$this->db->escape($hashforshare)."'";

@@ -463,13 +369,12 @@
-			$filterfound++;

-		}

-		if ($src_object_type && $src_object_id) {

-			$sql .= " AND t.src_object_type = '".$this->db->escape($src_object_type)."' AND t.src_object_id = ".((int) $src_object_id);

-			$sql .= " AND t.entity = ".((int) $conf->entity);

-			$filterfound++;

-		}

-		if ($id > 0 || empty($filterfound)) {

-			$sql .= ' AND t.rowid = '.((int) $id); // rowid already unique

-		}

-

-		// Warning: May return several record, and only first one is returned !

-		$this->db->plimit(1); // When we search on src, or on hash of content (hashforfile), we take first one only

+		}

+		elseif ($src_object_type && $src_object_id)

+		{

+			// Warning: May return several record, and only first one is returned !

+			$sql .= " AND t.src_object_type ='".$this->db->escape($src_object_type)."' AND t.src_object_id = ".$this->db->escape($src_object_id);

+			$sql .= " AND t.entity = ".$conf->entity;

+		}

+		else {

+			$sql .= ' AND t.rowid = '.$this->db->escape($id); // rowid already unique

+		}

+

+		$this->db->plimit(1); // When we search on src or on hash of content (hashforfile) to solve hash conflict when several files has same content, we take first one only

@@ -502,2 +406,0 @@
-				$this->note_private = $obj->note_private;

-				$this->note_public = $obj->note_public;

@@ -509 +412 @@
-			// Retrieve all extrafields for ecm_files

+			// Retrieve all extrafields for invoice

@@ -511 +414 @@
-			$this->fetch_optionals();

+			// $this->fetch_optionals();

@@ -540 +443 @@
-	 * @return int Return integer <0 if KO, >0 if OK

+	 * @return int <0 if KO, >0 if OK

@@ -561 +464 @@
-		$sql .= " t.tms as date_m,";

+		$sql .= " t.date_m,";

@@ -573,5 +476 @@
-				if ($key == 't.src_object_id') {

-					$sqlwhere[] = $key." = ".((int) $value);

-				} else {

-					$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";

-				}

+				$sqlwhere [] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';

@@ -582,3 +481,3 @@
-		 if (isModEnabled('multicompany')) {

-		 $sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";

-		 }*/

+		if (! empty($conf->multicompany->enabled)) {

+		    $sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";

+		}*/

@@ -586 +485 @@
-			$sql .= ' AND '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);

+			$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);

@@ -592 +491 @@
-			$sql .= $this->db->plimit($limit, $offset);

+			$sql .= ' '.$this->db->plimit($limit, $offset);

@@ -602 +501 @@
-				$line = new EcmFilesLine();

+				$line = new EcmfilesLine();

@@ -605 +504 @@
-				$line->ref = $obj->rowid;

+				$line->ref = $obj->ref;

@@ -644 +543 @@
-	 * @return int Return integer <0 if KO, >0 if OK

+	 * @return int <0 if KO, >0 if OK

@@ -673 +572 @@
-			$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /

+			$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath);		// Remove last /

@@ -708 +607 @@
-		$sql .= " ref = '".$this->db->escape(dol_hash($this->filepath."/".$this->filename, 3))."',";

+		$sql .= " ref = '".dol_hash($this->filepath.'/'.$this->filename, 3)."',";

@@ -722 +621 @@
-		//$sql .= ' tms = '.(! isset($this->date_m) || dol_strlen($this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated

+		//$sql .= ' date_m = '.(! isset($this->date_m) || dol_strlen($this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated

@@ -727 +626 @@
-		$sql .= ' WHERE rowid='.((int) $this->id);

+		$sql .= ' WHERE rowid='.$this->id;

@@ -739 +638,2 @@
-		if (!$error && !$notrigger) {

+		if (!$error && !$notrigger)

+		{

@@ -742,3 +642 @@
-			if ($result < 0) {

-				$error++;

-			} //Do also here what you must do to rollback action if trigger fail

+			if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail

@@ -766 +664 @@
-	 * @return int Return integer <0 if KO, >0 if OK

+	 * @return int <0 if KO, >0 if OK

@@ -777 +675,2 @@
-		if (!$notrigger) {

+		if (!$notrigger)

+		{

@@ -780,3 +679 @@
-			if ($result < 0) {

-				$error++;

-			} //Do also here what you must do to rollback action if trigger fail

+			if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail

@@ -787,7 +684 @@
-		if (!$error) {

-			$result = $this->deleteExtraFields();

-			if (!$result) {

-				dol_syslog(get_class($this)."::delete error ".$this->error, LOG_ERR);

-				$error++;

-			}

-		}

+

@@ -796 +687 @@
-			$sql .= ' WHERE rowid='.((int) $this->id);

+			$sql .= ' WHERE rowid='.$this->id;

@@ -830 +721 @@
-		$object = new EcmFiles($this->db);

+		$object = new Ecmfiles($this->db);

@@ -881,5 +772,3 @@
-		global $menumanager, $hookmanager;

-

-		if (!empty($conf->dol_no_mouse_hover)) {

-			$notooltip = 1; // Force disable tooltips

-		}

+		global $menumanager;

+

+		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips

@@ -893 +782 @@
-		$url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id;

+		$url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id;

@@ -896,2 +785,4 @@
-		if (empty($notooltip)) {

-			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {

+		if (empty($notooltip))

+		{

+			if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))

+			{

@@ -903,3 +794,2 @@
-		} else {

-			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

-		}

+		}

+		else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

@@ -911 +801,2 @@
-		if ($withpicto) {

+		if ($withpicto)

+		{

@@ -913,3 +804 @@
-			if ($withpicto != 2) {

-				$result .= ' ';

-			}

+			if ($withpicto != 2) $result .= ' ';

@@ -918,10 +806,0 @@
-

-		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) {

-			$result = $hookmanager->resPrint;

-		} else {

-			$result .= $hookmanager->resPrint;

-		}

@@ -932,3 +811,3 @@
-	 *  Return the label of the status

-	 *

-	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto

+	 *  Retourne le libelle du status d'un user (actif, inactif)

+	 *

+	 *  @param	int		$mode          0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto

@@ -942 +821 @@
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

@@ -952 +831 @@
-		// phpcs:enable

+        // phpcs:enable

@@ -969 +848 @@
-		$this->specimen = 1;

+

@@ -971 +850 @@
-		$this->entity = 1;

+		$this->entity = '1';

@@ -978 +857 @@
-		$this->position = 5;

+		$this->position = '5';

@@ -995 +874 @@
-class EcmFilesLine

+class EcmfilesLine

@@ -998,3 +877,3 @@
-	 * @var string ECM files line label

-	 */

-	public $label;

+     * @var string ECM files line label

+     */

+    public $label;

@@ -1025,2 +904,2 @@
-	 * @var int ID

-	 */

+     * @var int ID

+     */

@@ -1030,2 +909,2 @@
-	 * @var int ID

-	 */

+     * @var int ID

+     */

--- /tmp/dsg/dolibarr/htdocs/ecm/class/github_19.0.3_htmlecm.form.class.php
+++ /tmp/dsg/dolibarr/htdocs/ecm/class/client_htmlecm.form.class.php
@@ -30,4 +30,4 @@
-	/**

-	 * @var DoliDB Database handler.

-	 */

-	public $db;

+    /**

+     * @var DoliDB Database handler.

+     */

+    public $db;

@@ -35,4 +35,4 @@
-	/**

-	 * @var string Error code (or message)

-	 */

-	public $error = '';

+    /**

+     * @var string Error code (or message)

+     */

+    public $error = '';

@@ -58 +57,0 @@
-	 *  @param	array	$ids_to_ignore		Array of id to ignore

@@ -61 +60 @@
-	public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ids_to_ignore = array())

+	public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm')

@@ -66,6 +65 @@
-		if ($select_name == '') {

-			$select_name = "catParent";

-		}

-		if (!is_array($ids_to_ignore)) {

-			$ids_to_ignore = array($ids_to_ignore);

-		}

+		if ($select_name == '') $select_name = "catParent";

@@ -74 +68,2 @@
-		if ($module == 'ecm') {

+		if ($module == 'ecm')

+		{

@@ -77 +72,3 @@
-		} elseif ($module == 'medias') {

+		}

+		elseif ($module == 'medias')

+		{

@@ -84,4 +81,5 @@
-		if (is_array($cate_arbo)) {

-			if (!count($cate_arbo)) {

-				$output .= '<option value="-1" disabled>'.$langs->trans("NoDirectoriesFound").'</option>';

-			} else {

+		if (is_array($cate_arbo))

+		{

+			if (!count($cate_arbo)) $output .= '<option value="-1" disabled>'.$langs->trans("NoDirectoriesFound").'</option>';

+			else

+			{

@@ -89,9 +87,6 @@
-				foreach ($cate_arbo as $key => $value) {

-					if (!in_array($cate_arbo[$key]['id'], $ids_to_ignore)) {

-						$valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id'];

-						if ($selected && $valueforoption == $selected) {

-							$add = 'selected ';

-						} else {

-							$add = '';

-						}

-						$output .= '<option '.$add.'value="'.dol_escape_htmltag($valueforoption).'">'.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).'</option>';

+				foreach ($cate_arbo as $key => $value)

+				{

+					$valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id'];

+					if ($selected && $valueforoption == $selected)

+					{

+						$add = 'selected ';

@@ -98,0 +94,5 @@
+					else

+					{

+						$add = '';

+					}

+					$output .= '<option '.$add.'value="'.dol_escape_htmltag($valueforoption).'">'.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).'</option>';