Merge pull request #11531 from BadPixxel/patch-5

FIX: Units Scale Missing in Object CRUD
This commit is contained in:
Laurent Destailleur 2019-07-22 18:31:43 +02:00 committed by GitHub
commit 59555d00ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,6 +92,7 @@ class CUnits // extends CommonObject
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
if (isset($this->unit_type)) $this->active=trim($this->unit_type);
if (isset($this->active)) $this->active=trim($this->active);
if (isset($this->scale)) $this->scale=trim($this->scale);
// Check parameters
// Put here code to add control on parameters values
@ -103,12 +104,14 @@ class CUnits // extends CommonObject
$sql.= "label,";
$sql.= "short_label,";
$sql.= "unit_type";
$sql.= "scale";
$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.= " ".(! isset($this->scale)?'NULL':"'".$this->db->escape($this->scale)."'");
$sql.= ")";
$this->db->begin();
@ -173,6 +176,7 @@ class CUnits // extends CommonObject
$sql.= " t.label,";
$sql.= " t.short_label,";
$sql.= " t.unit_type,";
$sql.= " t.scale,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_units as t";
$sql_where=array();
@ -196,6 +200,7 @@ class CUnits // extends CommonObject
$this->label = $obj->label;
$this->short_label = $obj->short_label;
$this->unit_type = $obj->unit_type;
$this->scale = $obj->scale;
$this->active = $obj->active;
}
$this->db->free($resql);
@ -235,6 +240,7 @@ class CUnits // extends CommonObject
$sql.= " t.label,";
$sql.= " t.short_label,";
$sql.= " t.unit_type,";
$sql.= " t.scale,";
$sql.= " t.active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_units as t';
// Manage filter
@ -279,6 +285,7 @@ class CUnits // extends CommonObject
$record->label = $obj->label;
$record->short_label = $obj->short_label;
$record->unit_type = $obj->unit_type;
$record->scale = $obj->scale;
$record->active = $obj->active;
$this->records[$record->id] = $record;
}
@ -312,6 +319,7 @@ class CUnits // extends CommonObject
if (isset($this->label)) $this->libelle=trim($this->label);
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
if (isset($this->unit_type)) $this->libelle=trim($this->unit_type);
if (isset($this->scale)) $this->scale=trim($this->scale);
if (isset($this->active)) $this->active=trim($this->active);
// Check parameters
@ -323,6 +331,7 @@ class CUnits // extends CommonObject
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " short_label=".(isset($this->short_label)?"'".$this->db->escape($this->short_label)."'":"null").",";
$sql.= " unit_type=".(isset($this->unit_type)?"'".$this->db->escape($this->unit_type)."'":"null").",";
$sql.= " scale=".(isset($this->scale)?"'".$this->db->escape($this->scale)."'":"null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null");
$sql.= " WHERE rowid=".$this->id;