Skip to content

Commit

Permalink
Evarisk#3917 [Tools] add: handle diffence between empty and 0
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed May 30, 2024
1 parent 2717734 commit da4caca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions langs/fr_FR/digiriskdolibarr.lang
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ RisksRepartitionByDigiriskElement = Répartition des risques par

# Data - Donnée
Environment = Environnement
Riskenvironmental = Risque environnemental
RiskEnvironmentals = Risques environnementaux
Riskenvironmentals = Risques environnementaux
DigiriskElementRiskenvironmentalsList = Liste des risques environnementaux
Expand Down
8 changes: 5 additions & 3 deletions view/digirisktools.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@
if (is_array($_POST) && !empty($_POST)) {
$errors = [];
foreach($_POST as $key => $value) {
if (strstr($key, 'search_') && !empty($value) && $value >= 0 && $value <= count($dangerCategories)) {
if (strstr($key, 'search_') && dol_strlen($value) > 0 && $value >= 0 && $value <= count($dangerCategories)) {
$riskId = trim($key, 'search_');
$risk->fetch($riskId);
$result = $risk->setValueFrom('category', $value);
Expand Down Expand Up @@ -979,6 +979,7 @@
print '<tr class="liste_titre">';
print '<td class="center">' . $langs->trans('RiskCategory') . '</td>';
print '<td>' . $langs->trans('Risk') . '</td>';
print '<td>' . $langs->trans('Type') . '</td>';
print '<td>' . $langs->trans('Description') . '</td>';
print '<td>' . $langs->trans('DigiriskElement') . '</td>';
print '</tr>';
Expand Down Expand Up @@ -1020,14 +1021,15 @@
</div>
<?php
print '</td>';
print '<td>' . $risk->getNomUrl(1) . '</td>';
print '<td>' . $risk->getNomUrl(1, 'nolink') . '</td>';
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') . '">';
}
} else {
print '<td class="opacitymedium">' . $langs->trans('NoRiskToRepair') . '</td>';
print '<td colspan=3></td>';
print '<td colspan=4></td>';
$button = '<span class="butActionRefused">' . $langs->trans('RepairRisks') . '</span>';
}

Expand Down

0 comments on commit da4caca

Please sign in to comment.