From c17f42b767907a7f35db863e3c3afc5a68eb6672 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 10 May 2014 14:57:22 +0200 Subject: [PATCH] fix: if note not set, insert null iso "null" when create class was called with note not set, text "null" was inserted in database, changed to null. Also $note property was missing. --- htdocs/product/class/product.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2bcb72c9713..50ca2d1b6c4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -154,6 +154,8 @@ class Product extends CommonObject var $oldcopy; + //note not visible on orders and invoices + var $note; /** * Constructor @@ -546,7 +548,7 @@ class Product extends CommonObject $this->ref = dol_string_nospecial(trim($this->ref)); $this->libelle = trim($this->libelle); $this->description = trim($this->description); - $this->note = (isset($this->note)? trim($this->note):"null"); + $this->note = (isset($this->note) ? trim($this->note) : null); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -614,7 +616,7 @@ class Product extends CommonObject $sql.= ", url = " . ($this->url?"'".$this->db->escape($this->url)."'":'null'); $sql.= ", customcode = '" . $this->db->escape($this->customcode) ."'"; $sql.= ", fk_country = " . ($this->country_id > 0 ? $this->country_id : 'null'); - $sql.= ", note = '" . $this->db->escape($this->note) ."'"; + $sql.= ", note = ".(isset($this->note) ? "'" .$this->db->escape($this->note)."'" : 'null'); $sql.= ", duration = '" . $this->duration_value . $this->duration_unit ."'"; $sql.= ", accountancy_code_buy = '" . $this->accountancy_code_buy."'"; $sql.= ", accountancy_code_sell= '" . $this->accountancy_code_sell."'";