edit traceability fields in productlot card

This commit is contained in:
altairis-noe 2021-04-27 15:28:39 +02:00
parent 09807706f0
commit 99df144e04
4 changed files with 284 additions and 76 deletions

View File

@ -5742,47 +5742,6 @@ 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 = '<font class="error">'.$this->db->error().'</font>';
return -2;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output an HTML select vat rate.

View File

@ -672,4 +672,129 @@ class FormProduct
}
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of productbatch status
*
* @param string $selected Id or Code of preselected incoterm
* @param string $page Defined the form action
* @param string $htmlname Name of html select object
* @param string $htmloption Options html on select object
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string HTML string with select and input
*/
public function select_productbatch_status($selected = '', $page = '', $htmlname = 'fk_status', $htmloption = '', $forcecombo = 1, $events = array())
{
// phpcs:enable
global $conf, $langs;
$langs->load("dict");
$out = '';
$statusArray = array();
$sql = "SELECT code, label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_status";
$sql .= " WHERE active > 0";
$sql .= " ORDER BY code ASC";
dol_syslog(get_class($this)."::select_productbatch_status", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($conf->use_javascript_ajax && !$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events);
}
if (!empty($page)) {
$out .= '<form method="post" action="'.$page.'">';
$out .= '<input type="hidden" name="action" value="setfk_status">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
}
$out .= '<select id="'.$htmlname.'" class="flat selectfkstatus minwidth100imp noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>';
$out .= '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
// $foundselected = false;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$statusArray[$i]['code'] = $obj->code;
$statusArray[$i]['label'] = $obj->label;
$i++;
}
foreach ($statusArray as $row) {
if ($selected && ($selected == $row['code'] || $selected == $row['label'])) {
$out .= '<option value="'.$row['code'].'" selected>';
} else {
$out .= '<option value="'.$row['code'].'">';
}
if ($row['label']) {
$out .= $row['label'];
}
$out .= '</option>';
}
}
$out .= '</select>';
// if ($user->admin) {
$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// }
if (!empty($page)) {
$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
}
} else {
dol_print_error($this->db);
}
return $out;
}
// 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;
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = "SELECT s.rowid, s.code, s.label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_status as s";
$sql .= " WHERE s.active > 0";
$sql .= " ORDER BY s.code ASC";
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($obj->code != $langs->trans($obj->code) ? $langs->trans($obj->code) : $langs->trans($obj->label));
$this->cache_productbatch_status[$obj->code] = $label;
$i++;
}
asort($this->cache_productbatch_status);
return $num;
} else {
dol_print_error($this->db);
return -1;
}
}
}

View File

