diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 1ddde37b98b38c6a6b092a63e2b0914b485122a0..7571befb1214d6ad214d13ae62debc484228d06f 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -130,7 +130,16 @@ if (! empty($conf->stock->enabled)) $var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value) print '<td colspan="2">'; - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); + if (empty($conf->productbatch->enabled)) { + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); + } + else + { + if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); + } + print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch'); + } print '</td></tr>'; $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 4dd7d0a81ae917af25e5e4e3eb96b8677aea0b9d..50d53f72c5704c47fb446d42dce82e4ad13e6f0a 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -112,8 +112,16 @@ class modProductBatch extends DolibarrModules */ function init($options='') { + global $db,$conf; + $sql = array(); - + + if(! empty($conf->cashdesk->enabled)) { + if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); + } + } + return $this->_init($sql, $options); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 009c7dd774c46405d9c534eafdccc1dea2a5c4e5..8768983ce7350f6c8a0079568765864c8f30d331 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1494,6 +1494,7 @@ CashDeskBankAccountForCB= Default account to use to receive payments by credit c CashDeskDoNotDecreaseStock=Disable stock decrease when a sell is done from Point of Sale CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease StockDecreaseForPointOfSaleDisabled=Stock decrease from Point Of Sale disabled +StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatible with batch management CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sell from Point Of Sale. So a warehouse is required. ##### Bookmark ##### BookmarkSetup=Bookmark module setup