Skip to content

Commit 8a66761

Browse files
committed
Version 0.5.0 for GLPI 9.3
1 parent 71f0789 commit 8a66761

8 files changed

+223
-138
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ See : https://github.com/tomolimo/formvalidation/wiki
1414
See wiki pages https://github.com/tomolimo/formvalidation/wiki
1515

1616
## GLPI compatibility:
17-
Tested with 0.85, 0.90, 9.1 and 9.2
17+
Tested with 0.85, 0.90, 9.1, 9.2 and 9.3
1818

formvalidation.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<author>Olivier Moron </author>
2525
</authors>
2626
<versions>
27+
<version>
28+
<num>0.5.0</num>
29+
<compatibility>9.3</compatibility>
30+
</version>
2731
<version>
2832
<num>0.4.4</num>
2933
<compatibility>9.2</compatibility>

hook.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function plugin_formvalidation_install() {
3838
$query = "CREATE TABLE `glpi_plugin_formvalidation_configs` (
3939
`id` INT(11) NOT NULL AUTO_INCREMENT,
4040
`css_mandatory` VARCHAR(200) NOT NULL DEFAULT '{\"background-color\":\"lightgrey\", \"font-weight\":\"bold\"}',
41-
`css_error` VARCHAR(200) NOT NULL DEFAULT '{\"background-color\": \"red\"}',
41+
`css_error` VARCHAR(200) NOT NULL DEFAULT '{\"background-color\": \"red\"}',
4242
PRIMARY KEY (`id`)
4343
)
4444
ENGINE=InnoDB
@@ -52,8 +52,8 @@ function plugin_formvalidation_install() {
5252
],
5353
"Error inserting default config into glpi_plugin_formvalidation_configs "
5454
);
55-
// $query = "INSERT INTO `glpi_plugin_formvalidation_configs` (`id`) VALUES (1);";
56-
// $DB->query($query) or die("Error inserting default config into glpi_plugin_formvalidation_configs " . $DB->error());
55+
// $query = "INSERT INTO `glpi_plugin_formvalidation_configs` (`id`) VALUES (1);";
56+
//$DB->query($query) or die("Error inserting default config into glpi_plugin_formvalidation_configs " . $DB->error());
5757
}
5858

