Skip to content

Commit

Permalink
Evarisk#3698 [DigiriskDocument] add: every risk parent element in fil…
Browse files Browse the repository at this point in the history
…lRiskData
  • Loading branch information
evarisk-micka committed Feb 15, 2024
1 parent 6042621 commit af47a88
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions class/digiriskdocuments.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,33 @@ public function fillRiskData($odfHandler, $object, $outputlangs, $tmparray, $fil
$scale = $lastEvaluation->getEvaluationScale();

if ($scale == $i) {
$element = $activeDigiriskElements[$line->fk_element];
$element = $activeDigiriskElements[$line->fk_element];
$linked_element = $activeDigiriskElements[$line->appliedOn];
$nomElement = '';
$dash = getDolGlobalInt('DIGIRISKDOLIBARR_RISK_LIST_PARENT_VIEW') > 0;
if (getDolGlobalInt('DIGIRISKDOLIBARR_RISK_LIST_PARENT_VIEW') > 0) {
$digiriskElementIds = $activeDigiriskElements[$line->fk_element]->getBranch($line->fk_element);

if (!empty($digiriskElementIds)) {
$digiriskElementIds = array_reverse($digiriskElementIds);
array_pop($digiriskElementIds);

foreach ($digiriskElementIds as $key => $digiriskElementId) {
$nomElement .= str_repeat(' - ', count($digiriskElementIds) + 1 - $key) . $activeDigiriskElements[$digiriskElementId]->ref . ' - ' . $activeDigiriskElements[$digiriskElementId]->label . chr(0x0A) . chr(0x0A);
}
}
}

if ($conf->global->DIGIRISKDOLIBARR_SHOW_RISK_ORIGIN) {
$nomElement = (!empty($conf->global->DIGIRISKDOLIBARR_SHOW_SHARED_RISKS) ? 'S' . $element->entity . ' - ' : '') . $element->ref . ' - ' . $element->label;
$nomElement .= (!empty($conf->global->DIGIRISKDOLIBARR_SHOW_SHARED_RISKS) ? 'S' . $element->entity . ' - ' : '') . $element->ref . ' - ' . $element->label;
if ($line->fk_element != $line->appliedOn) {
$nomElement .= "\n" . $langs->trans('AppliedOn') . ' ' . $linked_element->ref . ' - ' . $linked_element->label;
$nomElement .= "\n" . ($dash > 0 ? ' - ' : '') . $langs->trans('AppliedOn') . ' ' . $linked_element->ref . ' - ' . $linked_element->label;
}
} else {
if ($linked_element->id > 0) {
$nomElement = "\n" . $linked_element->ref . ' - ' . $linked_element->label;
$nomElement .= "\n" . ($dash > 0 ? ' - ' : '') . $linked_element->ref . ' - ' . $linked_element->label;
} else {
$nomElement = "\n" . $element->ref . ' - ' . $element->label;
$nomElement .= "\n" . ($dash > 0 ? ' - ' : '') . $element->ref . ' - ' . $element->label;
}
}

Expand Down

0 comments on commit af47a88

Please sign in to comment.