qc_status change in stock correct -> display select
This commit is contained in:
parent
fd42979def
commit
c10b165d33
@ -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 .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="setfk_qcstatus">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
} */
|
||||
|
||||
$out .= '<select id="'.$htmlname.'" class="flat selectfkstatus minwidth100imp noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>';
|
||||
$out .= '<option value="0"> </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>';
|
||||
@ -744,10 +735,6 @@ class FormProduct
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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").',';
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -115,9 +115,12 @@ if (!empty($conf->productbatch->enabled) &&
|
||||
|| ($object->element == 'stock'))
|
||||
) {
|
||||
print '<tr>';
|
||||
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
|
||||
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td>';
|
||||
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("StatusChangeIfNeeded").'</td>';
|
||||
$formproduct->load_cache_productbatch_qcstatus();
|
||||
print '<td class="valuefield">'.$formproduct->selectProductbatchQcstatus($object->fk_qcstatus, 'fk_qcstatus').'</td></tr>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
|
||||
@ -90,20 +90,9 @@ print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
|
||||
print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
|
||||
// print '</tr>';
|
||||
// print '<tr>';
|
||||
print '<td>'.$langs->trans("StatusChangeIfNeeded").'</td>';
|
||||
print '<td class="valuefield">';
|
||||
// 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 '</td></tr>';
|
||||
$formproduct->load_cache_productbatch_qcstatus();
|
||||
print '<td class="valuefield">'.$formproduct->selectProductbatchQcstatus('0','fk_qcstatus').'</td></tr>';
|
||||
|
||||
// Serial / Eat-by date
|
||||
if (!empty($conf->productbatch->enabled) &&
|
||||
|
||||
Loading…
Reference in New Issue
Block a user