diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 802e8e3ff11..c2c249f5e41 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -543,39 +543,39 @@ class Categorie return ($n[0] > 0); } - - /** - * Load this->motherof that is array(id_son=>id_parent, ...) - * - * @return int <0 if KO, >0 if OK - */ - private function load_motherof() - { - global $conf; - - $this->motherof=array(); - + + /** + * Load this->motherof that is array(id_son=>id_parent, ...) + * + * @return int <0 if KO, >0 if OK + */ + private function load_motherof() + { + global $conf; + + $this->motherof=array(); + // Load array[child]=parent - $sql = "SELECT fk_parent as id_parent, rowid as id_son"; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; - $sql.= " WHERE fk_parent != 0"; - $sql.= " AND entity = ".$conf->entity; - - dol_syslog(get_class($this)."::load_motherof sql=".$sql); - $resql = $this->db->query($sql); - if ($resql) - { - while ($obj= $this->db->fetch_object($resql)) - { - $this->motherof[$obj->id_son]=$obj->id_parent; - } - return 1; - } - else - { - dol_print_error($this->db); - return -1; - } + $sql = "SELECT fk_parent as id_parent, rowid as id_son"; + $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; + $sql.= " WHERE fk_parent != 0"; + $sql.= " AND entity = ".$conf->entity; + + dol_syslog(get_class($this)."::load_motherof sql=".$sql); + $resql = $this->db->query($sql); + if ($resql) + { + while ($obj= $this->db->fetch_object($resql)) + { + $this->motherof[$obj->id_son]=$obj->id_parent; + } + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } } /** @@ -596,8 +596,8 @@ class Categorie { $this->cats = array(); - // Init this->motherof that is array(id_son=>id_parent, ...) - $this->load_motherof(); + // Init this->motherof that is array(id_son=>id_parent, ...) + $this->load_motherof(); // Init $this->cats array $sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates @@ -695,7 +695,7 @@ class Categorie $i++; $cursor_categ=$this->motherof[$cursor_categ]; } //print 'Result for id_categ='.$id_categ.' : '.$this->cats[$id_categ]['fullpath'].'
'."\n"; - + // We count number of _ to have level $this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath'])); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 0c31a7569fa..cca22038746 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -179,7 +179,7 @@ class HookManager if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result; } - //print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction; + //print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction; } } } diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php index 309bcf33224..60794497554 100644 --- a/htdocs/core/lib/trip.lib.php +++ b/htdocs/core/lib/trip.lib.php @@ -50,11 +50,11 @@ function trip_prepare_head($object) $head[$h][2] = 'documents'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; - + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove'); return $head; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index b023f7110b0..41bfa6d3a91 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -207,8 +207,8 @@ if (! defined('NOREQUIRETRAN')) // Create the global $hookmanager object -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager=new HookManager($db); if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7cdc137d9f1..269f428a61a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -565,45 +565,45 @@ class Societe extends CommonObject $resql=$this->db->query($sql); if ($resql) { - unset($this->country_code); // We clean this because it may have been changed after an update of country_id - unset($this->country); - unset($this->state_code); - unset($this->state); - - $nbrowsaffected+=$this->db->affected_rows($resql); + unset($this->country_code); // We clean this because it may have been changed after an update of country_id + unset($this->country); + unset($this->state_code); + unset($this->state); + + $nbrowsaffected+=$this->db->affected_rows($resql); if (! $error && $nbrowsaffected) { // Update information on linked member if it is an update if (! $nosyncmember && ! empty($conf->adherent->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - - dol_syslog(get_class($this)."::update update linked member"); - - $lmember=new Adherent($this->db); - $result=$lmember->fetch(0, 0, $this->id); - - if ($result > 0) - { - $lmember->firstname=$this->firstname; - $lmember->lastname=$this->lastname; - $lmember->address=$this->address; - $lmember->email=$this->email; - $lmember->phone=$this->phone; - - $result=$lmember->update($user,0,1,1); // Use nosync to 1 to avoid cyclic updates - if ($result < 0) - { - $this->error=$lmember->error; - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); - $error++; - } - } - else if ($result < 0) - { - $this->error=$lmember->error; - $error++; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + + dol_syslog(get_class($this)."::update update linked member"); + + $lmember=new Adherent($this->db); + $result=$lmember->fetch(0, 0, $this->id); + + if ($result > 0) + { + $lmember->firstname=$this->firstname; + $lmember->lastname=$this->lastname; + $lmember->address=$this->address; + $lmember->email=$this->email; + $lmember->phone=$this->phone; + + $result=$lmember->update($user,0,1,1); // Use nosync to 1 to avoid cyclic updates + if ($result < 0) + { + $this->error=$lmember->error; + dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + $error++; + } + } + else if ($result < 0) + { + $this->error=$lmember->error; + $error++; } } } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index e8cff6c4016..c1dd0c4c09d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -395,21 +395,21 @@ if (empty($reshook)) } // Gestion du logo de la société - - // Update linked member - if (! $error && $object->fk_soc > 0) + + // Update linked member + if (! $error && $object->fk_soc > 0) { - - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; - $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); - if (! $this->db->query($sql)) - { - $error++; - $this->error .= $this->db->lasterror(); - dol_syslog(get_class($this)."::delete erreur -1 ".$this->error, LOG_ERR); - } - } + + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; + $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + if (! $this->db->query($sql)) + { + $error++; + $this->error .= $this->db->lasterror(); + dol_syslog(get_class($this)."::delete erreur -1 ".$this->error, LOG_ERR); + } + } if (! $error && ! count($errors)) {