Debug v20

This commit is contained in:
Laurent Destailleur 2024-09-09 03:52:25 +02:00
commit 3e9a0cfa99
5 changed files with 28 additions and 9 deletions

View File

@ -4644,8 +4644,8 @@ abstract class CommonObject
$fieldstatus = 'status';
}
$sql = "UPDATE ".$this->db->prefix().$elementTable;
$sql .= " SET ".$fieldstatus." = ".((int) $status);
$sql = "UPDATE ".$this->db->prefix().$this->db->sanitize($elementTable);
$sql .= " SET ".$this->db->sanitize($fieldstatus)." = ".((int) $status);
// If status = 1 = validated, update also fk_user_valid
// TODO Replace the test on $elementTable by doing a test on existence of the field in $this->fields
if ($status == 1 && in_array($elementTable, array('expensereport', 'inventory'))) {
@ -4690,6 +4690,8 @@ abstract class CommonObject
}
}
$this->context = array_merge($this->context, array('newstatus' => $status));
if ($trigkey) {
// Call trigger
$result = $this->call_trigger($trigkey, $user);

View File

@ -1902,9 +1902,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$.each(data, function (key, value) {
if(selectwarehouse.val() == -1) {
var label = " (<?php echo $langs->trans('Stock total') ?> : " + value + ")";
var label = key + " (<?php echo $langs->trans('Stock total') ?> : " + value + ")";
} else {
var label = " (<?php echo $langs->trans('Stock') ?> : " + value + ")";
var label = key + " (<?php echo $langs->trans('Stock') ?> : " + value + ")";
}
if(key === selectedbatch) {

View File

@ -792,7 +792,7 @@ class FormProduct
*/
public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array())
{
global $langs, $hookmanager;
global $conf, $langs, $hookmanager;
dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot", LOG_DEBUG);
@ -842,7 +842,8 @@ class FormProduct
if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) {
$label = $arraytypes['entrepot_label'] . ' - ';
$label .= $arraytypes['batch'];
$out .= '<option data-warehouse="'.dol_escape_htmltag($label).'" value="' . $arraytypes['batch'] . '">(' . $langs->trans('Stock Total') . ': ' . $arraytypes['qty'] . ')</option>';
// Notice: Chrome show 1 line with value and 1 for label. Firefox show only 1 line with label
$out .= '<option data-warehouse="'.dol_escape_htmltag($label).'" value="' . $arraytypes['batch'] . '">' . ($conf->browser->name === 'chrome' ? '' : $arraytypes['batch']) . ' (' . $langs->trans('Stock Total') . ': ' . $arraytypes['qty'] . ')</option>';
}
}
}

View File

@ -1938,6 +1938,22 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
min-width: 100px;
}
/* Disabled: Has no effect, even on chrome
datalist option {
width: 300px;
}
datalist {
position: absolute;
width: 200px;
max-height: 150px;
overflow-y: auto;
background-color: white;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
*/
/* Force values for small screen 768 */
@media only screen and (max-width: 768px)

View File

@ -544,9 +544,9 @@ if (empty($reshook)) {
// prevent browser refresh from reopening ticket several times
if ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED) {
if ($object->fk_user_assign != null) {
$res = $object->setStatut(Ticket::STATUS_ASSIGNED);
$res = $object->setStatut(Ticket::STATUS_ASSIGNED, null, '', 'TICKET_MODIFY');
} else {
$res = $object->setStatut(Ticket::STATUS_NOT_READ);
$res = $object->setStatut(Ticket::STATUS_NOT_READ, null, '', 'TICKET_MODIFY');
}
if ($res) {
$url = 'card.php?track_id=' . $object->track_id;
@ -1440,7 +1440,7 @@ if ($action == 'create' || $action == 'presend') {
}
// Close ticket if status is read
if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ticket', 'write')) {
if (isset($object->status) && $object->status >= 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ticket', 'write')) {
print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, '');
}