Permalink
Browse files

Always call toAppriximate function, even when rolf brut are not shown.

  • Loading branch information...
cedricbonhomme committed Nov 15, 2018
1 parent 6cc941b commit f382c91fe624ea12d0c5b67c897879c359f09dd8
Showing with 6 additions and 20 deletions.
  1. +6 −20 src/MonarcFO/Service/AnrInstanceService.php
@@ -773,23 +773,12 @@ public function importFromArray($data, $anr, $idParent = null, $modeImport = 'me
],
];
$toInit = [];
if ($anr->get('showRolfBrut')) {
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_THREAT][] = 'brutProb';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutR';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutO';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutL';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutF';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutP';
} else {
$toInit = [
'brutProb',
'brutR',
'brutO',
'brutL',
'brutF',
'brutP',
];
}
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_THREAT][] = 'brutProb';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutR';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutO';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutL';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutF';
$toApproximate[\MonarcCore\Model\Entity\Scale::TYPE_IMPACT][] = 'brutP';
$k=0;
foreach ($data['risksop'] as $ro) {
// faut penser à actualiser l'anr_id, l'instance_id, l'object_id. Le risk_id quant à lui n'est pas repris dans l'export, on s'en moque donc
@@ -814,9 +803,6 @@ public function importFromArray($data, $anr, $idParent = null, $modeImport = 'me
// traitement de l'évaluation -> c'est complètement dépendant des échelles locales
if ($include_eval) {
// pas d'impact des subscales, on prend les échelles nominales
foreach ($toInit as $i) {
$toExchange[$i] = -1;
}
foreach ($toApproximate as $type => $list) {
foreach ($list as $i) {
$toExchange[$i] = $this->approximate(

0 comments on commit f382c91

Please sign in to comment.