diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 54270c4a23b..a05a6190fc4 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -1,8 +1,10 @@ # ProductBATCH language file - en_US - ProductBATCH ManageLotSerial=Use lot/serial number -ProductStatusOnBatch=Yes (lot/serial required) +ProductStatusOnBatch=Lot (required) +ProductStatusOnSerial=Serial number (must be unique for each equipment) ProductStatusNotOnBatch=No (lot/serial not used) -ProductStatusOnBatchShort=Yes +ProductStatusOnBatchShort=Lot +ProductStatusOnSerialShort=Serial ProductStatusNotOnBatchShort=No Batch=Lot/Serial atleast1batchfield=Eat-by date or Sell-by date or Lot/Serial number diff --git a/htdocs/langs/fr_FR/productbatch.lang b/htdocs/langs/fr_FR/productbatch.lang index 162af66827c..76cba909e2c 100644 --- a/htdocs/langs/fr_FR/productbatch.lang +++ b/htdocs/langs/fr_FR/productbatch.lang @@ -1,8 +1,10 @@ # ProductBATCH language file - en_US - ProductBATCH ManageLotSerial=Utiliser les numéros de lots/série -ProductStatusOnBatch=Oui (Lot/Série requis) +ProductStatusOnBatch=Lot (requis) +ProductStatusOnSerial=Numéro de série (doit être unique pour chaque équipement) ProductStatusNotOnBatch=Non (Lot/Série non utilisé) -ProductStatusOnBatchShort=Oui +ProductStatusOnBatchShort=Lot +ProductStatusOnSerialShort=N°série ProductStatusNotOnBatchShort=Non Batch=Lot/Série atleast1batchfield=Date limite utilisation optimale, de consommation ou numéro de lot/série diff --git a/htdocs/product/card.php b/htdocs/product/card.php index abf99c1b921..b3bf707c6bc 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1029,7 +1029,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("ManageLotSerial").''; - $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); + if ( empty($conf->global ->MAIN_ADVANCE_NUMLOT) ) + { + $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); + } + else { + $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); + } print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch')); print ''; } @@ -1488,7 +1494,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { print ''.$langs->trans("ManageLotSerial").''; - $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); + if ( empty($conf->global ->MAIN_ADVANCE_NUMLOT) ) + { + $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); + } + else { + $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); + } print $form->selectarray('status_batch', $statutarray, $object->status_batch); print ''; } @@ -1995,7 +2007,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { print ''.$langs->trans("ManageLotSerial").''; - if (!empty($conf->use_javascript_ajax) && $usercancreate && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + if (!empty($conf->use_javascript_ajax) && $usercancreate && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE) && empty($conf->global->MAIN_ADVANCE_NUMLOT)) { print ajax_object_onoff($object, 'status_batch', 'tobatch', 'ProductStatusOnBatch', 'ProductStatusNotOnBatch'); } else { print $object->getLibStatut(0, 2); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a79b108cdc0..059b5ecb717 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4688,10 +4688,10 @@ class Product extends CommonObject switch ($mode) { case 0: - $label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch')); + $label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial'))); return dolGetStatus($label); case 1: - $label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort')); + $label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort'))); return dolGetStatus($label); case 2: return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2); @@ -4729,11 +4729,15 @@ class Product extends CommonObject $labelStatus = $langs->trans('ProductStatusOnBuyShort'); $labelStatusShort = $langs->trans('ProductStatusOnBuy'); } elseif ($type == 2) { - $labelStatus = $langs->trans('ProductStatusOnBatch'); - $labelStatusShort = $langs->trans('ProductStatusOnBatchShort'); + $labelStatus = ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial')); + $labelStatusShort = ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort')); } } - + elseif ( ! empty($conf->global->MAIN_ADVANCE_NUMLOT) && $type == 2 && $status == 2) + { + $labelStatus = $langs->trans('ProductStatusOnSerial'); + $labelStatusShort = $langs->trans('ProductStatusOnSerialShort'); + } if ($mode > 6) { return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0); @@ -5456,7 +5460,7 @@ class Product extends CommonObject */ public function hasbatch() { - return ($this->status_batch == 1 ? true : false); + return ($this->status_batch > 0 ? true : false); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ff035dcdb9c..539338a5966 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -833,7 +833,21 @@ if ($resql) // Stock if (!empty($arrayfields['stock_virtual']['checked'])) print ' '; // To batch - if (!empty($arrayfields['p.tobatch']['checked'])) print ''.$form->selectyesno('search_tobatch', $search_tobatch, 1, false, 1).''; + if (!empty($arrayfields['p.tobatch']['checked'])) + { + print ''; + + if ( empty($conf->global ->MAIN_ADVANCE_NUMLOT) ) + { + print $form->selectyesno('search_tobatch', $search_tobatch, 1, false, 1); + } else + { + $statutarray = array('-1' => '', '0' => $langs->trans("ProductStatusNotOnBatchShort"), '1' => $langs->trans("ProductStatusOnBatchShort"), '2' => $langs->trans("ProductStatusOnSerialShort")); + print $form->selectarray('search_tobatch', $statutarray, $search_tobatch); + } + + ''; + } // Country if (!empty($arrayfields['p.fk_country']['checked'])) print ''.$form->select_country($search_country, 'search_country', '', 0).''; // State @@ -1456,7 +1470,13 @@ if ($resql) if (!empty($arrayfields['p.tobatch']['checked'])) { print ''; - print yn($obj->tobatch); + if ( empty($conf->global->MAIN_ADVANCE_NUMLOT) ) + { + print yn($obj->tobatch); + } + else { + print $product_static->getLibStatut(1, 2); + } print ''; if (!$i) $totalarray['nbfield']++; }