@@ -30,7 +30,6 @@ static function canPurge() {
30
30
* @return string translation
31
31
*/
32
32
static function getTypeName ($ nb = 0 ) {
33
- global $ LANG ;
34
33
35
34
if ($ nb >1 ) {
36
35
return __ ('Fields ' , 'formvalidation ' );
@@ -43,7 +42,6 @@ static function getTypeName($nb = 0) {
43
42
* @return array of search options
44
43
*/
45
44
function rawSearchOptions () {
46
- global $ LANG ;
47
45
48
46
$ tab = [];
49
47
@@ -111,11 +109,7 @@ function rawSearchOptions() {
111
109
return $ tab ;
112
110
}
113
111
114
- /**
115
- * @since version 0.85
116
- *
117
- * @see CommonGLPI::getTabNameForItem()
118
- **/
112
+
119
113
/**
120
114
* Summary of getTabNameForItem
121
115
* @param CommonGLPI $item
@@ -172,18 +166,14 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem
172
166
* @param mixed $ids
173
167
* @param mixed $crit
174
168
* @param mixed $tree
175
- * @return mixed
169
+ * @return
176
170
*/
177
171
static function getDataForForm (PluginFormvalidationForm $ form , &$ members , &$ ids , $ crit = '' , $ tree = 0 ) {
178
172
global $ DB ;
179
173
180
- $ entityrestrict = 0 ;
181
-
182
- $ restrict = "=' " .$ form ->getID ()."' " ;
183
-
184
174
$ res = $ DB ->request ([
185
- 'SELECT DISTINCT ' => ' glpi_plugin_formvalidation_fields.id ' ,
186
- ' FIELDS ' => [
175
+ 'SELECT ' => [
176
+ ' glpi_plugin_formvalidation_fields.id ' ,
187
177
'glpi_plugin_formvalidation_fields.id AS linkID ' ,
188
178
'glpi_plugin_formvalidation_fields.name ' ,
189
179
'glpi_plugin_formvalidation_fields.css_selector_value ' ,
@@ -193,31 +183,14 @@ static function getDataForForm(PluginFormvalidationForm $form, &$members, &$ids,
193
183
'glpi_plugin_formvalidation_fields.show_mandatory_if ' ,
194
184
'glpi_plugin_formvalidation_fields.forms_id '
195
185
],
196
- 'FROM ' => 'glpi_plugin_formvalidation_fields ' ,
197
- 'WHERE ' => [
186
+ 'DISTINCT ' => true ,
187
+ 'FROM ' => 'glpi_plugin_formvalidation_fields ' ,
188
+ 'WHERE ' => [
198
189
'glpi_plugin_formvalidation_fields.forms_id ' => $ form ->getID ()
199
190
],
200
- 'ORDER ' => 'glpi_plugin_formvalidation_fields.id '
191
+ 'ORDER ' => 'glpi_plugin_formvalidation_fields.id '
201
192
]);
202
- //// All group members
203
- //$query = "SELECT DISTINCT `glpi_plugin_formvalidation_fields`.`id`,
204
- // `glpi_plugin_formvalidation_fields`.`id` AS linkID,
205
- // `glpi_plugin_formvalidation_fields`.`name`,
206
- // `glpi_plugin_formvalidation_fields`.`css_selector_value`,
207
- // `glpi_plugin_formvalidation_fields`.`formula`,
208
- // `glpi_plugin_formvalidation_fields`.`is_active`,
209
- // `glpi_plugin_formvalidation_fields`.`show_mandatory`,
210
- // `glpi_plugin_formvalidation_fields`.`show_mandatory_if`,
211
- // `glpi_plugin_formvalidation_fields`.`forms_id`
212
- // FROM `glpi_plugin_formvalidation_fields`
213
- // WHERE `glpi_plugin_formvalidation_fields`.`forms_id` $restrict
214
- // ORDER BY `glpi_plugin_formvalidation_fields`.`id`";
215
-
216
- //$result = $DB->query($query);
217
-
218
- //if ($DB->numrows($result) > 0) {
219
- // while ($data=$DB->fetch_assoc($result)) {
220
- foreach ($ res as $ data ) {
193
+ foreach ($ res as $ data ) {
221
194
// Add to display list, according to criterion
222
195
if (empty ($ crit ) || $ data [$ crit ]) {
223
196
$ members [] = $ data ;
@@ -227,9 +200,7 @@ static function getDataForForm(PluginFormvalidationForm $form, &$members, &$ids,
227
200
$ ids [] = $ data ['id ' ];
228
201
}
229
202
}
230
- //}
231
203
232
- return $ entityrestrict ;
233
204
}
234
205
235
206
/**
@@ -240,15 +211,15 @@ static function getDataForForm(PluginFormvalidationForm $form, &$members, &$ids,
240
211
/**
241
212
* Summary of showForForm
242
213
* @param PluginFormvalidationForm $form
243
- * @return boolean
214
+ * @return
244
215
*/
245
216
static function showForForm (PluginFormvalidationForm $ form ) {
246
- global $ DB , $ LANG , $ CFG_GLPI ;
217
+ global $ DB , $ CFG_GLPI ;
247
218
248
219
$ ID = $ form ->getID ();
249
220
if (!PluginFormvalidationField::canView ()
250
221
|| !$ form ->can ($ ID , READ )) {
251
- return false ;
222
+ return ;
252
223
}
253
224
254
225
// Have right to manage members
@@ -259,7 +230,7 @@ static function showForForm(PluginFormvalidationForm $form) {
259
230
$ ids = [];
260
231
261
232
// Retrieve member list
262
- $ entityrestrict = self ::getDataForForm ($ form , $ used , $ ids );
233
+ self ::getDataForForm ($ form , $ used , $ ids );
263
234
264
235
$ number = count ($ used );
265
236
@@ -373,7 +344,7 @@ function defineTabs($options = []) {
373
344
* @param mixed $options
374
345
*/
375
346
function showForm ($ ID , $ options = ['candel ' =>false ]) {
376
- global $ DB , $ CFG_GLPI , $ LANG ;
347
+ global $ DB , $ CFG_GLPI ;
377
348
378
349
if ($ ID > 0 ) {
379
350
$ this ->check ($ ID , READ );
0 commit comments