Skip to content

Commit fa432f7

Browse files
committed
feat(targetticket): ticket type
1 parent 14b2cf5 commit fa432f7

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

inc/targetticket.class.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function showForm($ID, $options = []) {
135135
$this->showDueDateSettings($form, $rand);
136136
echo '</tr>';
137137

138+
$this->showTypeSettings($rand);
138139
// -------------------------------------------------------------------------------------------
139140
// associated elements of the target
140141
// -------------------------------------------------------------------------------------------
@@ -648,6 +649,7 @@ public function save(PluginFormcreatorFormAnswer $formanswer) {
648649
$data = $this->setTargetCategory($data, $formanswer);
649650
$data = $this->setTargetLocation($data, $formanswer);
650651
$data = $this->setTargetAssociatedItem($data, $formanswer);
652+
$data = $this->setTargetType($data, $formanswer);
651653

652654
// There is always at least one requester
653655
$data = $this->requesters + $data;
@@ -750,8 +752,19 @@ protected function setTargetLocation($data, $formanswer) {
750752
return $data;
751753
}
752754

755+
protected function showTypeSettings($rand) {
756+
echo '<tr class="line0">';
757+
echo '<td width="15%">' . __('Type') . '</td>';
758+
echo '<td width="25%">';
759+
Ticket::dropdownType('type', ['value' => $this->fields['type'], 'rand' => $rand]);
760+
echo '</td>';
761+
echo '<td></td>';
762+
echo '<td></td>';
763+
echo '</tr>';
764+
}
765+
753766
protected function showAssociateSettings($rand) {
754-
global $DB, $CFG_GLPI;
767+
global $CFG_GLPI;
755768

756769
echo '<tr class="line0">';
757770
echo '<td width="15%">' . __('Associated elements') . '</td>';

install/mysql/plugin_formcreator_empty.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_targettickets` (
186186
`name` varchar(255) NOT NULL DEFAULT '',
187187
`plugin_formcreator_forms_id` int(11) NOT NULL,
188188
`target_name` varchar(255) NOT NULL DEFAULT '',
189+
`type` int(11) DEFAULT '1',
189190
`tickettemplates_id` int(11) DEFAULT NULL,
190191
`content` longtext,
191192
`due_date_rule` int(11) DEFAULT '1',

install/upgrade_to_2.9.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ public function upgrade(Migration $migration) {
294294
$table = 'glpi_plugin_formcreator_targettickets';
295295
$migration->addField($table, 'associate_rule', 'integer', ['after' => 'category_question', 'value' => '1']);
296296
$migration->addField($table, 'associate_question', 'integer', ['after' => 'associate_rule']);
297+
$migration->addField($table, 'type', 'integer', ['after' => 'target_name', 'value' => '1']);
297298

298299
$table = 'glpi_plugin_formcreator_forms';
299300
$migration->addField($table, 'icon', 'string', ['after' => 'is_recursive']);

0 commit comments

Comments
 (0)