mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
Clean code
This commit is contained in:
@@ -93,29 +93,22 @@ class CUnits // extends CommonObject
|
||||
if (isset($this->unit_type)) $this->active=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_units(";
|
||||
|
||||
$sql.= "rowid,";
|
||||
$sql.= "code,";
|
||||
$sql.= "label,";
|
||||
$sql.= "short_label,";
|
||||
$sql.= "unit_type";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$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->escape($this->short_label)."'").",";
|
||||
$sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->escape($this->unit_type)."'");
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
@@ -187,7 +180,6 @@ class CUnits // extends CommonObject
|
||||
if ($unit_type) $sql_where[]= " t.unit_type = '".$this->db->escape($unit_type)."'";
|
||||
if ($code) $sql_where[]= " t.code = '".$this->db->escape($code)."'";
|
||||
if ($short_label) $sql_where[]= " t.short_label = '".$this->db->escape($short_label)."'";
|
||||
|
||||
if (count($sql_where)>0) {
|
||||
$sql.=' WHERE '. implode(' AND ', $sql_where);
|
||||
}
|
||||
@@ -322,7 +314,6 @@ class CUnits // extends CommonObject
|
||||
if (isset($this->unit_type)) $this->libelle=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
|
||||
Reference in New Issue
Block a user