Skip to content

Commit

Permalink
Forbid empty value when updating field
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-Ngr committed Dec 3, 2024
1 parent a538388 commit 2f0d375
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions htdocs/ticket/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,19 +679,33 @@
if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $permissiontoadd) {
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));

$object->type_code = GETPOST('update_value_type', 'aZ09');
$object->severity_code = GETPOST('update_value_severity', 'aZ09');
$object->category_code = GETPOST('update_value_category', 'aZ09');
if (!GETPOST("update_value_type", 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTypeRequest")), null, 'errors');
} elseif (!GETPOST("update_value_category", 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketCategory")), null, 'errors');
} elseif (!GETPOST("update_value_severity", 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketSeverity")), null, 'errors');
}

$ret = $object->update($user);
if ($ret > 0) {
//$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);
if (!$error) {
$object->type_code = GETPOST('update_value_type', 'aZ09');
$object->severity_code = GETPOST('update_value_severity', 'aZ09');
$object->category_code = GETPOST('update_value_category', 'aZ09');

setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$ret = $object->update($user);
if ($ret > 0) {
//$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);

setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}

$action = 'view';
}

Expand Down

0 comments on commit 2f0d375

Please sign in to comment.