Skip to content

Commit 1849e61

Browse files
committed
fix(urgencyfield): default value
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent 167c43f commit 1849e61

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

inc/fields/urgencyfield.class.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public static function getName() {
6363
}
6464

6565
public function prepareQuestionInputForSave($input) {
66+
$this->value = $input['default_values'] != ''
67+
? (int) $input['default_values']
68+
: '3';
6669
return $input;
6770
}
6871

@@ -103,7 +106,7 @@ public function getAvailableValues() {
103106

104107
public function serializeValue() {
105108
if ($this->value === null || $this->value === '') {
106-
return '';
109+
return '3';
107110
}
108111

109112
return $this->value;
@@ -112,7 +115,7 @@ public function serializeValue() {
112115
public function deserializeValue($value) {
113116
$this->value = ($value !== null && $value !== '')
114117
? $value
115-
: '';
118+
: '3';
116119
}
117120

118121
public function getValueForDesign() {

inc/question.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ public static function showForForm(CommonDBTM $item, $withtemplate = '') {
264264

265265
/**
266266
* Validate form fields before add or update a question
267-
* @param Array $input Datas used to add the item
268-
* @return Array The modified $input array
267+
* @param array $input Datas used to add the item
268+
* @return array The modified $input array
269269
*/
270270
private function checkBeforeSave($input) {
271271
// Control fields values :

tests/suite-integration/PluginFormcreatorTargetTicket.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function testUrgency() {
124124
[
125125
'name' => 'custom urgency',
126126
'fieldtype' => 'urgency',
127+
'default_values' => '3',
127128
],
128129
],
129130
],

0 commit comments

Comments
 (0)