Skip to content

Commit

Permalink
Revert commit.
Browse files Browse the repository at this point in the history
Bug into update function. Also what was difference of new field ?
  • Loading branch information
eldy committed Sep 3, 2013
1 parent 23df3d8 commit c502005
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions htdocs/categories/class/categorie.class.php
Expand Up @@ -45,7 +45,6 @@ class Categorie
var $fk_parent;
var $label;
var $description;
var $add_description; // For taxes like DEEE...
var $socid;
var $type; // 0=Product, 1=Supplier, 2=Customer/Prospect, 3=Member
var $import_key;
Expand Down Expand Up @@ -75,7 +74,7 @@ function fetch($id,$label='')
{
global $conf;

$sql = "SELECT rowid, fk_parent, entity, label, description, add_description, fk_soc, visible, type";
$sql = "SELECT rowid, fk_parent, entity, label, description, fk_soc, visible, type";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
if ($id)
{
Expand All @@ -95,15 +94,14 @@ function fetch($id,$label='')
{
$res = $this->db->fetch_array($resql);

$this->id = $res['rowid'];
$this->fk_parent = $res['fk_parent'];
$this->label = $res['label'];
$this->description = $res['description'];
$this->add_description = $res['add_description'];
$this->socid = $res['fk_soc'];
$this->visible = $res['visible'];
$this->type = $res['type'];
$this->entity = $res['entity'];
$this->id = $res['rowid'];
$this->fk_parent = $res['fk_parent'];
$this->label = $res['label'];
$this->description = $res['description'];
$this->socid = $res['fk_soc'];
$this->visible = $res['visible'];
$this->type = $res['type'];
$this->entity = $res['entity'];

$this->db->free($resql);

Expand Down Expand Up @@ -159,7 +157,6 @@ function create($user='')
$sql.= "fk_parent,";
$sql.= " label,";
$sql.= " description,";
$sql.= " add_description,";
if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER))
{
$sql.= "fk_soc,";
Expand All @@ -172,7 +169,6 @@ function create($user='')
$sql.= $this->fk_parent.",";
$sql.= "'".$this->db->escape($this->label)."',";
$sql.= "'".$this->db->escape($this->description)."',";
$sql.= "'".$this->db->escape($this->add_description)."',";
if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER))
{
$sql.= ($this->socid != -1 ? $this->socid : 'null').",";
Expand Down Expand Up @@ -249,14 +245,7 @@ function update($user='')

$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
$sql.= " SET label = '".$this->db->escape($this->label)."',";
if (! empty($this->description))
{
$sql .= ", description = '".$this->db->escape($this->description)."'";
}
if (! empty($this->add_description))
{
$sql .= ", add_description = '".$this->db->escape($this->add_description)."'";
}
$sql.= " description = '".$this->db->escape($this->description)."'";
if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER))
{
$sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null');
Expand Down Expand Up @@ -624,7 +613,6 @@ private function load_motherof()
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
$sql.= " WHERE fk_parent != 0";
$sql.= " AND entity IN (".getEntity('category',1).")";

dol_syslog(get_class($this)."::load_motherof sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
Expand Down

0 comments on commit c502005

Please sign in to comment.