diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 835810ff065..e7bff68ccee 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5742,6 +5742,47 @@ class Form
}
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Load into the cache productbatch status
+ *
+ * @return int Nb of loaded lines, 0 if already loaded, <0 if KO
+ */
+ public function load_cache_productbatch_status()
+ {
+ // phpcs:enable
+ global $langs;
+
+ $num = count($this->cache_vatrates);
+ if ($num > 0) {
+ return $num; // Cache already loaded
+ }
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $sql = "SELECT s.rowid, s.code, s.label";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_status as c";
+ $sql .= " WHERE t.active > 0";
+ $sql .= " ORDER BY c.code ASC";
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+ if ($num) {
+ for ($i = 0; $i < $num; $i++) {
+ $obj = $this->db->fetch_object($resql);
+ $this->cache_status[$i]['rowid'] = $obj->rowid;
+ $this->cache_status[$i]['code'] = $obj->code;
+ $this->cache_status[$i]['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
+ }
+ return $num;
+ }
+ } else {
+ $this->error = ''.$this->db->error().'';
+ return -2;
+ }
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output an HTML select vat rate.
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 64e5b844cb0..f3dc87f41ba 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1294,6 +1294,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '';
}
+ // Traceability
+ if (empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)) {
+ print '
| '.$langs->trans("LifeTime").' | |
';
+ print '| '.$langs->trans("QCFrequency").' | |
';
+ }
// Other attributes
$parameters = array('colspan' => 3, 'cols' => '3');
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index 646f3d322d7..b797d7bccc7 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -428,6 +428,48 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '';
}
+ // Traceability info
+ if (empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)) {
+ print '| ';
+ print $form->editfieldkey($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print $form->editfieldval($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print '
';
+ print '| ';
+ print $form->editfieldkey($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print $form->editfieldval($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print '
';
+ print '| ';
+ print $form->editfieldkey($langs->trans('DestructionDate'), 'destruction_date', $object->destruction_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print $form->editfieldval($langs->trans('DestructionDate'), 'destruction_date', $object->destruction_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print '
';
+ print '| ';
+ print $form->editfieldkey($langs->trans('FirstUseDate'), 'first_use_date', $object->first_use_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print $form->editfieldval($langs->trans('FirstUseDate'), 'first_use_date', $object->first_use_date, $object, $user->rights->stock->creer, 'datepicker');
+ print ' | ';
+ print '
';
+ print '| ';
+ print $form->editfieldkey($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer, 'string');
+ print ' | ';
+ print $form->editfieldval($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer, 'string');
+ print ' | ';
+ print '
';
+ $form->load_cache_productbatch_status();
+ print '| ';
+ print $form->editfieldkey($langs->trans('Status'), 'fk_status', $form->cache_productbatch_status[$object->status], $object, $user->rights->stock->creer, 'select:productbatch_status');
+ print ' | ';
+ print $form->editfieldval($langs->trans('Status'), 'fk_status', $form->cache_productbatch_status[$object->status], $object, $user->rights->stock->creer, 'select:productbatch_status');
+ print ' | ';
+ print '
';
+ /*print '| '.$langs->trans("Status").' | select à voir |
';*/
+ }
+
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';