Skip to content

Commit

Permalink
Merge pull request #1811 from nicolas-eoxia/fix_fatal_survey_list
Browse files Browse the repository at this point in the history
#1810 [Survey] fix: fatal missing check nbLinkableElements
  • Loading branch information
nicolas-eoxia authored May 21, 2024
2 parents f8a9e0a + 660f887 commit 17a6969
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions view/survey/survey_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@

$linkableElements = get_sheet_linkable_objects();

$objectPosition = 20;
$nbLinkableElements = 0;
$objectPosition = 20;
foreach($linkableElements as $linkableElementType => $linkableElement) {
$className = $linkableElement['className'];

Expand All @@ -154,6 +155,7 @@
$elementElementFields[$linkableElement['post_name']] = $linkableElement['link_name'];
$linkNameElementCorrespondence[$linkableElement['link_name']] = $linkableElement;
$objectPosition++;
$nbLinkableElements++;

if (!empty($fromtype)) {
$objectLinked = new $className($db);
Expand Down Expand Up @@ -286,7 +288,16 @@
saturne_banner_tab($objectLinked, 'fromtype=' . $fromtype . '&fromid', '', 1, 'rowid', ($fromtype == 'productbatch' ? 'batch' : 'ref'));
}

require_once __DIR__ . '/../../core/tpl/digiquali_survey_list.tpl.php';
if ($nbLinkableElements == 0) {
print '<div class="wpeo-notice notice-warning notice-red">';
print '<div class="notice-content">';
print '<a href="' . dol_buildpath('/custom/digiquali/admin/sheet.php', 2) . '">' . '<b><div class="notice-subtitle">'.$langs->trans('ConfigElementLinked') . ' : ' . $langs->trans('ConfigSheet') . '</b></a>';
print '</div>';
print '</div>';
print '</div>';
} else {
require_once __DIR__ . '/../../core/tpl/digiquali_survey_list.tpl.php';
}

// End of page
llxFooter();
Expand Down

0 comments on commit 17a6969

Please sign in to comment.