Skip to content

Commit

Permalink
feat(targetticket): ticket type
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Aug 22, 2019
1 parent 14b2cf5 commit fa432f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function showForm($ID, $options = []) {
$this->showDueDateSettings($form, $rand);
echo '</tr>';

$this->showTypeSettings($rand);
// -------------------------------------------------------------------------------------------
// associated elements of the target
// -------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -648,6 +649,7 @@ public function save(PluginFormcreatorFormAnswer $formanswer) {
$data = $this->setTargetCategory($data, $formanswer);
$data = $this->setTargetLocation($data, $formanswer);
$data = $this->setTargetAssociatedItem($data, $formanswer);
$data = $this->setTargetType($data, $formanswer);

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

protected function showTypeSettings($rand) {
echo '<tr class="line0">';
echo '<td width="15%">' . __('Type') . '</td>';
echo '<td width="25%">';
Ticket::dropdownType('type', ['value' => $this->fields['type'], 'rand' => $rand]);
echo '</td>';
echo '<td></td>';
echo '<td></td>';
echo '</tr>';
}

protected function showAssociateSettings($rand) {
global $DB, $CFG_GLPI;
global $CFG_GLPI;

echo '<tr class="line0">';
echo '<td width="15%">' . __('Associated elements') . '</td>';
Expand Down
1 change: 1 addition & 0 deletions install/mysql/plugin_formcreator_empty.sql
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_targettickets` (
`name` varchar(255) NOT NULL DEFAULT '',
`plugin_formcreator_forms_id` int(11) NOT NULL,
`target_name` varchar(255) NOT NULL DEFAULT '',
`type` int(11) DEFAULT '1',
`tickettemplates_id` int(11) DEFAULT NULL,
`content` longtext,
`due_date_rule` int(11) DEFAULT '1',
Expand Down
1 change: 1 addition & 0 deletions install/upgrade_to_2.9.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ public function upgrade(Migration $migration) {
$table = 'glpi_plugin_formcreator_targettickets';
$migration->addField($table, 'associate_rule', 'integer', ['after' => 'category_question', 'value' => '1']);
$migration->addField($table, 'associate_question', 'integer', ['after' => 'associate_rule']);
$migration->addField($table, 'type', 'integer', ['after' => 'target_name', 'value' => '1']);

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

0 comments on commit fa432f7

Please sign in to comment.