Skip to content

Commit 5407944

Browse files
J9remmrflos
authored andcommitted
fix(tableau.tpl.html): remove warnings
1 parent e0b38a4 commit 5407944

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

tools/bazar/presentation/templates/tableau.tpl.html

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,25 @@
2828
$fields = $form['prepared'];
2929

3030
/* 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+
}
3845

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-
);
4646

4747
$checkboxFieldsInColumns = $param['checkboxfieldsincolumns'] ?? null;
4848
$checkboxFieldsInColumns = !in_array($checkboxFieldsInColumns, ["0",0,false,"false","non"], true);
4949

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-
5850
foreach(['displayadmincol','displaycreationdate','displaylastchangedate','displayowner'] as $paramName){
5951
$paramValue = (!empty($param[$paramName]) && in_array($param[$paramName], ['yes','onlyadmins'], true)) ? $param[$paramName] : false;
6052
switch ($paramValue) {
@@ -229,7 +221,8 @@
229221
unset($fiches[$index]);
230222
} else {
231223
foreach($form['prepared'] as $field){
232-
if ((empty(trim($field->renderStaticIfPermitted($fiche))))){
224+
if (empty($field->renderStaticIfPermitted($fiche)) ||
225+
empty(trim($field->renderStaticIfPermitted($fiche)))){
233226
$fiches[$index][$field->getPropertyName()] = "";
234227
} else if ($field instanceof EmailField){
235228
$fiches[$index][$field->getPropertyName()] = "***@***.***";

0 commit comments

Comments
 (0)