mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 08:32:53 +01:00
qcstatus out of formproduct and corrections in syntax
This commit is contained in:
@@ -1607,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 = !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 = !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;
|
||||
@@ -1802,7 +1802,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Traceability
|
||||
if (empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)) {
|
||||
if ( empty($conf->global->PRODUCT_DISABLE_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>';
|
||||
}
|
||||
@@ -2285,7 +2285,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Traceability
|
||||
if (empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)) {
|
||||
if ( empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)) {
|
||||
print '<tr><td>'.$langs->trans("LifeTime").'</td><td colspan="2">'.$object->lifetime.' ';
|
||||
!empty($object->lifetime) ? print $langs->trans('Days') : print '';
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -672,114 +672,4 @@ class FormProduct
|
||||
}
|
||||
}
|
||||
}
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return select list of productbatch status
|
||||
*
|
||||
* @param string $selected Id or Code of preselected incoterm
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption Options html on select object
|
||||
* @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 selectProductbatchQcstatus($selected = '', $htmlname = 'fk_qcstatus', $htmloption = '', $forcecombo = 0, $events = array())
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
$out = '';
|
||||
$statusArray = array();
|
||||
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_qcstatus";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY code ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_productbatch_qcstatus", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($conf->use_javascript_ajax && !$forcecombo) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname, $events);
|
||||
}
|
||||
|
||||
$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) {
|
||||
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>';
|
||||
} else {
|
||||
$out .= '<option value="'.$row['code'].'">';
|
||||
}
|
||||
|
||||
if ($row['label']) {
|
||||
$out .= $langs->trans($row['label']);
|
||||
}
|
||||
|
||||
$out .= '</option>';
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
|
||||
if ($user->admin) {
|
||||
$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load into the cache productbatch status
|
||||
*
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
public function load_cache_productbatch_qcstatus()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT s.rowid, s.code, s.label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_qcstatus as s";
|
||||
$sql .= " WHERE s.active > 0";
|
||||
$sql .= " ORDER BY s.code ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$label = ($obj->code != $langs->trans($obj->code) ? $langs->trans($obj->code) : $langs->trans($obj->label));
|
||||
$this->cache_productbatch_qcstatus[$obj->code] = $label;
|
||||
$i++;
|
||||
}
|
||||
|
||||
asort($this->cache_productbatch_qcstatus);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user