From 8cc6d1839fe2be0d72fb4f0d4e72aeff41e35862 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Fri, 5 Apr 2024 17:36:56 +0200 Subject: [PATCH] #3693 [AuditReportDocument] fix: repair data form riskassessmentdocument --- class/digiriskdocuments.class.php | 3 +++ .../digiriskdolibarrdocuments/auditreportdocument.class.php | 6 ------ .../doc_auditreportdocument_odt.modules.php | 2 +- core/substitutions/functions_digiriskdolibarr.lib.php | 1 + 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/class/digiriskdocuments.class.php b/class/digiriskdocuments.class.php index e2f477367..9d97eba6d 100644 --- a/class/digiriskdocuments.class.php +++ b/class/digiriskdocuments.class.php @@ -90,6 +90,9 @@ public function DigiriskFillJSON() { $this->json = $this->InformationsSharingFillJSON(); break; case "auditreportdocument": + $riskAssessmentDocument = new RiskAssessmentDocument($this->db); + $this->json = $riskAssessmentDocument->RiskAssessmentDocumentFillJSON(); + break; case "riskassessmentdocument": $this->json = $this->RiskAssessmentDocumentFillJSON(); break; diff --git a/class/digiriskdolibarrdocuments/auditreportdocument.class.php b/class/digiriskdolibarrdocuments/auditreportdocument.class.php index aaff42512..72100e56f 100644 --- a/class/digiriskdolibarrdocuments/auditreportdocument.class.php +++ b/class/digiriskdolibarrdocuments/auditreportdocument.class.php @@ -24,7 +24,6 @@ // Load DigiriskDolibarr librairies require_once __DIR__ . '/../digiriskdocuments.class.php'; -require_once __DIR__ . './riskassessmentdocument.class.php'; /** * Class for AuditReportDocument @@ -51,9 +50,4 @@ public function __construct(DoliDB $db) { parent::__construct($db, $this->module, $this->element); } - - public function RiskAssessmentDocumentFillJSON() { - $riskassessmentDocument = new RiskAssessmentDocument($this->db); - return $riskassessmentDocument->RiskAssessmentDocumentFillJSON(); - } } diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/auditreportdocument/doc_auditreportdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/auditreportdocument/doc_auditreportdocument_odt.modules.php index 8dc59fd0d..99c35eba3 100644 --- a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/auditreportdocument/doc_auditreportdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/auditreportdocument/doc_auditreportdocument_odt.modules.php @@ -126,7 +126,7 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa $objectDocument->DigiriskFillJSON(); $previousObjectDocumentElement = $objectDocument->element; - $objectDocument->element = 'riskassessmentdocument@digiriskdolibarr'; + $objectDocument->element = $objectDocument->element . '@digiriskdolibarr'; complete_substitutions_array($tmpArray, $outputLangs, $objectDocument); $objectDocument->element = $previousObjectDocumentElement; diff --git a/core/substitutions/functions_digiriskdolibarr.lib.php b/core/substitutions/functions_digiriskdolibarr.lib.php index d7d2c7278..c86a10c7a 100644 --- a/core/substitutions/functions_digiriskdolibarr.lib.php +++ b/core/substitutions/functions_digiriskdolibarr.lib.php @@ -138,6 +138,7 @@ function digiriskdolibarr_completesubstitutionarray(&$substitutionarray, $langs, break; + case 'auditreportdocument@digiriskdolibarr': case 'riskassessmentdocument@digiriskdolibarr': $riskassessmentdocument = json_decode($object->json, false, 512, JSON_UNESCAPED_UNICODE)->RiskAssessmentDocument;