From 16f3f6b4a4926c3c11ae84ed153f30f22896dad9 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 1 Feb 2022 11:58:30 +0100 Subject: [PATCH] [ODT] fix: generate document dont work correctly because missing argument in function write file --- class/digiriskelement.class.php | 54 ++++++++++--------- .../doc_firepermitdocument_odt.modules.php | 17 +++--- .../doc_groupmentdocument_odt.modules.php | 17 +++--- .../doc_listingrisksaction_odt.modules.php | 17 +++--- .../doc_listingrisksphoto_odt.modules.php | 17 +++--- ...doc_preventionplandocument_odt.modules.php | 17 +++--- ...ntionplandocument_specimen_odt.modules.php | 17 +++--- ...doc_riskassessmentdocument_odt.modules.php | 17 +++--- .../doc_workunitdocument_odt.modules.php | 17 +++--- workflow/phpDocumentor | 1 - 10 files changed, 110 insertions(+), 81 deletions(-) delete mode 160000 workflow/phpDocumentor diff --git a/class/digiriskelement.class.php b/class/digiriskelement.class.php index 8ddd3ef18..7e724460a 100644 --- a/class/digiriskelement.class.php +++ b/class/digiriskelement.class.php @@ -367,30 +367,36 @@ public function info($id) } } -// public function getRiskAssessmentCategoriesNumber() -// { -// $risk = new Risk($this->db); -// $risks = $risk->fetchFromParent($this->id); -// $scale_counter = array( -// 1 => 0, -// 2 => 0, -// 3 => 0, -// 4 => 0 -// ); -// if ( ! empty($risks) && $risks > 0) { -// foreach ($risks as $risk) { -// $riskassessment = new RiskAssessment($this->db); -// $riskassessment = $riskassessment->fetchFromParent($risk->id, 1); -// if ( ! empty($riskassessment) && $riskassessment > 0) { -// $riskassessment = array_shift($riskassessment); -// $scale = $riskassessment->get_evaluation_scale(); -// $scale_counter[$scale] += 1; -// } -// } -// } -// -// return $scale_counter; -// } + /** + * Get riskassessment categorires number + * + * @return array + * @throws Exception + */ + public function getRiskAssessmentCategoriesNumber() + { + $risk = new Risk($this->db); + $risks = $risk->fetchFromParent($this->id); + $scale_counter = array( + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0 + ); + if ( ! empty($risks) && $risks > 0) { + foreach ($risks as $risk) { + $riskassessment = new RiskAssessment($this->db); + $riskassessment = $riskassessment->fetchFromParent($risk->id, 1); + if ( ! empty($riskassessment) && $riskassessment > 0) { + $riskassessment = array_shift($riskassessment); + $scale = $riskassessment->get_evaluation_scale(); + $scale_counter[$scale] += 1; + } + } + } + + return $scale_counter; + } /** * Output html form to select a third party. diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php index df91d1891..9885d38ae 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php @@ -226,14 +226,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param FirePermitDocument $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $firepermit - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param FirePermitDocument $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param FirePermit $firepermit FirePermit object + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $firepermit) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $firepermit) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php index f57f24808..230b8bc20 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php @@ -225,14 +225,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param GroupmentDocument $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $digiriskelement - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param GroupmentDocument $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param DigiriskElement $digiriskelement Object for get DigiriskElement info + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $digiriskelement) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $digiriskelement) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php index c3faa0f34..7bec2d81d 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php @@ -221,14 +221,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param ListingRisksAction $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $digiriskelement - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param ListingRisksAction $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param DigiriskElement $digiriskelement Object for get DigiriskElement info + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $digiriskelement) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $digiriskelement) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php index 542cf6a2e..c8f9039a1 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php @@ -222,14 +222,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param ListingRisksPhoto $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $digiriskelement - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param ListingRisksPhoto $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param DigiriskElement $digiriskelement Object for get DigiriskElement info + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $digiriskelement) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $digiriskelement) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php index 3741a5567..6c08eb95f 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php @@ -226,14 +226,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param PreventionPlanDocument $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $preventionplan - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param PreventionPlanDocument $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param PreventionPlan $preventionplan PreventionPlan Object + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $preventionplan) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $preventionplan) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php index af72029c6..8933ee784 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php @@ -226,14 +226,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param PreventionPlanDocument $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $preventionplan - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param PreventionPlanDocument $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param PreventionPlan $preventionplan PreventionPlan Object + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $preventionplan) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $preventionplan) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php index 303dbf81d..ede46294e 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php @@ -227,14 +227,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param RiskAssessmentDocument $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $digiriskelement - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param RiskAssessmentDocument $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param DigiriskElement $digiriskelement Object for get DigiriskElement info + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $digiriskelement) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $digiriskelement) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php index 5bb699ac0..a783b6939 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php @@ -226,14 +226,17 @@ public function info($langs) /** * Function to build a document on disk using the generic odt module. * - * @param WorkUnitDocument $object Object source to build document - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param $digiriskelement - * @return int 1 if OK, <=0 if KO - * @throws Exception + * @param WorkUnitDocument $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param DigiriskElement $digiriskelement Object for get DigiriskElement info + * @return int 1 if OK, <=0 if KO + * @throws Exception */ - public function write_file($object, $outputlangs, $srctemplatepath, $digiriskelement) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $digiriskelement) { // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; diff --git a/workflow/phpDocumentor b/workflow/phpDocumentor deleted file mode 160000 index 2f288a1a9..000000000 --- a/workflow/phpDocumentor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2f288a1a9a0478a8c7c233d7d1847224f2458a0d