Skip to content

Commit

Permalink
fix: add and refactor search options
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Feb 15, 2021
1 parent 2aa2c29 commit 81f4a44
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 11 deletions.
23 changes: 12 additions & 11 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '2',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'id',
'name' => __('ID'),
'searchtype' => 'contains',
Expand All @@ -135,7 +135,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '1',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'name',
'name' => __('Name'),
'datatype' => 'itemlink',
Expand All @@ -144,9 +144,10 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '4',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'description',
'name' => __('Description'),
'datatype' => 'string',
'massiveaction' => false
];

Expand All @@ -161,7 +162,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '6',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'is_recursive',
'name' => __('Recursive'),
'datatype' => 'bool',
Expand All @@ -170,7 +171,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '7',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'language',
'name' => __('Language'),
'datatype' => 'specific',
Expand All @@ -182,7 +183,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '8',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'helpdesk_home',
'name' => __('Homepage', 'formcreator'),
'datatype' => 'bool',
Expand All @@ -195,7 +196,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '9',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'access_rights',
'name' => __('Access', 'formcreator'),
'datatype' => 'specific',
Expand All @@ -217,7 +218,7 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '30',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'is_active',
'name' => __('Active'),
'datatype' => 'specific',
Expand All @@ -230,23 +231,23 @@ public function rawSearchOptions() {

$tab[] = [
'id' => '31',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'icon',
'name' => __('Icon', 'formcreator'),
'massiveaction' => false
];

$tab[] = [
'id' => '32',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'icon_color',
'name' => __('Icon color', 'formcreator'),
'massiveaction' => false
];

$tab[] = [
'id' => '33',
'table' => $this->getTable(),
'table' => $this::getTable(),
'field' => 'background_color',
'name' => __('Background color', 'formcreator'),
'massiveaction' => false
Expand Down
25 changes: 25 additions & 0 deletions inc/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,31 @@ function isEntityAssign() {
return false;
}

public function rawSearchOptions() {
$tab = parent::rawSearchOptions();

$tab[] = [
'id' => '2',
'table' => $this::getTable(),
'field' => 'id',
'name' => __('ID'),
'datatype' => 'integer',
'searchtype' => 'contains',
'massiveaction' => false
];

$tab[] = [
'id' => '3',
'table' => $this::getTable(),
'field' => 'description',
'name' => __('Description'),
'datatype' => 'string',
'massiveaction' => false
];

return $tab;
}

public static function showForForm(CommonDBTM $item, $withtemplate = '') {
$formId = $item->getID();

Expand Down
16 changes: 16 additions & 0 deletions inc/section.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ public static function getTypeName($nb = 0) {
return _n('Section', 'Sections', $nb, 'formcreator');
}

public function rawSearchOptions() {
$tab = parent::rawSearchOptions();

$tab[] = [
'id' => '2',
'table' => $this::getTable(),
'field' => 'id',
'name' => __('ID'),
'datatype' => 'integer',
'searchtype' => 'contains',
'massiveaction' => false
];

return $tab;
}

/**
* Prepare input data for adding the section
* Check fields values and get the order for the new section
Expand Down
35 changes: 35 additions & 0 deletions inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,41 @@ public static function getEnumRequestTypeRule() {
];
}

public function rawSearchOptions() {
$tab = parent::rawSearchOptions();

$tab[] = [
'id' => '2',
'table' => $this::getTable(),
'field' => 'id',
'name' => __('ID'),
'searchtype' => 'contains',
'massiveaction' => false
];

$tab[] = [
'id' => '4',
'table' => $this::getTable(),
'field' => 'Target_name',
'name' => __('Ticket title', 'formcreator'),
'datatype' => 'text',
'searchtype' => 'contains',
'massiveaction' => false
];

$tab[] = [
'id' => '5',
'table' => $this::getTable(),
'field' => 'content',
'name' => __('Ticket title', 'formcreator'),
'datatype' => 'string',
'searchtype' => 'contains',
'massiveaction' => false
];

return $tab;
}

/**
* Show the Form for the adminsitrator to edit in the config page
*
Expand Down

0 comments on commit 81f4a44

Please sign in to comment.