Skip to content

Commit

Permalink
Evarisk#4023 [Risk] fix: set date_creation of risk and evaluation the…
Browse files Browse the repository at this point in the history
… same as date_riskassessment
  • Loading branch information
evarisk-micka committed Jul 18, 2024
1 parent 6ec532f commit ccfd20c
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions view/digirisktools.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,22 @@

//Risk
foreach ($digiriskExportArray['risks'] as $digiriskExportRisk) {
$risk->ref = $refRiskMod->getNextValue($risk);
$risk->status = Risk::STATUS_VALIDATED;
$risk->category = $risk->getDangerCategoryPositionByName($digiriskExportRisk['danger_category']['name']);
$risk->fk_element = $digiriskElement->fetch_id_from_wp_digi_id($digiriskExportRisk['parent_id']);
$risk->fk_projet = $conf->global->DIGIRISKDOLIBARR_DU_PROJECT;

if ( ! $error) {
$risk->ref = $refRiskMod->getNextValue($risk);
$risk->status = Risk::STATUS_VALIDATED;
$risk->category = $risk->getDangerCategoryPositionByName($digiriskExportRisk['danger_category']['name']);
$risk->fk_element = $digiriskElement->fetch_id_from_wp_digi_id($digiriskExportRisk['parent_id']);
$risk->fk_projet = $conf->global->DIGIRISKDOLIBARR_DU_PROJECT;
$risk->date_creation = $digiriskExportRisk['evaluation']['date']['raw'];

if (!$error) {
$result = $risk->create($user, true);
if ($result > 0) {
$riskAssessment->ref = $refRiskAssessmentMod->getNextValue($riskAssessment);
$riskAssessment->date_riskassessment = $digiriskExportRisk['evaluation']['date']['raw'];
$riskAssessment->cotation = $digiriskExportRisk['current_equivalence'];
$riskAssessment->status = 1;
$riskAssessment->fk_risk = $risk->id;
$riskAssessment->date_creation = $digiriskExportRisk['evaluation']['date']['raw'];
$riskAssessment->cotation = $digiriskExportRisk['current_equivalence'];
$riskAssessment->status = RiskAssessment::STATUS_VALIDATED;
$riskAssessment->fk_risk = $risk->id;

if ($digiriskExportRisk['evaluation_method']['name'] == 'Evarisk') {
$riskassessment_variables = array_values($digiriskExportRisk['evaluation']['variables']);
Expand Down Expand Up @@ -418,19 +420,21 @@

//Risk
foreach ($digiriskExportArray['risks'] as $digiriskExportRisk) {
$risk->ref = $refRiskMod->getNextValue($risk);
$risk->status = Risk::STATUS_VALIDATED;
$risk->category = $risk->getDangerCategoryPositionByName($digiriskExportRisk['danger_category']['name']);
$risk->fk_element = $digiriskElement->fetch_id_from_wp_digi_id($digiriskExportRisk['parent_id']);
$risk->fk_projet = $conf->global->DIGIRISKDOLIBARR_DU_PROJECT;

if ( ! $error) {
$risk->ref = $refRiskMod->getNextValue($risk);
$risk->status = Risk::STATUS_VALIDATED;
$risk->category = $risk->getDangerCategoryPositionByName($digiriskExportRisk['danger_category']['name']);
$risk->fk_element = $digiriskElement->fetch_id_from_wp_digi_id($digiriskExportRisk['parent_id']);
$risk->fk_projet = $conf->global->DIGIRISKDOLIBARR_DU_PROJECT;
$risk->date_creation = $digiriskExportRisk['evaluation']['date']['raw'];

if (!$error) {
$result = $risk->create($user, true);
if ($result > 0) {
$riskAssessment->ref = $refRiskAssessmentMod->getNextValue($riskAssessment);
$riskAssessment->date_riskassessment = $digiriskExportRisk['evaluation']['date']['raw'];
$riskAssessment->date_riskassessment = $digiriskExportRisk['evaluation']['date']['raw'];
$riskAssessment->date_creation = $digiriskExportRisk['evaluation']['date']['raw'];
$riskAssessment->cotation = $digiriskExportRisk['current_equivalence'];
$riskAssessment->status = 1;
$riskAssessment->status = RiskAssessment::STATUS_VALIDATED;
$riskAssessment->fk_risk = $risk->id;

if ($digiriskExportRisk['evaluation_method']['name'] == 'Evarisk') {
Expand Down

0 comments on commit ccfd20c

Please sign in to comment.