Skip to content

Commit

Permalink
Merge pull request #25681 from FHenry/dev_quality_management_on_lot
Browse files Browse the repository at this point in the history
FIX: review quality managment on product lot
  • Loading branch information
eldy authored Aug 31, 2023
2 parents 66a8e41 + 9681ff7 commit 3211bad
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 16 deletions.
2 changes: 2 additions & 0 deletions htdocs/install/mysql/migration/18.0.0-19.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ ALTER TABLE llx_societe DROP COLUMN skype;

ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_demande_ext_payment_id (ext_payment_id);

ALTER TABLE llx_product_lot ADD COLUMN qc_frequency integer DEFAULT NULL;
ALTER TABLE llx_product_lot ADD COLUMN lifetime integer DEFAULT NULL;
2 changes: 2 additions & 0 deletions htdocs/install/mysql/tables/llx_product_lot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ CREATE TABLE llx_product_lot (
eol_date datetime NULL,
manufacturing_date datetime NULL, -- date for first use of the lot
scrapping_date datetime NULL, -- date when we decided to scrap all products of this lot
qc_frequency integer DEFAULT NULL,
lifetime integer DEFAULT NULL,
barcode varchar(180) DEFAULT NULL, -- barcode
fk_barcode_type integer DEFAULT NULL, -- barcode type
model_pdf varchar(255),
Expand Down
29 changes: 18 additions & 11 deletions htdocs/product/stock/class/productlot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ class Productlot extends CommonObject
'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1, 'picto'=>'lot'),
'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_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>70),
'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>1, 'visible'=>1, 'position'=>80),
'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'getDolGlobalInt("PRODUCT_ENABLE_TRACEABILITY", 0)', 'visible'=>5, 'position'=>90),
//'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'getDolGlobalInt("PRODUCT_ENABLE_TRACEABILITY", 0)', 'visible'=>5, 'position'=>100),
//'qc_frequency' => array('type'=>'varchar(6)', 'label'=>'QCFrequency', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_QUALITYCONTROL)?1:0', 'visible'=>5, 'position'=>110),
'eol_date' => array('type'=>'date', 'label'=>'EndOfLife', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position'=>70),
'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?5:0', 'position'=>80),
'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?5:0', 'position'=>90),
//'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY", 0)', 'visible'=>5, 'position'=>100),
'qc_frequency' => array('type'=>'integer', 'label'=>'QCFrequency', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position'=>110),
'lifetime' => array('type'=>'integer', 'label'=>'Lifetime', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position'=>110),
'eatby' => array('type'=>'date', 'label'=>'EatByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible'=>5, 'position'=>62),
'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 215),
'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'visible' => -2, 'position' => 310),
Expand Down Expand Up @@ -141,7 +142,8 @@ class Productlot extends CommonObject
public $manufacturing_date = '';
public $scrapping_date = '';
//public $commissionning_date = '';
//public $qc_frequency = '';
public $qc_frequency = '';
public $lifetime = '';
public $datec = '';
public $tms = '';

Expand Down Expand Up @@ -227,7 +229,8 @@ public function create(User $user, $notrigger = false)
$sql .= 'manufacturing_date,';
$sql .= 'scrapping_date,';
//$sql .= 'commissionning_date,';
//$sql .= 'qc_frequency,';
$sql .= 'qc_frequency,';
$sql .= 'lifetime,';
$sql .= 'datec,';
$sql .= 'fk_user_creat,';
$sql .= 'fk_user_modif,';
Expand All @@ -242,7 +245,8 @@ public function create(User $user, $notrigger = false)
$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 .= ' '.(empty($this->qc_frequency) ? 'NULL' : $this->qc_frequency).',';
$sql .= ' '.(empty($this->lifetime) ? 'NULL' : $this->lifetime).',';
$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).',';
Expand Down Expand Up @@ -316,7 +320,8 @@ public function fetch($id = 0, $product_id = 0, $batch = '')
$sql .= " t.manufacturing_date,";
$sql .= " t.scrapping_date,";
//$sql .= " t.commissionning_date,";
//$sql .= " t.qc_frequency,";
$sql .= " t.qc_frequency,";
$sql .= " t.lifetime,";
$sql .= " t.model_pdf,";
$sql .= " t.last_main_doc,";
$sql .= " t.datec,";
Expand Down Expand Up @@ -352,7 +357,8 @@ public function fetch($id = 0, $product_id = 0, $batch = '')
$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->qc_frequency = $obj->qc_frequency;
$this->lifetime = $obj->lifetime;
$this->model_pdf = $obj->model_pdf;
$this->last_main_doc = $obj->last_main_doc;

Expand Down Expand Up @@ -434,7 +440,8 @@ public function update(User $user, $notrigger = false)
$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->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'".$this->db->idate($this->scrapping_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 .= ' qc_frequency = '.(!empty($this->qc_frequency) ? (int) $this->qc_frequency : 'null').',';
$sql .= ' lifetime = '.(!empty($this->lifetime) ? (int) $this->lifetime : '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").',';
Expand Down
7 changes: 5 additions & 2 deletions htdocs/product/stock/productlot_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
print '</tr>';
}

if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABOLITY)) {
if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY)) {
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>';
Expand All @@ -503,7 +503,10 @@
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('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 '<td>'.$form->editfieldval($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->rights->stock->creer, 'string').'</td>';
print '</tr>';
print '<tr><td>'.$form->editfieldkey($langs->trans('Lifetime'), 'lifetime', $object->lifetime, $object, $user->rights->stock->creer).'</td>';
print '<td>'.$form->editfieldval($langs->trans('Lifetime'), 'lifetime', $object->lifetime, $object, $user->rights->stock->creer, 'string').'</td>';
print '</tr>';
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/stock/stats/commande_fournisseur.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
// print '</tr>';
// }
//
// if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABOLITY)) {
// if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY)) {
// 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>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/stock/stats/expedition.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
// print '</tr>';
// }
//
// if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABOLITY)) {
// if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY)) {
// 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>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/stock/stats/reception.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
// print '</tr>';
// }
//
// if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABOLITY)) {
// if (!empty($conf->global->PRODUCT_LOT_ENABLE_TRACEABILITY)) {
// 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>';
Expand Down

0 comments on commit 3211bad

Please sign in to comment.