qcstatus everywhere
This commit is contained in:
parent
82ae633617
commit
1224327f91
@ -684,7 +684,7 @@ class FormProduct
|
||||
* @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_status($selected = '', $page = '', $htmlname = 'fk_status', $htmloption = '', $forcecombo = 1, $events = array())
|
||||
public function select_productbatch_qcstatus($selected = '', $page = '', $htmlname = 'fk_qcstatus', $htmloption = '', $forcecombo = 1, $events = array())
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@ -695,11 +695,11 @@ class FormProduct
|
||||
$statusArray = array();
|
||||
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_qcstatus";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY code ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_productbatch_status", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_productbatch_qcstatus", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($conf->use_javascript_ajax && !$forcecombo) {
|
||||
@ -709,7 +709,7 @@ class FormProduct
|
||||
|
||||
if (!empty($page)) {
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="setfk_status">';
|
||||
$out .= '<input type="hidden" name="action" value="setfk_qcstatus">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ class FormProduct
|
||||
}
|
||||
|
||||
if ($row['label']) {
|
||||
$out .= $row['label'];
|
||||
$out .= $langs->trans($row['label']);
|
||||
}
|
||||
|
||||
$out .= '</option>';
|
||||
@ -762,7 +762,7 @@ class FormProduct
|
||||
*
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
public function load_cache_productbatch_status()
|
||||
public function load_cache_productbatch_qcstatus()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -770,7 +770,7 @@ class FormProduct
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT s.rowid, s.code, s.label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_status as s";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_productbatch_qcstatus as s";
|
||||
$sql .= " WHERE s.active > 0";
|
||||
$sql .= " ORDER BY s.code ASC";
|
||||
|
||||
@ -784,11 +784,11 @@ class FormProduct
|
||||
|
||||
// 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_status[$obj->code] = $label;
|
||||
$this->cache_productbatch_qcstatus[$obj->code] = $label;
|
||||
$i++;
|
||||
}
|
||||
|
||||
asort($this->cache_productbatch_status);
|
||||
asort($this->cache_productbatch_qcstatus);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
|
||||
@ -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_status' => 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_status = '';
|
||||
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_status,';
|
||||
$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_status) || dol_strlen($this->fk_status) == 0 ? 'NULL' : $this->fk_status).',';
|
||||
$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_status,";
|
||||
$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_status = $obj->fk_status;
|
||||
$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_status = '.(!isset($this->fk_status) || dol_strlen($this->fk_status) != 0 ? "'".$this->db->escape($this->fk_status)."'" : '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").',';
|
||||
|
||||
@ -216,11 +216,11 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setfk_status' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
|
||||
$result = $object->setValueFrom('fk_status', GETPOST('fk_status') ? GETPOST('fk_status') : null, '', null, 'text', '', $user, 'PRODUCT_MODIFY');
|
||||
if ($action == 'setfk_qcstatus' && $user->rights->stock->creer && !GETPOST('cancel', 'alpha')) {
|
||||
$result = $object->setValueFrom('fk_qcstatus', GETPOST('fk_qcstatus') ? GETPOST('fk_qcstatus') : null, '', null, 'text', '', $user, 'PRODUCT_MODIFY');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
$action == 'editfk_status';
|
||||
$action == 'editfk_qcstatus';
|
||||
} else {
|
||||
$action = 'view';
|
||||
}
|
||||
@ -514,40 +514,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->editfieldkey("Status", 'fk_status', $object->fk_status, $object, $user->rights->stock->creer);
|
||||
print $form->editfieldkey("Status", 'fk_qcstatus', $object->fk_qcstatus, $object, $user->rights->stock->creer);
|
||||
print '</td>';
|
||||
print '<td class="valuefield">';
|
||||
if ($action != 'editfk_status') {
|
||||
$formproduct->load_cache_productbatch_status();
|
||||
print $formproduct->cache_productbatch_status[$object->fk_status];
|
||||
if ($action != 'editfk_qcstatus') {
|
||||
$formproduct->load_cache_productbatch_qcstatus();
|
||||
print $formproduct->cache_productbatch_qcstatus[$object->fk_qcstatus];
|
||||
} else {
|
||||
// $fk_status = GETPOST('fk_status');
|
||||
if (empty($fk_status)) {
|
||||
$fk_status = $object->fk_status;
|
||||
if (empty($fk_qcstatus)) {
|
||||
$fk_qcstatus = $object->fk_qcstatus;
|
||||
}
|
||||
print $formproduct->select_productbatch_status($fk_status,'?id='.$object->id);
|
||||
print $formproduct->select_productbatch_qcstatus($fk_qcstatus,'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
/* print '<tr><td>'.$form->editfieldkey('Status', 'fk_status', '', $object, 0);
|
||||
// print_r($formproductlot->productbatch_status_array(0));
|
||||
print '</td>';
|
||||
print '<td>'.$form->selectarray('fk_status', $formproductlot->productbatch_status_array(0), $object->fk_status, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
|
||||
if ($user->admin) {
|
||||
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '</td></tr>'; */
|
||||
/* $form->load_cache_productbatch_status();
|
||||
print '<tr><td>';
|
||||
print implode(',',$form->cache_productbatch_status);
|
||||
print $form->editfieldkey($langs->trans('Status'), 'fk_status', $langs->trans($object->laberl), $object, $user->rights->stock->creer, 'select;'.implode(',', $form->cache_productbatch_status));
|
||||
print '</td><td>';
|
||||
print $form->editfieldval($langs->trans('Status'), 'fk_status', $form->cache_productbatch_status[$object->label], $object, $user->rights->stock->creer, 'select;'.implode(',', $form->cache_productbatch_status));
|
||||
// print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print '</td>';
|
||||
print '</tr>'; */
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user