From 9d821d396712ed28759f779a6774e997483b8781 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 14 Oct 2013 17:56:23 +0200 Subject: [PATCH 1/3] Fix : object origin was fetched instead of shipment => errors when creating shipment --- htdocs/expedition/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index efa00af3d80..c77753c0948 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -51,9 +51,9 @@ $langs->load('propal'); $origin = GETPOST('origin','alpha')?GETPOST('origin','alpha'):'expedition'; // Example: commande, propal $origin_id = GETPOST('id','int')?GETPOST('id','int'):''; +$id = $origin_id; if (empty($origin_id)) $origin_id = GETPOST('origin_id','int'); // Id of order or propal if (empty($origin_id)) $origin_id = GETPOST('object_id','int'); // Id of order or propal -$id = $origin_id; $ref=GETPOST('ref','alpha'); // Security check From dde9a6da39f7a85f5ffc71b1338a8508b32e4297 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 15 Oct 2013 11:11:42 +0200 Subject: [PATCH 2/3] fix: delete() The delete method does not delete product_stock record. Typing error in delete product record debug log, sql iso sqlz --- 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 97ad7b33ef5..1ac8d9cbfd5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -621,7 +621,7 @@ class Product extends CommonObject } // Delete all child tables - $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product'); + $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock'); foreach($elements as $table) { if (! $error) @@ -644,7 +644,7 @@ class Product extends CommonObject { $sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product"; $sqlz.= " WHERE rowid = ".$id; - dol_syslog(get_class($this).'::delete sql='.$sql, LOG_DEBUG); + dol_syslog(get_class($this).'::delete sql='.$sqlz, LOG_DEBUG); $resultz = $this->db->query($sqlz); if ( ! $resultz ) { From d7fc0eea43940b4fae34ec6b2949c777e29e318d Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 15 Oct 2013 11:12:41 +0200 Subject: [PATCH 3/3] fix: _create() add 'require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';' to htdocs/product/stock/class/mouvementstock.class.php _create method. This to support product class instance used in function. --- htdocs/product/stock/class/mouvementstock.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 584f5773ede..6e4ada58b34 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -61,6 +61,7 @@ class MouvementStock { global $conf, $langs; + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $error = 0; dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label");