From c10b165d337a0a0e9521f161e9f82001e8d94656 Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Fri, 30 Apr 2021 14:36:25 +0200 Subject: [PATCH] qc_status change in stock correct -> display select --- htdocs/product/class/html.formproduct.class.php | 15 +-------------- htdocs/product/stock/class/productlot.class.php | 14 +++++++------- htdocs/product/stock/productlot_card.php | 2 +- htdocs/product/stock/tpl/stockcorrection.tpl.php | 5 ++++- htdocs/product/stock/tpl/stocktransfer.tpl.php | 15 ++------------- 5 files changed, 15 insertions(+), 36 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 6f626e40244..ace2cfa0008 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -672,7 +672,7 @@ class FormProduct } } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return select list of productbatch status * @@ -705,26 +705,17 @@ class FormProduct $out .= ajax_combobox($htmlname, $events); } - /* if (!empty($page)) { - $out .= '
'; - $out .= ''; - $out .= ''; - } */ - $out .= '
'; - } */ } else { dol_print_error($this->db); } diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0fbef103d83..0d891e8eb76 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -96,7 +96,7 @@ class Productlot extends CommonObject '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_qcstatus' => array('type'=>'varchar(6)', 'label'=>'Status', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>120), + // 'fk_qcstatus' => 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), @@ -123,7 +123,7 @@ class Productlot extends CommonObject public $scrapping_date = ''; public $commissionning_date = ''; public $qc_frequency = ''; - public $fk_qcstatus = ''; + // public $fk_qcstatus = ''; public $datec = ''; public $tms = ''; @@ -203,7 +203,7 @@ class Productlot extends CommonObject $sql .= 'scrapping_date,'; $sql .= 'commissionning_date,'; $sql .= 'qc_frequency,'; - $sql .= 'fk_qcstatus,'; + // $sql .= 'fk_qcstatus,'; $sql .= 'datec,'; $sql .= 'fk_user_creat,'; $sql .= 'fk_user_modif,'; @@ -219,7 +219,7 @@ class Productlot extends CommonObject $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_qcstatus) || dol_strlen($this->fk_qcstatus) == 0 ? 'NULL' : $this->fk_qcstatus).','; + // $sql .= ' '.(!isset($this->fk_qcstatus) || dol_strlen($this->fk_qcstatus) == 0 ? 'NULL' : $this->fk_qcstatus).','; $sql .= ' '."'".$this->db->idate(dol_now())."'".','; $sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).','; @@ -298,7 +298,7 @@ class Productlot extends CommonObject $sql .= " t.scrapping_date,"; $sql .= " t.commissionning_date,"; $sql .= " t.qc_frequency,"; - $sql .= " t.fk_qcstatus,"; + // $sql .= " t.fk_qcstatus,"; $sql .= " t.datec,"; $sql .= " t.tms,"; $sql .= " t.fk_user_creat,"; @@ -332,7 +332,7 @@ class Productlot extends CommonObject $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_qcstatus = $obj->fk_qcstatus; + // $this->fk_qcstatus = $obj->fk_qcstatus; $this->datec = $this->db->jdate($obj->datec); $this->tms = $this->db->jdate($obj->tms); @@ -415,7 +415,7 @@ class Productlot extends CommonObject $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_qcstatus = '.(!isset($this->fk_qcstatus) || dol_strlen($this->fk_qcstatus) != 0 ? "'".$this->db->escape($this->fk_qcstatus)."'" : 'null').','; + // $sql .= ' fk_qcstatus = '.(!isset($this->fk_qcstatus) || dol_strlen($this->fk_qcstatus) != 0 ? "'".$this->db->escape($this->fk_qcstatus)."'" : '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").','; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 5dacea42801..06bce2a4f9d 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -207,7 +207,7 @@ if (empty($reshook)) { } if ($action == 'setqc_frequency' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) { - $result = $object->setValueFrom('qc_frequency', GETPOST('qc_frequency'), '', null, 'text', '', $user, 'PRODUCT_MODIFY'); + $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'; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 6e2ab53dd0e..f0175942511 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -115,9 +115,12 @@ if (!empty($conf->productbatch->enabled) && || ($object->element == 'stock')) ) { print ''; - print 'element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print 'element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; print ''; print ''; + print ''.$langs->trans("StatusChangeIfNeeded").''; + $formproduct->load_cache_productbatch_qcstatus(); + print ''.$formproduct->selectProductbatchQcstatus($object->fk_qcstatus, 'fk_qcstatus').''; print ''; print ''; if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 42a6f992fb8..32a197b7857 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -90,20 +90,9 @@ print ''.$langs->trans("WarehouseTarget").''; print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); print ''; print ''.$langs->trans("NumberOfUnit").''; -// print ''; -// print ''; print ''.$langs->trans("StatusChangeIfNeeded").''; -print ''; -// if ($action != 'editfk_qcstatus') { - $formproduct->load_cache_productbatch_qcstatus(); - // print $formproduct->cache_productbatch_qcstatus[$object->fk_qcstatus]; -/* } else { -if (empty($fk_qcstatus)) { - $fk_qcstatus = $object->fk_qcstatus; -} */ -print $formproduct->selectProductbatchQcstatus('-1','fk_qcstatus'); -// } -print ''; +$formproduct->load_cache_productbatch_qcstatus(); +print ''.$formproduct->selectProductbatchQcstatus('0','fk_qcstatus').''; // Serial / Eat-by date if (!empty($conf->productbatch->enabled) &&