|
28 | 28 | $fields = $form['prepared']; |
29 | 29 |
|
30 | 30 | /* Parameters */ |
31 | | - $columnTitlesNames = $param['columntitles'] ?? null; |
32 | | - $columnTitlesNames = array_filter( |
33 | | - array_map('trim', explode(',', trim($columnTitlesNames))), |
34 | | - function ($name) { |
35 | | - return !empty($name); |
36 | | - } |
37 | | - ); |
| 31 | + foreach([ |
| 32 | + 'columntitles' => 'columnTitlesNames', |
| 33 | + 'columnfieldsids' => 'columnFieldsIdsRaw', |
| 34 | + 'sumfieldsids' => 'sumFieldsIds', |
| 35 | + ] as $paramKey => $varName){ |
| 36 | + $tmp = (isset($param[$paramKey]) && is_string($param[$paramKey])) ? $param[$paramKey] : ""; |
| 37 | + $tmp = array_filter( |
| 38 | + array_map('trim', explode(',', trim($tmp))), |
| 39 | + function ($name) { |
| 40 | + return !empty($name); |
| 41 | + } |
| 42 | + ); |
| 43 | + extract([$varName => $tmp]); |
| 44 | + } |
38 | 45 |
|
39 | | - $columnFieldsIdsRaw = $param['columnfieldsids'] ?? null; |
40 | | - $columnFieldsIdsRaw = array_filter( |
41 | | - array_map('trim', explode(',', trim($columnFieldsIdsRaw))), |
42 | | - function ($id) { |
43 | | - return !empty($id); |
44 | | - } |
45 | | - ); |
46 | 46 |
|
47 | 47 | $checkboxFieldsInColumns = $param['checkboxfieldsincolumns'] ?? null; |
48 | 48 | $checkboxFieldsInColumns = !in_array($checkboxFieldsInColumns, ["0",0,false,"false","non"], true); |
49 | 49 |
|
50 | | - $sumFieldsIds = $param['sumfieldsids'] ?? null; |
51 | | - $sumFieldsIds = array_filter( |
52 | | - array_map('trim', explode(',', trim($sumFieldsIds))), |
53 | | - function ($id) { |
54 | | - return !empty($id); |
55 | | - } |
56 | | - ); |
57 | | - |
58 | 50 | foreach(['displayadmincol','displaycreationdate','displaylastchangedate','displayowner'] as $paramName){ |
59 | 51 | $paramValue = (!empty($param[$paramName]) && in_array($param[$paramName], ['yes','onlyadmins'], true)) ? $param[$paramName] : false; |
60 | 52 | switch ($paramValue) { |
|
229 | 221 | unset($fiches[$index]); |
230 | 222 | } else { |
231 | 223 | foreach($form['prepared'] as $field){ |
232 | | - if ((empty(trim($field->renderStaticIfPermitted($fiche))))){ |
| 224 | + if (empty($field->renderStaticIfPermitted($fiche)) || |
| 225 | + empty(trim($field->renderStaticIfPermitted($fiche)))){ |
233 | 226 | $fiches[$index][$field->getPropertyName()] = ""; |
234 | 227 | } else if ($field instanceof EmailField){ |
235 | 228 | $fiches[$index][$field->getPropertyName()] = "***@***.***"; |
|
0 commit comments