Fix scrutinizer

This commit is contained in:
Laurent Destailleur 2020-10-27 19:14:03 +01:00
parent e10051800d
commit f670f71df9
3 changed files with 18 additions and 14 deletions

View File

@ -41,8 +41,8 @@ if (!$user->rights->categorie->lire) accessforbidden();
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$origin = GETPOST('origin', 'alpha');
$catorigin = GETPOST('catorigin', 'int');
$type = GETPOST('type', 'alpha');
$catorigin = GETPOST('catorigin', 'int');
$type = GETPOST('type', 'aZ09');
$urlfrom = GETPOST('urlfrom', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
@ -73,6 +73,8 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
$error = 0;
/*
* Actions
@ -127,7 +129,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
$object->label = $label;
$object->color = $color;
$object->description = dol_htmlcleanlastbr($description);
$object->socid = ($socid ? $socid : 'null');
$object->socid = ($socid > 0 ? $socid : 0);
$object->visible = $visible;
$object->type = $type;

View File

@ -424,17 +424,17 @@ class Categorie extends CommonObject
$sql .= " fk_user_creat";
$sql .= ") VALUES (";
$sql .= (int) $this->fk_parent.",";
$sql .= "'".$this->db->escape($this->label)."',";
$sql .= "'".$this->db->escape($this->description)."',";
$sql .= "'".$this->db->escape($this->color)."',";
$sql .= "'".$this->db->escape($this->label)."', ";
$sql .= "'".$this->db->escape($this->description)."', ";
$sql .= "'".$this->db->escape($this->color)."', ";
if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) {
$sql .= ($this->socid != -1 ? $this->socid : 'null').",";
$sql .= ($this->socid > 0 ? $this->socid : 'null').", ";
}
$sql .= "'".$this->db->escape($this->visible)."',";
$sql .= $this->db->escape($type).",";
$sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').",";
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').",";
$sql .= (int) $conf->entity.",";
$sql .= "'".$this->db->escape($this->visible)."', ";
$sql .= $this->db->escape($type).", ";
$sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').", ";
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').", ";
$sql .= (int) $conf->entity.", ";
$sql .= "'".$this->db->idate($now)."', ";
$sql .= (int) $user->id;
$sql .= ")";
@ -516,7 +516,7 @@ class Categorie extends CommonObject
$sql .= " ref_ext = '".$this->db->escape($this->ref_ext)."',";
$sql .= " color = '".$this->db->escape($this->color)."'";
if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) {
$sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null');
$sql .= ", fk_soc = ".($this->socid > 0 ? $this->socid : 'null');
}
$sql .= ", visible = ".(int) $this->visible;
$sql .= ", fk_parent = ".(int) $this->fk_parent;

View File

@ -65,6 +65,8 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
$error = 0;
/*
* Actions
@ -81,7 +83,7 @@ if ($action == 'update' && $user->rights->categorie->creer) {
$object->label = $label;
$object->description = dol_htmlcleanlastbr($description);
$object->color = $color;
$object->socid = ($socid ? $socid : 'null');
$object->socid = ($socid > 0 ? $socid : 0);
$object->visible = $visible;
$object->fk_parent = $parent != -1 ? $parent : 0;