@ -91,6 +91,12 @@ class Productlot extends CommonObject
'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'sellby' => array('type'=>'date', 'label'=>'SellByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_SELLBY)?1:0', 'visible'=>5, 'position'=>60),
'eol_date' => array('type'=>'date', 'label'=>'EndOfLife', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>70),
'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>80),
'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>90),
'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>100),
'qc_frequency' => array('type'=>'varchar(6)', 'label'=>'QCFrequency', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>110),
'fk_status' => array('type'=>'varchar(6)', 'label'=>'Status', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>120),
'eatby' => array('type'=>'date', 'label'=>'EatByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible'=>5, 'position'=>62),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
@ -112,6 +118,12 @@ class Productlot extends CommonObject
public $batch;
public $eatby = '';
public $sellby = '';
public $eol_date = '';
public $manufacturing_date = '';
public $scrapping_date = '';
public $commissionning_date = '';
public $qc_frequency = '';
public $fk_status = '';
public $datec = '';
public $tms = '';
@ -186,6 +198,12 @@ class Productlot extends CommonObject
$sql .= 'batch,';
$sql .= 'eatby,';
$sql .= 'sellby,';
$sql .= 'eol_date,';
$sql .= 'manufacturing_date,';
$sql .= 'scrapping_date,';
$sql .= 'commissionning_date,';
$sql .= 'qc_frequency,';
$sql .= 'fk_status,';
$sql .= 'datec,';
$sql .= 'fk_user_creat,';
$sql .= 'fk_user_modif,';
@ -196,6 +214,13 @@ class Productlot extends CommonObject
$sql .= ' '.(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").',';
$sql .= ' '.(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").',';
$sql .= ' '.(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").',';
$sql .= ' '.(!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'".$this->db->idate($this->eol_date)."'").',';
$sql .= ' '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'".$this->db->idate($this->manufacturing_date)."'").',';
$sql .= ' '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'".$this->db->idate($this->scrapping_date)."'").',';
$sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").',';
$sql .= ' '.(!isset($this->qc_frequency) ? 'NULL' : $this->qc_frequency).',';
$sql .= ' '.(!isset($this->fk_status) || dol_strlen($this->fk_status) == 0 ? 'NULL' : $this->fk_status).',';
$sql .= ' '."'".$this->db->idate(dol_now())."'".',';
$sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).',';
$sql .= ' '.(!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif).',';
@ -268,6 +293,12 @@ class Productlot extends CommonObject
$sql .= " t.batch,";
$sql .= " t.eatby,";
$sql .= " t.sellby,";
$sql .= " t.eol_date,";
$sql .= " t.manufacturing_date,";
$sql .= " t.scrapping_date,";
$sql .= " t.commissionning_date,";
$sql .= " t.qc_frequency,";
$sql .= " t.fk_status,";
$sql .= " t.datec,";
$sql .= " t.tms,";
$sql .= " t.fk_user_creat,";
@ -295,6 +326,14 @@ class Productlot extends CommonObject
$this->fk_product = $obj->fk_product;
$this->eatby = $this->db->jdate($obj->eatby);
$this->sellby = $this->db->jdate($obj->sellby);
$this->eol_date = $this->db->jdate($obj->eol_date);
$this->manufacturing_date = $this->db->jdate($obj->manufacturing_date);
$this->scrapping_date = $this->db->jdate($obj->scrapping_date);
$this->commissionning_date = $this->db->jdate($obj->commissionning_date);
$this->qc_frequency = $obj->qc_frequency;
$this->fk_status = $obj->fk_status;
$this->datec = $this->db->jdate($obj->datec);
$this->tms = $this->db->jdate($obj->tms);
$this->fk_user_creat = $obj->fk_user_creat;
@ -371,6 +410,12 @@ class Productlot extends CommonObject
$sql .= ' batch = '.(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").',';
$sql .= ' eatby = '.(!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').',';
$sql .= ' sellby = '.(!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').',';
$sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').',';
$sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').',';
$sql .= ' scrapping_date = '.(!isset($this->destruction_date) || dol_strlen($this->destruction_date) != 0 ? "'".$this->db->idate($this->destruction_date)."'" : 'null').',';
$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').',';
$sql .= ' qc_frequency = '.(!isset($this->qc_frequency) || dol_strlen($this->qc_frequency) != 0 ? "'".$this->db->escape($this->qc_frequency)."'" : 'null').',';
$sql .= ' fk_status = '.(!isset($this->fk_status) || dol_strlen($this->fk_status) != 0 ? "'".$this->db->escape($this->fk_status)."'" : 'null').',';
$sql .= ' datec = '.(!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').',';
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").',';
$sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").',';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 All-3kcis <contact@all-3kcis.fr>
* Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
// Load translation files required by the page
$langs->loadLangs(array('stocks', 'other', 'productbatch'));
@ -138,7 +140,7 @@ if (empty($reshook)) {
$backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1);
if ($action == 'seteatby' && $user->rights->stock->creer) {
if ($action == 'seteatby' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$newvalue = dol_mktime(12, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int'));
$result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
@ -149,7 +151,7 @@ if (empty($reshook)) {
}
}
if ($action == 'setsellby' && $user->rights->stock->creer) {
if ($action == 'setsellby' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$newvalue = dol_mktime(12, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int'));
$result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
@ -160,6 +162,70 @@ if (empty($reshook)) {
}
}
if ($action == 'seteol_date' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$newvalue = dol_mktime(12, 0, 0, GETPOST('eol_datemonth', 'int'), GETPOST('eol_dateday', 'int'), GETPOST('eol_dateyear', 'int'));
$result = $object->setValueFrom('eol_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, null, 'errors');
$action == 'editeol_date';
} else {
$action = 'view';
}
}
if ($action == 'setmanufacturing_date' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$newvalue = dol_mktime(12, 0, 0, GETPOST('manufacturing_datemonth', 'int'), GETPOST('manufacturing_dateday', 'int'), GETPOST('manufacturing_dateyear', 'int'));
$result = $object->setValueFrom('manufacturing_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, null, 'errors');
$action == 'editmanufacturing_date';
} else {
$action = 'view';
}
}
if ($action == 'setscrapping_date' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$newvalue = dol_mktime(12, 0, 0, GETPOST('scrapping_datemonth', 'int'), GETPOST('scrapping_dateday', 'int'), GETPOST('scrapping_dateyear', 'int'));
$result = $object->setValueFrom('scrapping_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, null, 'errors');
$action == 'editscrapping_date';
} else {
$action = 'view';
}
}
if ($action == 'setcommissionning_date' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$newvalue = dol_mktime(12, 0, 0, GETPOST('commissionning_datemonth', 'int'), GETPOST('commissionning_dateday', 'int'), GETPOST('commissionning_dateyear', 'int'));
$result = $object->setValueFrom('commissionning_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, null, 'errors');
$action == 'editcommissionning_date';
} else {
$action = 'view';
}
}
if ($action == 'setqc_frequency' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$result = $object->setValueFrom('qc_frequency', GETPOST('qc_frequency'), '', null, 'text', '', $user, 'PRODUCT_MODIFY');
if ($result < 0) { // Prévoir un test de format de durée
setEventMessages($object->error, null, 'errors');
$action == 'editqc_frequency';
} else {
$action = 'view';
}
}
if ($action == 'setfk_status' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
$result = $object->setValueFrom('fk_status', GETPOST('fk_status') ? GETPOST('fk_status') : null, '', null, 'text', '', $user, 'PRODUCT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, null, 'errors');
$action == 'editfk_status';
} else {
$action = 'view';
}
}
$triggermodname = 'PRODUCT_LOT_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
@ -308,6 +374,7 @@ if (empty($reshook)) {
$form = new Form($db);
$formfile = new FormFile($db);
$formproduct = new FormProduct($db);
$title = $langs->trans("ProductLot");
$help_url = '';
@ -430,45 +497,57 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Traceability info
if (empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)) {
print '<tr><td>';
print $form->editfieldkey($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '<tr><td>'.$form->editfieldkey($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->rights->stock->creer).'</td>';
print '<td>'.$form->editfieldval($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->rights->stock->creer, 'datepicker').'</td>';
print '</tr>';
print '<tr><td>';
print $form->editfieldkey($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '<tr><td>'.$form->editfieldkey($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->rights->stock->creer).'</td>';
print '<td>'.$form->editfieldval($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->rights->stock->creer, 'datepicker').'</td>';
print '</tr>';
print '<tr><td>';
print $form->editfieldkey($langs->trans('DestructionDate'), 'destruction_date', $object->destruction_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('DestructionDate'), 'destruction_date', $object->destruction_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '<tr><td>'.$form->editfieldkey($langs->trans('DestructionDate'), 'scrapping_date', $object->scrapping_date, $object, $user->rights->stock->creer).'</td>';
print '<td>'.$form->editfieldval($langs->trans('DestructionDate'), 'scrapping_date', $object->scrapping_date, $object, $user->rights->stock->creer, 'datepicker').'</td>';
print '</tr>';
print '<tr><td>';
print $form->editfieldkey($langs->trans('FirstUseDate'), 'first_use_date', $object->first_use_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('FirstUseDate'), 'first_use_date', $object->first_use_date, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '<tr><td>'.$form->editfieldkey($langs->trans('FirstUseDate'), 'commissionning_date', $object->commissionning_date, $object, $user->rights->stock->creer).'</td>';
print '<td>'.$form->editfieldval($langs->trans('FirstUseDate'), 'commissionning_date', $object->commissionning_date, $object, $user->rights->stock->creer, 'datepicker').'</td>';
print '</tr>';
print '<tr><td>';
print $form->editfieldkey($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer, 'string');
print '</td><td>';
print $form->editfieldval($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer, 'string');
print '</td>';
print '<tr><td>'.$form->editfieldkey($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer).'</td>';
print '<td>'.$form->editfieldval($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer, 'string').'</td>';
print '</tr>';
$form->load_cache_productbatch_status();
print '<tr><td>';
print $form->editfieldkey($langs->trans('Status'), 'fk_status', $form->cache_productbatch_status[$object->status], $object, $user->rights->stock->creer, 'select:productbatch_status');
print '</td><td>';
print $form->editfieldval($langs->trans('Status'), 'fk_status', $form->cache_productbatch_status[$object->status], $object, $user->rights->stock->creer, 'select:productbatch_status');
print '<tr>';
print '<td class="maxwidthonsmartphone">';
print $form->editfieldkey("Status", 'fk_status', $object->fk_status, $object, $user->rights->stock->creer);
print '</td>';
print '</tr>';
/*print '<tr><td>'.$langs->trans("Status").'</td><td>select à voir</td></tr>';*/
}
print '<td class="valuefield">';
if ($action != 'editfk_status') {
$formproduct->load_cache_productbatch_status();
print $formproduct->cache_productbatch_status[$object->fk_status];
} else {
// $fk_status = GETPOST('fk_status');
if (empty($fk_status)) {
$fk_status = $object->fk_status;
}
print $formproduct->select_productbatch_status($fk_status,'?id='.$object->id);
}
print '</td></tr>';
/* print '<tr><td>'.$form->editfieldkey('Status', 'fk_status', '', $object, 0);
// print_r($formproductlot->productbatch_status_array(0));
print '</td>';
print '<td>'.$form->selectarray('fk_status', $formproductlot->productbatch_status_array(0), $object->fk_status, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
if ($user->admin) {
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print '</td></tr>'; */
/* $form->load_cache_productbatch_status();
print '<tr><td>';
print implode(',',$form->cache_productbatch_status);
print $form->editfieldkey($langs->trans('Status'), 'fk_status', $langs->trans($object->laberl), $object, $user->rights->stock->creer, 'select;'.implode(',', $form->cache_productbatch_status));
print '</td><td>';
print $form->editfieldval($langs->trans('Status'), 'fk_status', $form->cache_productbatch_status[$object->label], $object, $user->rights->stock->creer, 'select;'.implode(',', $form->cache_productbatch_status));
// print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->rights->deplacement->creer, 'select:types_fees');
print '</td>';
print '</tr>'; */
}
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';