Browse Source

Rename build_path_from_id_categ into buildPathFromId and set it private

Laurent Destailleur 3 years ago
parent
commit
370965a0bb
3 changed files with 15 additions and 18 deletions
  1. 1 0
      ChangeLog
  2. 6 8
      htdocs/categories/class/categorie.class.php
  3. 8 10
      htdocs/ecm/class/ecmdirectory.class.php

+ 1 - 0
ChangeLog

@@ -32,6 +32,7 @@ Following changes may create regressions for some external modules, but were nec
 * verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true. 
 * The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
 * All triggers with a name XXX_UPDATE have been rename with name XXX_MODIFY for code consistency purpose.
+* Rename build_path_from_id_categ() into buildPathFromId() and set method to private
 
 
 ***** ChangeLog for 15.0.1 compared to 15.0.0 *****

+ 6 - 8
htdocs/categories/class/categorie.class.php

@@ -1141,10 +1141,10 @@ class Categorie extends CommonObject
 		}
 
 		// We add the fullpath property to each elements of first level (no parent exists)
-		dol_syslog(get_class($this)."::get_full_arbo call to build_path_from_id_categ", LOG_DEBUG);
+		dol_syslog(get_class($this)."::get_full_arbo call to buildPathFromId", LOG_DEBUG);
 		foreach ($this->cats as $key => $val) {
 			//print 'key='.$key.'<br>'."\n";
-			$this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent)
+			$this->buildPathFromId($key, 0); // Process a branch from the root category key (this category has no parent)
 		}
 
 		// Include or exclude leaf including $markafterid from tree
@@ -1174,7 +1174,6 @@ class Categorie extends CommonObject
 		return $this->cats;
 	}
 
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
 	 *  It is called by get_full_arbo()
@@ -1185,19 +1184,18 @@ class Categorie extends CommonObject
 	 *	@return		void
 	 *  @see get_full_arbo()
 	 */
-	public function build_path_from_id_categ($id_categ, $protection = 1000)
+	private function buildPathFromId($id_categ, $protection = 1000)
 	{
-		// phpcs:enable
-		dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
+		//dol_syslog(get_class($this)."::buildPathFromId id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
 
 		if (!empty($this->cats[$id_categ]['fullpath'])) {
 			// Already defined
-			dol_syslog(get_class($this)."::build_path_from_id_categ fullpath and fulllabel already defined", LOG_WARNING);
+			dol_syslog(get_class($this)."::buildPathFromId fullpath and fulllabel already defined", LOG_WARNING);
 			return;
 		}
 
 		// First build full array $motherof
-		//$this->load_motherof();	// Disabled because already done by caller of build_path_from_id_categ
+		//$this->load_motherof();	// Disabled because already done by caller of buildPathFromId
 
 		// $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
 

+ 8 - 10
htdocs/ecm/class/ecmdirectory.class.php

@@ -627,10 +627,10 @@ class EcmDirectory extends CommonObject
 	 *				date_c              Date creation
 	 * 				fk_user_c           User creation
 	 *  			login_c             Login creation
-	 * 				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)
+	 * 				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)
 	 *
 	 *  @param	int		$force	        Force reload of full arbo even if already loaded in cache $this->cats
 	 *	@return	array			        Tableau de array
@@ -698,10 +698,10 @@ class EcmDirectory extends CommonObject
 
 		// We add properties fullxxx to all elements
 		foreach ($this->cats as $key => $val) {
-			if (isset($motherof[$key])) {
+			if (isset($this->motherof[$key])) {
 				continue;
 			}
-			$this->build_path_from_id_categ($key, 0);
+			$this->buildPathFromId($key, 0);
 		}
 
 		$this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
@@ -710,7 +710,6 @@ class EcmDirectory extends CommonObject
 		return $this->cats;
 	}
 
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs.
 	 *  Separator between directories is always '/', whatever is OS.
@@ -719,9 +718,8 @@ class EcmDirectory extends CommonObject
 	 * 	@param	int		$protection		Deep counter to avoid infinite loop
 	 * 	@return	void
 	 */
-	public function build_path_from_id_categ($id_categ, $protection = 0)
+	private function buildPathFromId($id_categ, $protection = 0)
 	{
-		// phpcs:enable
 		// Define fullpath
 		if (!empty($this->cats[$id_categ]['id_mere'])) {
 			$this->cats[$id_categ]['fullpath'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
@@ -745,7 +743,7 @@ class EcmDirectory extends CommonObject
 		}
 		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);
+				$this->buildPathFromId($val, $protection);
 			}
 		}
 	}