5959
if (!$DB->tableExists("glpi_plugin_formvalidation_itemtypes")) {

inc/field.class.php

Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,54 +39,75 @@ static function getTypeName($nb = 0) {
3939
}
4040

4141
/**
42-
* Summary of getSearchOptions
42+
* Summary of rawSearchOptions
4343
* @return array of search options
4444
*/
45-
function getSearchOptions() {
45+
function rawSearchOptions() {
4646
global $LANG;
4747

4848
$tab = [];
4949

50-
$tab['common'] = __('Field', 'formvalidation');
51-
52-
$tab[1]['table'] = $this->getTable();
53-
$tab[1]['field'] = 'name';
54-
$tab[1]['name'] = __('Name');
55-
$tab[1]['datatype'] = 'itemlink';
56-
$tab[1]['searchtype'] = 'contains';
57-
$tab[1]['massiveaction'] = false;
58-
$tab[1]['itemlink_type'] = $this->getType();
59-
60-
$tab[8]['table'] = $this->getTable();
61-
$tab[8]['field'] = 'is_active';
62-
$tab[8]['name'] = __('Active');
63-
$tab[8]['massiveaction'] = true;
64-
$tab[8]['datatype'] = 'bool';
65-
66-
$tab[4]['table'] = $this->getTable();
67-
$tab[4]['field'] = 'comment';
68-
$tab[4]['name'] = __('Comments');
69-
$tab[4]['massiveaction'] = true;
70-
$tab[4]['datatype'] = 'text';
71-
72-
$tab[19]['table'] = $this->getTable();
73-
$tab[19]['field'] = 'date_mod';
74-
$tab[19]['name'] = __('Last update');
75-
$tab[19]['datatype'] = 'datetime';
76-
$tab[19]['massiveaction'] = false;
77-
78-
$tab[801]['table'] = 'glpi_plugin_formvalidation_forms';
79-
$tab[801]['field'] = 'name';
80-
$tab[801]['linkfield'] = 'forms_id';
81-
$tab[801]['name'] = __('Form', 'formvalidation');
82-
$tab[801]['massiveaction'] = false;
83-
$tab[801]['datatype'] = 'dropdown';
84-
85-
$tab[802]['table'] = $this->getTable();
86-
$tab[802]['field'] = 'css_selector_value';
87-
$tab[802]['name'] = __('Value CSS selector', 'formvalidation');
88-
$tab[802]['massiveaction'] = false;
89-
$tab[802]['datatype'] = 'dropdown';
50+
$tab[] = [
51+
'id' => 'common',
52+
'name' => __('Field', 'formvalidation')
53+
];
54+
$tab[] = [
55+
'id' => '1',
56+
'table' => $this->getTable(),
57+
'field' => 'name',
58+
'name' => __('Name'),
59+
'datatype' => 'itemlink',
60+
'searchtype' => 'contains',
61+
'massiveaction' => false,
62+
'itemlink_type' => 'PluginFormvalidationField'
63+
];
64+
65+
$tab[] = [
66+
'id' => '8',
67+
'table' => $this->getTable(),
68+
'field' => 'is_active',
69+
'name' => __('Active'),
70+
'massiveaction' => true,
71+
'datatype' => 'bool'
72+
];
73+
74+
$tab[] = [
75+
'id' => '4',
76+
'table' => $this->getTable(),
77+
'field' => 'comment',
78+
'name' => __('Comments'),
79+
'massiveaction' => true,
80+
'datatype' => 'text'
81+
];
82+
83+
$tab[] = [
84+
'id' => '19',
85+
'table' => $this->getTable(),
86+
'field' => 'date_mod',
87+
'name' => __('Last update'),
88+
'datatype' => 'datetime',
89+
'massiveaction' => false
90+
];
91+
92+
$tab[] = [
93+
'id' => '801',
94+
'table' => 'glpi_plugin_formvalidation_forms',
95+
'field' => 'name',
96+
'linkfield' => 'forms_id',
97+
'name' => __('Form', 'formvalidation'),
98+
'massiveaction' => false,
99+
'datatype' => 'dropdown'
100+
];
101+
102+
$tab[] = [
103+
'id' => '802',
104+
'table' => $this->getTable(),
105+
'field' => 'css_selector_value',
106+
'name' => __('Value CSS selector', 'formvalidation'),
107+
'massiveaction' => false,
108+
'datatype' => 'dropdown'
109+
];
110+
90111

91112
return $tab;
92113
}

inc/form.class.php

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,64 @@ static function canPurge(){
2121
}
2222

2323
/**
24-
* Summary of getSearchOptions
24+
* Summary of rawSearchOptions
2525
* @return mixed
2626
*/
27-
function getSearchOptions() {
27+
function rawSearchOptions() {
2828
global $LANG;
2929

3030
$tab = [];
31-
32-
$tab['common'] = __('Form', 'formvalidation');
33-
34-
$tab[1]['table'] = $this->getTable();
35-
$tab[1]['field'] = 'name';
36-
$tab[1]['name'] = __('Name');
37-
$tab[1]['datatype'] = 'itemlink';
38-
$tab[1]['searchtype'] = 'contains';
39-
$tab[1]['massiveaction'] = false;
40-
$tab[1]['itemlink_type'] = $this->getType();
41-
42-
$tab[8]['table'] = $this->getTable();
43-
$tab[8]['field'] = 'is_active';
44-
$tab[8]['name'] = __('Active');
45-
$tab[8]['massiveaction'] = true;
46-
$tab[8]['datatype'] = 'bool';
47-
48-
$tab[4]['table'] = $this->getTable();
49-
$tab[4]['field'] = 'comment';
50-
$tab[4]['name'] = __('Comments');
51-
$tab[4]['massiveaction'] = true;
52-
$tab[4]['datatype'] = 'text';
53-
54-
$tab[19]['table'] = $this->getTable();
55-
$tab[19]['field'] = 'date_mod';
56-
$tab[19]['name'] = __('Last update');
57-
$tab[19]['datatype'] = 'datetime';
58-
$tab[19]['massiveaction'] = false;
59-
60-
$tab[800]['table'] = 'glpi_plugin_formvalidation_pages';
61-
$tab[800]['field'] = 'name';
62-
$tab[800]['linkfield'] = 'pages_id';
63-
$tab[800]['name'] = __('Page', 'formvalidation');
64-
$tab[800]['massiveaction'] = false;
65-
$tab[800]['datatype'] = 'dropdown';
31+
$tab[] = [
32+
'id' => 'common',
33+
'name' => __('Form', 'formvalidation')
34+
];
35+
$tab[] = [
36+
'id' => '1',
37+
'table' => $this->getTable(),
38+
'field' => 'name',
39+
'name' => __('Name'),
40+
'datatype' => 'itemlink',
41+
'searchtype' => 'contains',
42+
'massiveaction' => false,
43+
'itemlink_type' => 'PluginFormvalidationForm'
44+
];
45+
46+
$tab[] = [
47+
'id' => '8',
48+
'table' => $this->getTable(),
49+
'field' => 'is_active',
50+
'name' => __('Active'),
51+
'massiveaction' => true,
52+
'datatype' => 'bool'
53+
];
54+
55+
$tab[] = [
56+
'id' => '4',
57+
'table' => $this->getTable(),
58+
'field' => 'comment',
59+
'name' => __('Comments'),
60+
'massiveaction' => true,
61+
'datatype' => 'text'
62+
];
63+
64+
$tab[] = [
65+
'id' => '19',
66+
'table' => $this->getTable(),
67+
'field' => 'date_mod',
68+
'name' => __('Last update'),
69+
'datatype' => 'datetime',
70+
'massiveaction' => false
71+
];
72+
73+
$tab[] = [
74+
'id' => '800',
75+
'table' => 'glpi_plugin_formvalidation_pages',
76+
'field' => 'name',
77+
'linkfield' => 'pages_id',
78+
'name' => __('Page', 'formvalidation'),
79+
'massiveaction' => false,
80+
'datatype' => 'dropdown'
81+
];
6682

6783
return $tab;
6884
}

inc/page.class.php

Lines changed: 72 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -21,59 +21,82 @@ static function canPurge(){
2121
}
2222

2323
/**
24-
* Summary of getSearchOptions
24+
* Summary of rawSearchOptions
2525
* @return mixed
2626
*/
27-
function getSearchOptions() {
27+
function rawSearchOptions() {
2828
// global $LANG;
2929

30-
$tab = [];
31-
32-
$tab['common'] = __('Page', 'formvalidation');
33-
34-
$tab[1]['table'] = $this->getTable();
35-
$tab[1]['field'] = 'name';
36-
$tab[1]['name'] = __('Title');
37-
$tab[1]['datatype'] = 'itemlink';
38-
$tab[1]['searchtype'] = 'contains';
39-
$tab[1]['massiveaction'] = false;
40-
$tab[1]['itemlink_type'] = $this->getType();
41-
42-
$tab[803]['table'] = 'glpi_plugin_formvalidation_itemtypes';
43-
$tab[803]['field'] = 'name';
44-
$tab[803]['linkfield'] = 'itemtypes_id';
45-
$tab[803]['name'] = __('Associated item type');
46-
$tab[803]['massiveaction'] = false;
47-
$tab[803]['datatype'] = 'dropdown';
48-
49-
$tab[8]['table'] = $this->getTable();
50-
$tab[8]['field'] = 'is_active';
51-
$tab[8]['name'] = __('Active');
52-
$tab[8]['massiveaction'] = true;
53-
$tab[8]['datatype'] = 'bool';
54-
55-
$tab[4]['table'] = $this->getTable();
56-
$tab[4]['field'] = 'comment';
57-
$tab[4]['name'] = __('Comments');
58-
$tab[4]['massiveaction'] = true;
59-
$tab[4]['datatype'] = 'text';
60-
61-
$tab[19]['table'] = $this->getTable();
62-
$tab[19]['field'] = 'date_mod';
63-
$tab[19]['name'] = __('Last update');
64-
$tab[19]['datatype'] = 'datetime';
65-
$tab[19]['massiveaction'] = false;
66-
67-
$tab[80]['table'] = 'glpi_entities';
68-
$tab[80]['field'] = 'completename';
69-
$tab[80]['name'] = __('Entity');
70-
$tab[80]['massiveaction'] = false;
71-
$tab[80]['datatype'] = 'dropdown';
72-
73-
$tab[86]['table'] = $this->getTable();
74-
$tab[86]['field'] = 'is_recursive';
75-
$tab[86]['name'] = __('Child entities');
76-
$tab[86]['datatype'] = 'bool';
30+
$tab = [];
31+
32+
$tab[] = [
33+
'id' => 'common',
34+
'name' => __('Page', 'formvalidation')
35+
];
36+
$tab[] = [
37+
'id' => '1',
38+
'table' => $this->getTable(),
39+
'field' => 'name',
40+
'name' => __('Name'),
41+
'datatype' => 'itemlink',
42+
'searchtype' => 'contains',
43+
'massiveaction' => false,
44+
'itemlink_type' => 'PluginFormvalidationPage'
45+
];
46+
47+
$tab[] = [
48+
'id' => '803',
49+
'table' => 'glpi_plugin_formvalidation_itemtypes',
50+
'field' => 'name',
51+
'linkfield' => 'itemtypes_id',
52+
'name' => __('Associated item type'),
53+
'massiveaction' => false,
54+
'datatype' => 'dropdown'
55+
];
56+
57+
$tab[] = [
58+
'id' => '8',
59+
'table' => $this->getTable(),
60+
'field' => 'is_active',
61+
'name' => __('Active'),
62+
'massiveaction' => true,
63+
'datatype' => 'bool'
64+
];
65+
66+
$tab[] = [
67+
'id' => '4',
68+
'table' => $this->getTable(),
69+
'field' => 'comment',
70+
'name' => __('Comments'),
71+
'massiveaction' => true,
72+
'datatype' => 'text'
73+
];
74+
75+
$tab[] = [
76+
'id' => '19',
77+
'table' => $this->getTable(),
78+
'field' => 'date_mod',
79+
'name' => __('Last update'),
80+
'datatype' => 'datetime',
81+
'massiveaction' => false
82+
];
83+
84+
$tab[] = [
85+
'id' => '80',
86+
'table' => 'glpi_entities',
87+
'field' => 'completename',
88+
'name' => __('Entity'),
89+
'massiveaction' => false,
90+
'datatype' => 'dropdown'
91+
];
92+
93+
$tab[] = [
94+
'id' => '86',
95+
'table' => $this->getTable(),
96+
'field' => 'is_recursive',
97+
'name' => __('Child entities'),
98+
'datatype' => 'bool'
99+
];
77100

78101
return $tab;
79102
}

0 commit comments

Comments
 (0)