Skip to content

Commit

Permalink
Evarisk#3917 [Tools] fix: minor change notice and repair table
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed May 30, 2024
1 parent da4caca commit 9e50788
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
21 changes: 10 additions & 11 deletions core/tpl/riskanalysis/risk/digiriskdolibarr_risklist_view.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,16 @@ class="risk-evaluation-cotation cotation"><?php echo $shownCotation; ?></div>
print '<div class="div-title-and-table-responsive">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $risk->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);

$corruptedRisks = saturne_fetch_all_object_type('Risk', '', '', 0, 0, ['customsql' => 't.category NOT BETWEEN 0 AND ' . count($dangerCategories) . ' AND t.type = "' . $riskType . '"']);

if (is_array($corruptedRisks) && !empty($corruptedRisks)) {
print '<div class="wpeo-notice notice-warning notice-red">';
print '<div class="notice-content">';
print '<a href="' . dol_buildpath('/custom/digiriskdolibarr/view/digirisktools.php', 2) . '">' . '<div class="notice-subtitle"><b>' . $langs->trans('NumberOfRisksCorrupted', count($corruptedRisks)) . ' : ' . $langs->trans('RepairRisks') . '</b></div></a>';
print '</div>';
print '</div>';
}

include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';

if ($search_all) {
Expand Down Expand Up @@ -1178,17 +1188,6 @@ class="risk-evaluation-cotation cotation"><?php echo $shownCotation; ?></div>
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
print '</tr>' . "\n";

$corruptedRisks = saturne_fetch_all_object_type('Risk', '', '', 0, 0, ['customsql' => 't.category NOT BETWEEN 0 AND ' . count($dangerCategories) . ' AND t.type = "' . $riskType . '"']);

if (is_array($corruptedRisks) && !empty($corruptedRisks)) {
print '<div class="wpeo-notice notice-warning notice-red">';
print '<div class="notice-content">';
print '<a href="' . dol_buildpath('/custom/digiriskdolibarr/view/digirisktools.php', 2) . '">' . '<b><div class="notice-subtitle">'.$langs->trans('NumberOfRisksCorrupted', count($corruptedRisks)) . ' : ' . $langs->trans('RepairRisks') . '</b></a>';
print '</div>';
print '</div>';
print '</div>';
}

// Loop on record
// --------------------------------------------------------------------

Expand Down
21 changes: 10 additions & 11 deletions view/digirisktools.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
];
list($refTaskMod) = saturne_require_objects_mod($numberingModuleName, $moduleNameLowerCase);

$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1];
$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1];

$dangerCategories = $risk->getDangerCategories();
$risk->type = 'riskenvironmental';
Expand Down Expand Up @@ -969,9 +969,9 @@
print '</table>';
print '</form>';

print load_fiche_titre($langs->trans("CorruptedCategoryOnRiskList"), '', '');
print load_fiche_titre($langs->trans('CorruptedCategoryOnRiskList'), '', '');

print '<form class="repair-category" name="repairCategory" id="repairCategory" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<form class="repair-category" name="repairCategory" id="repairCategory" action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="action" value="repair_category">';

Expand All @@ -993,23 +993,23 @@
print '<td class="center">'
?>
<div class="wpeo-dropdown dropdown-large dropdown-grid category-danger padding" style="position: inherit">
<input class="input-hidden-danger" type="hidden" name="<?php echo 'search_' . $key ?>"/>
<input class="input-hidden-danger" type="hidden" name="<?php echo 'search_' . $key ?>" />
<div class="dropdown-toggle dropdown-add-button button-cotation">
<span class="wpeo-button button-square-50 button-grey"><i class="fas fa-exclamation-triangle button-icon"></i></span>
<img class="danger-category-pic wpeo-tooltip-event hidden" src="" aria-label=""/>
<img class="danger-category-pic wpeo-tooltip-event hidden" src="" aria-label="" />
</div>
<ul class="saturne-dropdown-content wpeo-gridlayout grid-5 grid-gap-0">
<?php
if ($risk->type == 'risk') {
if (!empty($dangerCategories) ) :
if (!empty($dangerCategories)) :
foreach ($dangerCategories as $dangerCategory) : ?>
<li class="item dropdown-item wpeo-tooltip-event classfortooltip" data-is-preset="<?php echo ''; ?>" data-id="<?php echo $dangerCategory['position'] ?>" aria-label="<?php echo $dangerCategory['name'] ?>">
<img src="<?php echo DOL_URL_ROOT . '/custom/digiriskdolibarr/img/categorieDangers/' . $dangerCategory['thumbnail_name'] . '.png'?>" class="attachment-thumbail size-thumbnail photo photowithmargin" alt="" loading="lazy" width="48" height="48">
</li>
<?php endforeach;
endif;
} else {
if (!empty($environmentalCategories) ) :
if (!empty($environmentalCategories)) :
foreach ($environmentalCategories as $environmentalCategory) : ?>
<li class="item dropdown-item wpeo-tooltip-event classfortooltip" data-is-preset="<?php echo ''; ?>" data-id="<?php echo $environmentalCategory['position'] ?>" aria-label="<?php echo $environmentalCategory['name'] ?>">
<img src="<?php echo DOL_URL_ROOT . '/custom/digiriskdolibarr/img/categorieDangers/' . $environmentalCategory['thumbnail_name'] . '.png'?>" class="attachment-thumbail size-thumbnail photo photowithmargin" alt="" loading="lazy" width="48" height="48">
Expand All @@ -1025,15 +1025,14 @@
print '<td>' . $langs->trans(ucfirst($risk->type)) . '</td>';
print '<td>' . $risk->description . '</td>';
print '<td>' . $digiriskElement->getNomUrl(1, '', 0, '', -1, 1) . '</td>';
$button = '<input type="submit" class="wpeo-button button reposition" value="' . $langs->trans('RepairRisks') . '">';
print '</tr>';
}
$button = '<input type="submit" class="wpeo-button button reposition" value="' . $langs->trans('RepairRisks') . '">';
} else {
print '<td class="opacitymedium">' . $langs->trans('NoRiskToRepair') . '</td>';
print '<td colspan=4></td>';
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans('NoRiskToRepair') . '</td></tr>';
$button = '<span class="butActionRefused">' . $langs->trans('RepairRisks') . '</span>';
}

print '</tr>';
print '</table>';
print '<div class="tabsAction">';
print $button;
Expand Down

0 comments on commit 9e50788

Please sign in to comment.