From baa0cf6fbb983bca202cbcd96faad2224c865fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 24 Oct 2024 20:15:08 +0200 Subject: [PATCH 1/2] add filters for phpstan level 6 (#31540) --- phpstan.neon.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 96c88e5e9cc..7adab19fb1a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -116,7 +116,7 @@ parameters: - '#Call to function array_key_exists.. with .error. .* will always evaluate to false.#' - '#function dolGetButtonAction expects array\{confirm\?: array.*confirm: true} given.#' - '#(?:make_substitutions expects array,) string given\.#' - - '# (Workstation|WorkstationResource|WorkstationUserGroup|Zapier)::.* has no value type specified in iterable type array\.#' + - '# (DolibarrApiAccess|Documents|Login|Setup|Workstation|WorkstationResource|WorkstationUserGroup|Zapier)::.* has no value type specified in iterable type array\.#' internalErrorsCountLimit: 50 cache: From f9f3ffd7a28db2e21a0301e2fb60f6e691b18c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 24 Oct 2024 20:15:47 +0200 Subject: [PATCH 2/2] calculate costs of BOM for doc_generic_bom_odt (#31539) --- .../modules/bom/doc/doc_generic_bom_odt.modules.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index bfa428bb13b..f8a99d51d40 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -244,6 +244,7 @@ class doc_generic_bom_odt extends ModelePDFBom $object->fetch_thirdparty(); $object->fetch_product(); + $object->calculateCosts(); $dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; $objectref = dol_sanitizeFileName($object->ref); @@ -260,13 +261,13 @@ class doc_generic_bom_odt extends ModelePDFBom } if (file_exists($dir)) { - //print "srctemplatepath=".$srctemplatepath; // Src filename + // print "srctemplatepath=".$srctemplatepath; // Src filename $newfile = basename($srctemplatepath); $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); $newfiletmp = $objectref . '_' . $newfiletmp; - //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; + // $file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { @@ -279,10 +280,6 @@ class doc_generic_bom_odt extends ModelePDFBom $filename = $newfiletmp . '.' . $newfileformat; } $file = $dir . '/' . $filename; - //print "newdir=".$dir; - //print "newfile=".$newfile; - //print "file=".$file; - //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->bom->dir_temp); if (!is_writable($conf->bom->dir_temp)) { @@ -454,7 +451,6 @@ class doc_generic_bom_odt extends ModelePDFBom } // Call the beforeODTSave hook - $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks