Merge pull request #17512 from altairisfr/productcard_traceability_fields
Stock product card traceability fields
This commit is contained in:
commit
e2ccacd4a9
@ -33,6 +33,12 @@ CustomMasks=Adds an option to define mask in the product card
|
||||
LotProductTooltip=Adds an option in the product card to define a dedicated batch number mask
|
||||
SNProductTooltip=Adds an option in the product card to define a dedicated serial number mask
|
||||
QtyToAddAfterBarcodeScan=Qty to add for each barcode/lot/serial scanned
|
||||
LifeTime=Life span (in days)
|
||||
EndOfLife=End of life
|
||||
ManufacturingDate=Manufacturing date
|
||||
DestructionDate=Destruction date
|
||||
FirstUseDate=First use date
|
||||
QCFrequency=Quality control frequency (in days)
|
||||
|
||||
#Traceability - qc status
|
||||
OutOfOrder=Out of order
|
||||
|
||||
@ -30,8 +30,14 @@ BatchLotNumberingModules=Options pour la génération automatique de produits en
|
||||
BatchSerialNumberingModules=Options pour la génération automatique de produits en lots gérés par numéros de série
|
||||
ManageLotMask=Masque personnalisé
|
||||
CustomMasks=Ajoute une option pour définir le masque dans la fiche produit
|
||||
LotProductTooltip=Ajoute une option dans la fiche produit pour définir un masque de numéro de lot dédié
|
||||
SNProductTooltip=Ajoute une option dans la fiche produit pour définir un masque de numéro de série dédié
|
||||
QtyToAddAfterBarcodeScan=Quantité à ajouter pour chaque code à barres/lot/série scanné
|
||||
LotProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de lot
|
||||
SNProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de série
|
||||
SNProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de série
|
||||
QtyToAddAfterBarcodeScan=Quantité à ajouter pour chaque code à barres/lot/série scanné
|
||||
LifeTime=Durée de vie (en jours)
|
||||
EndOfLife=Date de fin de vie
|
||||
ManufacturingDate=Date de fabrication
|
||||
DestructionDate=Date de mise au rebut
|
||||
FirstUseDate=Date de mise en service
|
||||
QCFrequency=Periodicité de contrôle (en jours)
|
||||
InWorkingOrder=En état de marche
|
||||
OutOfOrder=Hors d’usage
|
||||
|
||||
@ -332,6 +332,8 @@ if (empty($reshook)) {
|
||||
$object->customcode = GETPOST('customcode', 'alphanohtml');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->lifetime = GETPOST('lifetime', 'int');
|
||||
$object->qc_frequency = GETPOST('qc_frequency', 'int');
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->fk_default_warehouse = GETPOST('fk_default_warehouse');
|
||||
@ -473,6 +475,8 @@ if (empty($reshook)) {
|
||||
$object->customcode = GETPOST('customcode', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->lifetime = GETPOST('lifetime', 'int');
|
||||
$object->qc_frequency = GETPOST('qc_frequency', 'int');
|
||||
$object->status = GETPOST('statut', 'int');
|
||||
$object->status_buy = GETPOST('statut_buy', 'int');
|
||||
$object->status_batch = GETPOST('status_batch', 'aZ09');
|
||||
@ -1294,6 +1298,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
// Traceability
|
||||
if ($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY) {
|
||||
print '<tr><td>'.$langs->trans("LifeTime").'</td><td><input name="lifetime" class="maxwidth100onsmartphone" value="'.GETPOST('lifetime').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("QCFrequency").'</td><td><input name="qc_frequency" class="maxwidth100onsmartphone" value="'.GETPOST('qc_frequency').'"></td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => 3, 'cols' => '3');
|
||||
@ -1530,7 +1539,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
|
||||
$type = $langs->trans('Product');
|
||||
if ($object->isService()) {
|
||||
$type = $langs->trans('Service');
|
||||
@ -1599,10 +1607,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
print '<td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
||||
if ($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') {
|
||||
$mask = !is_empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK;
|
||||
$mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK;
|
||||
}
|
||||
if ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced') {
|
||||
$mask = !is_empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK;
|
||||
$mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK;
|
||||
}
|
||||
$inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK;
|
||||
$inherited_mask_sn = $conf->global->SN_ADVANCED_MASK;
|
||||
@ -1793,6 +1801,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Traceability
|
||||
if ($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY) {
|
||||
print '<tr><td>'.$langs->trans("LifeTime").'</td><td><input name="lifetime" class="maxwidth100onsmartphone" value="'.$object->lifetime.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("QCFrequency").'</td><td><input name="qc_frequency" class="maxwidth100onsmartphone" value="'.$object->qc_frequency.'"></td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
@ -2270,6 +2284,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Traceability
|
||||
if ($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY) {
|
||||
print '<tr><td>'.$langs->trans("LifeTime").'</td><td colspan="2">'.$object->lifetime.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("QCFrequency").'</td><td colspan="2">'.$object->qc_frequency.'</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="'.(2 + (($showphoto || $showbarcode) ? 1 : 0)).'"', 'cols' => (2 + (($showphoto || $showbarcode) ? 1 : 0)));
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -1094,6 +1094,8 @@ class Product extends CommonObject
|
||||
$sql .= ", customcode = '".$this->db->escape($this->customcode)."'";
|
||||
$sql .= ", fk_country = ".($this->country_id > 0 ? (int) $this->country_id : 'null');
|
||||
$sql .= ", fk_state = ".($this->state_id > 0 ? (int) $this->state_id : 'null');
|
||||
$sql .= ", lifetime = ".($this->lifetime > 0 ? (int) $this->lifetime : 'null');
|
||||
$sql .= ", qc_frequency = ".($this->qc_frequency > 0 ? (int) $this->qc_frequency : 'null');
|
||||
$sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null');
|
||||
$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
|
||||
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -2173,7 +2175,7 @@ class Product extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.ref_ext, p.label, p.description, p.url, p.note_public, p.note as note_private, p.customcode, p.fk_country, p.fk_state, p.price, p.price_ttc,";
|
||||
$sql = "SELECT p.rowid, p.ref, p.ref_ext, p.label, p.description, p.url, p.note_public, p.note as note_private, p.customcode, p.fk_country, p.fk_state, p.lifetime, p.qc_frequency, p.price, p.price_ttc,";
|
||||
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
|
||||
$sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,";
|
||||
$sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,";
|
||||
@ -2266,6 +2268,8 @@ class Product extends CommonObject
|
||||
$this->country_id = $obj->fk_country;
|
||||
$this->country_code = getCountry($this->country_id, 2, $this->db);
|
||||
$this->state_id = $obj->fk_state;
|
||||
$this->lifetime = $obj->lifetime;
|
||||
$this->qc_frequency = $obj->qc_frequency;
|
||||
$this->price = $obj->price;
|
||||
$this->price_ttc = $obj->price_ttc;
|
||||
$this->price_min = $obj->price_min;
|
||||
|
||||
@ -91,6 +91,11 @@ 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),
|
||||
'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 +117,11 @@ 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 $datec = '';
|
||||
public $tms = '';
|
||||
|
||||
@ -186,6 +196,11 @@ 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 .= 'datec,';
|
||||
$sql .= 'fk_user_creat,';
|
||||
$sql .= 'fk_user_modif,';
|
||||
@ -196,6 +211,12 @@ 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 .= ' '."'".$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 +289,11 @@ 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.datec,";
|
||||
$sql .= " t.tms,";
|
||||
$sql .= " t.fk_user_creat,";
|
||||
@ -295,6 +321,13 @@ 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->datec = $this->db->jdate($obj->datec);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->fk_user_creat = $obj->fk_user_creat;
|
||||
@ -371,6 +404,11 @@ 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 .= ' 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").',';
|
||||
|
||||
@ -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
|
||||
@ -138,7 +139,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 +150,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 +161,60 @@ 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, 'int', '', $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';
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
@ -428,6 +483,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Traceability info
|
||||
if ($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY) {
|
||||
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>'.$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>'.$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>'.$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>'.$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, 'numeric').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user