diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 3cb8069576a..3970ff2df27 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -86,7 +86,7 @@ class CUnits // extends CommonObject // Clean parameters - if (isset($this->id)) $this->id=trim($this->id); + if (isset($this->id)) $this->id = (int) $this->id; if (isset($this->code)) $this->code=trim($this->code); if (isset($this->label)) $this->libelle=trim($this->label); if (isset($this->short_label)) $this->libelle=trim($this->short_label); @@ -113,8 +113,8 @@ class CUnits // extends CommonObject $sql.= " ".(! isset($this->id)?'NULL':"'".$this->db->escape($this->id)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").","; - $sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->active($this->short_label)."'").","; - $sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->active($this->unit_type)."'"); + $sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->escape($this->short_label)."'").","; + $sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->escape($this->unit_type)."'"); $sql.= ")"; @@ -128,8 +128,8 @@ class CUnits // extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_units"); - if (! $notrigger) - { + //if (! $notrigger) + //{ // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -139,7 +139,7 @@ class CUnits // extends CommonObject //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } + //} } // Commit or rollback @@ -341,10 +341,10 @@ class CUnits // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -354,8 +354,8 @@ class CUnits // extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error) @@ -397,10 +397,10 @@ class CUnits // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -410,8 +410,8 @@ class CUnits // extends CommonObject //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error)