From c6ab092af18efd3e75a72ccf082a48630cc08e48 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 14 Jun 2019 09:12:53 +0200 Subject: [PATCH 01/12] add capacity value for product --- htdocs/install/mysql/tables/llx_product.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index fb6e4cf5f1a..953a087f189 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -69,6 +69,8 @@ create table llx_product accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. + capacity float DEFAULT NULL, + capcity_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, From f7134340e8946fcc32ff14674a4431d95b1b3cfb Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 13:22:01 +0200 Subject: [PATCH 02/12] Update llx_product.sql --- htdocs/install/mysql/tables/llx_product.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 953a087f189..1603ee52eff 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -70,7 +70,7 @@ create table llx_product accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. capacity float DEFAULT NULL, - capcity_units tinyint DEFAULT NULL, + capacity_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, From f5f6882583398a27c45861c86794d552a3c703b4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 13:42:50 +0200 Subject: [PATCH 03/12] Update product.class.php --- htdocs/product/class/product.class.php | 158 ++++++++++++++++++------- 1 file changed, 114 insertions(+), 44 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index de0d28cee83..7d323ebadcf 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -59,7 +59,10 @@ class Product extends CommonObject */ public $fk_element='fk_product'; - protected $childtables=array('supplier_proposaldet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object + /** + * @var array List of child tables. To test if we can delete object. + */ + protected $childtables=array('supplier_proposaldet', 'propaldet', 'commandedet', 'facturedet', 'contratdet', 'facture_fourn_det', 'commande_fournisseurdet'); /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -254,6 +257,8 @@ class Product extends CommonObject public $url; //! Unites de mesure + public $capacity; + public $capacity_units; public $weight; public $weight_units; public $length; @@ -269,13 +274,26 @@ class Product extends CommonObject public $accountancy_code_buy; /** - * Main barcode - * barcode value + * Main Barcode value * * @var string */ public $barcode; + /** + * Main Barcode type ID + * + * @var int + */ + public $barcode_type; + + /** + * Main Barcode type code + * + * @var string + */ + public $barcode_type_code; + /** * Additional barcodes (Some products have different barcodes according to the country of origin of manufacture) * @@ -291,7 +309,7 @@ class Product extends CommonObject public $multilangs=array(); - //! Taille de l'image + //! Size of image public $imgWidth; public $imgHeight; @@ -345,16 +363,7 @@ class Product extends CommonObject public $fields = array( - 'rowid' => array( - 'type'=>'integer', - 'label'=>'TechnicalID', - 'enabled'=>1, - 'visible'=>-2, - 'notnull'=>1, - 'index'=>1, - 'position'=>1, - 'comment'=>'Id', - ), + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), @@ -799,6 +808,8 @@ class Product extends CommonObject $this->label = trim($this->label); $this->description = trim($this->description); $this->note = (isset($this->note) ? trim($this->note) : null); + $this->capacity = price2num($this->capacity); + $this->capacity_units = trim($this->capacity_units); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -945,6 +956,8 @@ class Product extends CommonObject $sql.= ", tobuy = " . (int) $this->status_buy; $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); + $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacityt_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); @@ -2101,6 +2114,8 @@ class Product extends CommonObject $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); $this->duration_unit = substr($obj->duration, -1); $this->canvas = $obj->canvas; + $this->capacity = $obj->capacity; + $this->capacity_units = $obj->capacity_units; $this->weight = $obj->weight; $this->weight_units = $obj->weight_units; $this->length = $obj->length; @@ -3246,6 +3261,57 @@ class Product extends CommonObject return $this->_get_stats($sql, $mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return nb of units or orders in which product is included + * + * @param int $socid Limit count on a particular third party id + * @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities + * @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only + * @param int $year Year (0=last 12 month) + * @param string $morefilter More sql filters + * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 + */ + public function get_nb_contract($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '') + { + // phpcs:enable + global $conf, $user; + + $sql = "SELECT sum(d.qty), date_format(c.date_contrat, '%Y%m')"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT c.rowid)"; + } + $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as p"; + } + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql.= " WHERE c.rowid = d.fk_contrat"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; + } + if ($filteronproducttype >= 0) { + $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; + } + $sql.= " AND c.fk_soc = s.rowid"; + $sql.= " AND c.entity IN (".getEntity('contract').")"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + } + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; + } + $sql.=$morefilter; + $sql.= " GROUP BY date_format(c.date_contrat,'%Y%m')"; + $sql.= " ORDER BY date_format(c.date_contrat,'%Y%m') DESC"; + + return $this->_get_stats($sql, $mode, $year); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Link a product/service to a parent product/service @@ -3662,7 +3728,7 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits - * Define value of this->res + * Define value of this->res * * @param array $prod Products array * @param string $compl_path Directory path of parents to add before @@ -3676,7 +3742,7 @@ class Product extends CommonObject // phpcs:enable global $conf,$langs; - $product = new Product($this->db); + $tmpproduct = null; //var_dump($prod); foreach($prod as $id_product => $desc_pere) // $id_product is 0 (first call starting with root top) or an id of a sub_product { @@ -3692,23 +3758,26 @@ class Product extends CommonObject } //print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n"; - $this->fetch($id); // Load product - $this->load_stock('nobatch,novirtual'); // Load stock to get true this->stock_reel + if (is_null($tmpproduct)) $tmpproduct = new Product($this->db); // So we initialize tmpproduct only once for all loop. + $tmpproduct->fetch($id); // Load product to get ->ref + $tmpproduct->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel + //$this->fetch($id); // Load product to get ->ref + //$this->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel $this->res[]= array( - 'id'=>$id, // Id product - 'id_parent'=>$id_parent, - 'ref'=>$this->ref, // Ref product - 'nb'=>$nb, // Nb of units that compose parent product - 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product - 'stock'=>$this->stock_reel, // Stock - 'stock_alert'=>$this->seuil_stock_alerte, // Stock alert - 'label'=>$label, - 'fullpath'=>$compl_path.$label, // Label - 'type'=>$type, // Nb of units that compose parent product - 'desiredstock'=>$this->desiredstock, - 'level'=>$level, - 'incdec'=>$incdec, - 'entity'=>$this->entity + 'id'=>$id, // Id product + 'id_parent'=>$id_parent, + 'ref'=>$tmpproduct->ref, // Ref product + 'nb'=>$nb, // Nb of units that compose parent product + 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product + 'stock'=>$tmpproduct->stock_reel, // Stock + 'stock_alert'=>$tmpproduct->seuil_stock_alerte, // Stock alert + 'label'=>$label, + 'fullpath'=>$compl_path.$label, // Label + 'type'=>$type, // Nb of units that compose parent product + 'desiredstock'=>$tmpproduct->desiredstock, + 'level'=>$level, + 'incdec'=>$incdec, + 'entity'=>$tmpproduct->entity ); // Recursive call if there is childs to child @@ -4030,14 +4099,11 @@ class Product extends CommonObject } $linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose.= ' class="classfortooltip"'; - - /* - $hookmanager->initHooks(array('productdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ + $linkclose.= ' class="nowraponall classfortooltip"'; + } + else + { + $linkclose = ' class="nowraponall"'; } if ($option == 'supplier' || $option == 'category') { @@ -4066,9 +4132,11 @@ class Product extends CommonObject $result.=$linkstart; if ($withpicto) { - if ($this->type == Product::TYPE_PRODUCT) { $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); + if ($this->type == Product::TYPE_PRODUCT) { + $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } - if ($this->type == Product::TYPE_SERVICE) { $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); + if ($this->type == Product::TYPE_SERVICE) { + $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } } $result.= $newref; @@ -4078,8 +4146,10 @@ class Product extends CommonObject $hookmanager->initHooks(array('productdao')); $parameters=array('id'=>$this->id, 'getnomurl'=>$result); $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) { $result = $hookmanager->resPrint; - } else { $result .= $hookmanager->resPrint; + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; } return $result; From c9e481d6f7b60a3a28edbea0b63ed3a1876782d5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 14:09:59 +0200 Subject: [PATCH 04/12] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7d323ebadcf..8cebf3a2ce4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -957,7 +957,7 @@ class Product extends CommonObject $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacityt_units)."'": 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); From 2d77bfd873df6cc3b382f2dd0c8f2d2830c81a26 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 14:50:25 +0200 Subject: [PATCH 05/12] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8cebf3a2ce4..bdc4fa9be51 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2050,7 +2050,7 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; - $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units,"; + $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, capacity, capacity_units, weight, weight_units,"; $sql.= " length, length_units, width, width_units, height, height_units,"; $sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,"; From d22c2960b7878e4eee53fc6242d6b6c0bca0abc5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 6 Aug 2019 00:14:19 +0200 Subject: [PATCH 06/12] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bdc4fa9be51..09038866e45 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -258,7 +258,7 @@ class Product extends CommonObject //! Unites de mesure public $capacity; - public $capacity_units; + public $capacity_units; public $weight; public $weight_units; public $length; @@ -957,7 +957,7 @@ class Product extends CommonObject $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); From 1b4788c6d0d33a9fa6890f0c4a1a39b8cd74e4d3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 24 Aug 2019 14:21:41 +0200 Subject: [PATCH 07/12] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 09038866e45..6b1877d0b51 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3288,7 +3288,8 @@ class Product extends CommonObject if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql.= " WHERE c.rowid = d.fk_contrat"; + $sql.= " WHERE c.entity IN (".getEntity('contract').")"; + $sql.= " AND c.rowid = d.fk_contrat"; if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; } else { @@ -3298,7 +3299,6 @@ class Product extends CommonObject $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } $sql.= " AND c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('contract').")"; if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } From 1e8663b1c891b2b85ffebd10534309aca68540d1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 10 Sep 2019 18:48:55 +0000 Subject: [PATCH 08/12] Fixing style errors. --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ceae785c6e8..6dbb54b1203 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -957,7 +957,7 @@ class Product extends CommonObject $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); From 552a9498be8bd3538ce54e761dd004b3123c025d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:11:50 +0200 Subject: [PATCH 09/12] Update llx_product.sql --- htdocs/install/mysql/tables/llx_product.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 1603ee52eff..f828c770089 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -69,8 +69,8 @@ create table llx_product accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. - capacity float DEFAULT NULL, - capacity_units tinyint DEFAULT NULL, + net_measure float DEFAULT NULL, + net_measure_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, From e2d76f6f2485b09f485fdbb3546a6320c748848b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:13:59 +0200 Subject: [PATCH 10/12] Update product.class.php --- htdocs/product/class/product.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6dbb54b1203..155fccd354f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -257,8 +257,8 @@ class Product extends CommonObject public $url; //! Unites de mesure - public $capacity; - public $capacity_units; + public $net_measure; + public $net_measure_units; public $weight; public $weight_units; public $length; @@ -808,8 +808,8 @@ class Product extends CommonObject $this->label = trim($this->label); $this->description = trim($this->description); $this->note = (isset($this->note) ? trim($this->note) : null); - $this->capacity = price2num($this->capacity); - $this->capacity_units = trim($this->capacity_units); + $this->net_measure = price2num($this->net_measure); + $this->net_measure_units = trim($this-net_measure_units); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -956,8 +956,8 @@ class Product extends CommonObject $sql.= ", tobuy = " . (int) $this->status_buy; $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); - $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); + $sql.= ", net_measure = " . ($this->net_measure!='' ? "'".$this->db->escape($this->net_measure)."'" : 'null'); + $sql.= ", net_measure_units = " . ($this->net_measure_units!='' ? "'".$this->db->escape($this->net_measure_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); @@ -2114,8 +2114,8 @@ class Product extends CommonObject $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); $this->duration_unit = substr($obj->duration, -1); $this->canvas = $obj->canvas; - $this->capacity = $obj->capacity; - $this->capacity_units = $obj->capacity_units; + $this->net_measure = $obj->net_measure; + $this->net_measure_units = $obj->net_measure_units; $this->weight = $obj->weight; $this->weight_units = $obj->weight_units; $this->length = $obj->length; From 10c29887d662b8774b3b6b8e9caf47d5c8a30f69 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:15:12 +0200 Subject: [PATCH 11/12] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 155fccd354f..dffaef1d9e7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -809,7 +809,7 @@ class Product extends CommonObject $this->description = trim($this->description); $this->note = (isset($this->note) ? trim($this->note) : null); $this->net_measure = price2num($this->net_measure); - $this->net_measure_units = trim($this-net_measure_units); + $this->net_measure_units = trim($this->net_measure_units); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -2050,7 +2050,7 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; - $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, capacity, capacity_units, weight, weight_units,"; + $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,"; $sql.= " length, length_units, width, width_units, height, height_units,"; $sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,"; From 17198d59c210b6cce801d236a4ba0e8b0d0a15e6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:17:31 +0200 Subject: [PATCH 12/12] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index cc375e72714..67132713ed7 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -163,4 +163,5 @@ INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, m INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1); - +ALTER TABLE llx_product ADD COLUMN net_measure float; +ALTER TABLE llx_product ADD COLUMN net_measure_units tinyint;