Skip to content

Commit

Permalink
feat(urgencyfield): allow empty value
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Dec 30, 2020
1 parent 17cd956 commit 0712662
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion inc/abstracttarget.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ protected function setTargetUrgency($data, $formanswer) {
$urgency = $this->fields['urgency_question'];
break;
}
if (!is_null($urgency)) {
if (!is_null($urgency) && $urgency != 0) {
$data['urgency'] = $urgency;
}

Expand Down
30 changes: 16 additions & 14 deletions inc/field/urgencyfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ public function getDesignSpecializationField(): array {
$additions .= '</td>';
$additions .= '<td>';
$additions .= Ticket::dropdownUrgency([
'name' => 'default_values',
'value' => $this->question->fields['default_values'],
'comments' => false,
'rand' => $rand,
'display' => false,
'name' => 'default_values',
'value' => $this->question->fields['default_values'],
'comments' => false,
'rand' => $rand,
'display' => false,
'display_emptychoice' => true,
]);
$additions .= '</td>';
$additions .= '<td>';
Expand All @@ -74,10 +75,10 @@ public function getDesignSpecializationField(): array {
$additions .= $common['additions'];

return [
'label' => $label,
'field' => $field,
'additions' => $additions,
'may_be_empty' => false,
'label' => $label,
'field' => $field,
'additions' => $additions,
'may_be_empty' => true,
'may_be_required' => true,
];
}
Expand All @@ -92,11 +93,12 @@ public function getRenderedHtml($canEdit = true): string {
$rand = mt_rand();
$fieldName = 'formcreator_field_' . $id;
$html .= Ticket::dropdownUrgency([
'name' => $fieldName,
'value' => $this->value,
'comments' => false,
'rand' => $rand,
'display' => false,
'name' => $fieldName,
'value' => $this->value,
'comments' => false,
'rand' => $rand,
'display' => false,
'display_emptychoice' => true,
]);
$html .= PHP_EOL;
$html .= Html::scriptBlock("$(function() {
Expand Down

0 comments on commit 0712662

Please sign in to comment.