qc_status change in stock transfer -> display select

This commit is contained in:
altairis-noe 2021-04-30 11:12:33 +02:00
parent 1224327f91
commit fd42979def
3 changed files with 25 additions and 14 deletions

View File

@ -677,17 +677,15 @@ class FormProduct
* 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_qcstatus($selected = '', $page = '', $htmlname = 'fk_qcstatus', $htmloption = '', $forcecombo = 1, $events = array())
public function selectProductbatchQcstatus($selected = '', $htmlname = 'fk_qcstatus', $htmloption = '', $forcecombo = 0, $events = array())
{
// phpcs:enable
global $conf, $langs;
global $conf, $langs, $user;
$langs->load("dict");
@ -707,11 +705,11 @@ class FormProduct
$out .= ajax_combobox($htmlname, $events);
}
if (!empty($page)) {
/* 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">&nbsp;</option>';
@ -743,13 +741,13 @@ class FormProduct
}
$out .= '</select>';
// if ($user->admin) {
if ($user->admin) {
$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// }
}
if (!empty($page)) {
/* if (!empty($page)) {
$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
}
} */
} else {
dol_print_error($this->db);
}

View File

@ -512,7 +512,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
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>';
print '<tr>';
/* print '<tr>';
print '<td class="maxwidthonsmartphone">';
print $form->editfieldkey("Status", 'fk_qcstatus', $object->fk_qcstatus, $object, $user->rights->stock->creer);
print '</td>';
@ -526,7 +526,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
print $formproduct->select_productbatch_qcstatus($fk_qcstatus,'?id='.$object->id);
}
print '</td></tr>';
print '</td></tr>'; */
}
// Other attributes

View File

@ -89,8 +89,21 @@ if ($object->element == 'stock') {
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 colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</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>';
// Serial / Eat-by date
if (!empty($conf->productbatch->enabled) &&