From 6d02c48c49e242fcc4780b1e6856f118437479b3 Mon Sep 17 00:00:00 2001 From: fappels Date: Thu, 27 Aug 2015 19:52:43 +0200 Subject: [PATCH 1/4] Fix batch expedition --- htdocs/expedition/class/expedition.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3dc1d555d28..edd8aa0cd39 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -643,7 +643,15 @@ class Expedition extends CommonObject for ($i = 0; $i < $cpt; $i++) { $obj = $this->db->fetch_object($resql); - if ($obj->qty <= 0) continue; + if (empty($obj->edbrowid)) + { + $qty = $obj->qty; + } + else + { + $qty = $obj->edbqty; + } + if ($qty <= 0) continue; dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); //var_dump($this->lines[$i]); @@ -655,7 +663,7 @@ class Expedition extends CommonObject // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref)); + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref)); if ($result < 0) { $error++; break; } @@ -665,15 +673,16 @@ class Expedition extends CommonObject // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->edbqty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch); + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch); if ($result < 0) { $error++; break; } // We update content of table llx_product_batch (will be rename into llx_product_stock_batch inantoher version) + // We can set livraison_batch to deprecated and adapt livraison to handle batch too (mouvS->_create also calls mouvS->_create_batch) if (! empty($conf->productbatch->enabled)) { - $result=$mouvS->livraison_batch($obj->fk_origin_stock, $obj->qty); // ->fk_origin_stock = id into table llx_product_batch (will be rename into llx_product_stock_batch in another version) + $result=$mouvS->livraison_batch($obj->fk_origin_stock, $qty); // ->fk_origin_stock = id into table llx_product_batch (will be rename into llx_product_stock_batch in another version) if ($result < 0) { $error++; $this->errors[]=$mouvS->error; break; } } } From ace1681f31a3a29dd0278b6e1e0cf2c340f881b1 Mon Sep 17 00:00:00 2001 From: fappels Date: Sat, 29 Aug 2015 16:52:10 +0200 Subject: [PATCH 2/4] Fix missing delivery validation button delivery advanced permissions were missing --- htdocs/livraison/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 7ea9920d65b..791144ed3aa 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -744,9 +744,13 @@ else { print '
'; - if ($object->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0) + if ($object->statut == 0 && $num_prod > 0) { - print ''.$langs->trans("Validate").''; + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->livraison->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison_advance->validate))) + { + print ''.$langs->trans("Validate").''; + } } if ($user->rights->expedition->livraison->supprimer) From f1be57448924941ebfd720e72522bdbba3e03a6d Mon Sep 17 00:00:00 2001 From: fappels Date: Sat, 29 Aug 2015 17:14:41 +0200 Subject: [PATCH 3/4] correction on permissions --- htdocs/livraison/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 791144ed3aa..54e45080efb 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -746,7 +746,7 @@ else if ($object->statut == 0 && $num_prod > 0) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->livraison->creer)) + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison_advance->validate))) { print ''.$langs->trans("Validate").''; From 9f4ec3dbdf34792d2e2c13f29f9c4b69d12029bb Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 31 Aug 2015 12:00:47 +0200 Subject: [PATCH 4/4] FIX error creating default object from empty value --- htdocs/core/class/conf.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 29fed41a6ad..97fc168716d 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -110,6 +110,7 @@ class Conf $this->bank = new stdClass(); $this->notification = new stdClass(); $this->mailing = new stdClass(); + $this->expensereport = new stdClass(); }