Code comment

This commit is contained in:
Laurent Destailleur 2021-09-23 13:39:48 +02:00
parent 5c4922682c
commit 9d5f6fbc1b
2 changed files with 5 additions and 6 deletions

View File

@ -26,6 +26,8 @@
/** /**
* Parent class for class inheritance lines of business objects * Parent class for class inheritance lines of business objects
* This class is useless for the moment so no inherit are done on it * This class is useless for the moment so no inherit are done on it
*
* TODO For the moment we use the extends on CommonObject until PHP min is 5.4 so we can use Traits.
*/ */
abstract class CommonObjectLine extends CommonObject abstract class CommonObjectLine extends CommonObject
{ {
@ -61,7 +63,7 @@ abstract class CommonObjectLine extends CommonObject
} }
/** /**
* Returns the label, shot_label or code found in units dictionary from ->fk_unit. * Returns the label, short_label or code found in units dictionary from ->fk_unit.
* A langs->trans() must be called on result to get translated value. * A langs->trans() must be called on result to get translated value.
* *
* @param string $type Label type ('long', 'short' or 'code'). This can be a translation key. * @param string $type Label type ('long', 'short' or 'code'). This can be a translation key.
@ -104,7 +106,4 @@ abstract class CommonObjectLine extends CommonObject
return -1; return -1;
} }
} }
// Currently we need function at end of file CommonObject for all object lines. Should find a way to avoid duplicate code.
// For the moment we use the extends on CommonObject until PHP min is 5.4 so use Traits.
} }

View File

@ -729,10 +729,10 @@ class EcmDirectory extends CommonObject
// We count number of _ to have level (we use strlen that is faster than dol_strlen) // We count number of _ to have level (we use strlen that is faster than dol_strlen)
$this->cats[$id_categ]['level'] = strlen(preg_replace('/([^_])/i', '', $this->cats[$id_categ]['fullpath'])); $this->cats[$id_categ]['level'] = strlen(preg_replace('/([^_])/i', '', $this->cats[$id_categ]['fullpath']));
// Traite ces enfants // Process children
$protection++; $protection++;
if ($protection > 20) { if ($protection > 20) {
return; // On ne traite pas plus de 20 niveaux return; // We never go more than 20 levels
} }
if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) { 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) { foreach ($this->cats[$id_categ]['id_children'] as $key => $val) {