From 7ccd50d2b8fe8ba487a6365207dbba8d147eb970 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jul 2023 12:38:27 +0200 Subject: [PATCH 1/6] Fix class not initialized --- htdocs/admin/system/security.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index dbad63d37ab..82c6cc93b8e 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -48,6 +48,8 @@ $execmethod = getDolGlobalInt('MAIN_EXEC_USE_POPEN', 1); * View */ +$form = new Form($db); + llxHeader(); print load_fiche_titre($langs->trans("Security"), '', 'title_setup'); From 01eca1eb47ed576305b78b75f0896799ceaa782a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jul 2023 12:56:11 +0200 Subject: [PATCH 2/6] Debug v18 --- htdocs/admin/system/security.php | 4 ++-- htdocs/langs/fr_FR/admin.lang | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 82c6cc93b8e..c78669a4cca 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -669,7 +669,7 @@ print '
'; print 'WEBSITE_MAIN_SECURITY_FORCESTS = '.getDolGlobalString('>WEBSITE_MAIN_SECURITY_FORCESTS', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")
"; print '
'; -print 'WEBSITE_MAIN_SECURITY_FORCEPP = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Example").": \"camera: 'none'; microphone: 'none';\")
"; +print 'WEBSITE_MAIN_SECURITY_FORCEPP = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Example").": \"camera: (); microphone: ();\")
"; print '
'; print '
'; @@ -678,7 +678,7 @@ print '
'; print load_fiche_titre($langs->trans("LimitsAndMitigation"), '', 'folder'); print ''; -print 'For a higher security, we also recommend to implement limits and mitigation on number of endpoints per minutes for the following URL'."
"; +print $langs->trans("RecommendMitigationOnURL").'
'; print '
'; print '
'; diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 98bb6acdd2a..e207fdfd8a6 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2397,3 +2397,4 @@ DefaultForTypeDesc=Modèle utilisé par défaut lors de la création d'un nouvel OptionXShouldBeEnabledInModuleY=L'option "%s" doit être activée dans le module %s OptionXIsCorrectlyEnabledInModuleY=L'option "%s" doit être activée dans le module %s AtBottomOfPage=En bas de page +RecommendMitigationOnURL=For a higher security, we also recommend to implement limits and mitigation on number of endpoints per minutes for the following URL \ No newline at end of file From 2bc6cd20ddce52234460a6d51938e8670c2967d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jul 2023 13:15:52 +0200 Subject: [PATCH 3/6] Debug v18 --- htdocs/admin/system/security.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index c78669a4cca..89161dffb3c 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -169,6 +169,12 @@ if (in_array($functiontokeep, $arrayoffunctionsdisabled)) { print ''.$functiontokeep.''; print '
'; +$arrayofstreams = stream_get_wrappers(); +if (!empty($arrayofstreams)) { + sort($arrayofstreams); + print "PHP streams = ".(join(',', $arrayofstreams)).'   ('.$langs->trans("RecommendedValueIs", 'file,http,https,php').')'."
\n"; +} + print '
'; // XDebug From 500a7e4451d89daade846f752b8d12ebcea8101e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jul 2023 23:29:20 +0200 Subject: [PATCH 4/6] Fix error must stop --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 410b35d4124..5d4e026f10a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -464,8 +464,8 @@ script: - | echo "Unit testing" - # Ensure we catch errors. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file. - set +e + # Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file. + set -e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" From b920dfdbda1a4bfc428883d3eb7fb1a9f49d6e1a Mon Sep 17 00:00:00 2001 From: onhairech <47675588+oussamanhairech@users.noreply.github.com> Date: Tue, 25 Jul 2023 23:29:34 +0200 Subject: [PATCH 5/6] qodana fix 4: missing returns (#25334) * qodana fix 4: missing returns * Delete settings.json * correcting the return info function * unreachable code fix * return fix --- htdocs/asset/class/assetaccountancycodes.class.php | 1 + htdocs/compta/facture/class/facture-rec.class.php | 1 + htdocs/compta/prelevement/class/ligneprelevement.class.php | 3 +-- htdocs/compta/sociales/class/cchargesociales.class.php | 1 + htdocs/compta/sociales/class/chargesociales.class.php | 2 ++ htdocs/core/lib/functionsnumtoword.lib.php | 2 +- htdocs/core/modules/action/rapport.class.php | 1 + htdocs/core/modules/bank/doc/pdf_ban.modules.php | 2 +- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 1 + htdocs/core/modules/facture/mod_facture_mars.php | 3 ++- htdocs/core/modules/mailings/advthirdparties.modules.php | 1 + .../core/modules/supplier_invoice/doc/pdf_canelle.modules.php | 1 + .../core/modules/supplier_payment/doc/pdf_standard.modules.php | 1 + htdocs/core/modules/takepos/mod_takepos_ref_simple.php | 3 ++- htdocs/fourn/class/fournisseur.commande.class.php | 1 + htdocs/fourn/class/fournisseur.commande.dispatch.class.php | 1 + 16 files changed, 19 insertions(+), 6 deletions(-) diff --git a/htdocs/asset/class/assetaccountancycodes.class.php b/htdocs/asset/class/assetaccountancycodes.class.php index 6c33e3af901..f52dc20a5f5 100644 --- a/htdocs/asset/class/assetaccountancycodes.class.php +++ b/htdocs/asset/class/assetaccountancycodes.class.php @@ -94,6 +94,7 @@ class AssetAccountancyCodes extends CommonObject $this->accountancy_codes[$mode_key][$field_key] = $accountancy_code; } } + return $this->accountancy_codes; } /** diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 09b2c1e6185..dc2181e8e46 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1214,6 +1214,7 @@ class FactureRec extends CommonInvoice return -1; } } + return -1; } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 6ed518f7f2f..9faafb99d84 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -126,7 +126,7 @@ class LignePrelevement * * @param int $status Id status * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto - * @return string Label + * @return null|string Label */ public function LibStatut($status, $mode = 0) { @@ -160,7 +160,6 @@ class LignePrelevement return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); } } - //return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index 741179d067e..b9b28f823b6 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -501,6 +501,7 @@ class Cchargesociales return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); } } + return ""; } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 66bd680739d..7a65b75cf58 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -730,8 +730,10 @@ class ChargeSociales extends CommonObject } $this->db->free($result); + return 1; } else { dol_print_error($this->db); + return -1; } } diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index f14295ab068..cdc288abd17 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -163,7 +163,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) * @param float $numero Number to convert * @param Translate $langs Language * @param string $numorcurrency 'number' or 'amount' - * @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99) + * @return string|int Text of the number or -1 in case TOO LONG (more than 1000000000000.99) */ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') { diff --git a/htdocs/core/modules/action/rapport.class.php b/htdocs/core/modules/action/rapport.class.php index a880b894b73..d43ebc17d01 100644 --- a/htdocs/core/modules/action/rapport.class.php +++ b/htdocs/core/modules/action/rapport.class.php @@ -215,6 +215,7 @@ class CommActionRapport return 1; } + return 0; } /** diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 2af920da42e..5996b3d50c0 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -388,6 +388,6 @@ class pdf_ban extends ModeleBankAccountDoc global $conf; $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; - //return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); + return 1; } } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index b8a58d3b517..ec409109d2d 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -1109,6 +1109,7 @@ class pdf_standard extends ModeleExpenseReport $this->error = $this->db->lasterror(); return -1; } + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index fb4ba06b9ce..91f60af5ad0 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -158,7 +158,7 @@ class mod_facture_mars extends ModeleNumRefFactures * @param Societe $objsoc Object third party * @param Facture $invoice Object invoice * @param string $mode 'next' for next value or 'last' for last value - * @return string Value if OK, 0 if KO + * @return string|int Value if OK, 0 if KO */ public function getNextValue($objsoc, $invoice, $mode = 'next') { @@ -233,6 +233,7 @@ class mod_facture_mars extends ModeleNumRefFactures return $prefix.$yymm."-".$num; } else { dol_print_error('', 'Bad parameter for getNextValue'); + return -1; } } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index ced14b802a0..111943e99e0 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -308,5 +308,6 @@ class mailing_advthirdparties extends MailingTargets $contactstatic->fetch($id); return $contactstatic->getNomUrl(0, '', 0, '', -1, 1); } + return ""; } } diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 982d7a4ba85..3dfb6bfd4d2 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -1057,6 +1057,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->error = $this->db->lasterror(); return -1; } + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index d3b9681a63f..8646ecac0c9 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -546,6 +546,7 @@ class pdf_standard extends ModelePDFSuppliersPayments // Date $pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy); $pdf->MultiCell(150, 4, date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y"), 0, 'L', 1); + return $posy; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php index 31eb9345110..2295209bb82 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php @@ -130,7 +130,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos * @param Societe $objsoc Object third party * @param Facture $invoice Object invoice * @param string $mode 'next' for next value or 'last' for last value - * @return string Next ref value or last ref if $mode is 'last' + * @return string|int Next ref value or last ref if $mode is 'last' */ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') { @@ -198,6 +198,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos return $this->prefix.$pos_source.'-'.$yymm.'-'.$num; } else { dol_print_error('', 'Bad parameter for getNextValue'); + return -1; } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5dc92c9d057..ff1964fbe9f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2100,6 +2100,7 @@ class CommandeFournisseur extends CommonOrder return -1; } } + return -1; } diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index e4bccaa0980..0b8e70ee6c3 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -609,6 +609,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); } } + return ""; } From dbed6e1221acd891f4e3be5fae2f265e6bbc8f1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jul 2023 23:42:32 +0200 Subject: [PATCH 6/6] Fix fontforpdf --- htdocs/langs/es_CU/main.lang | 2 +- htdocs/langs/zh_HK/main.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/es_CU/main.lang b/htdocs/langs/es_CU/main.lang index 7c4f5a84497..b52bef7a2ec 100644 --- a/htdocs/langs/es_CU/main.lang +++ b/htdocs/langs/es_CU/main.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - main DIRECTION=litros -FONTFORPDF=helvética +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, diff --git a/htdocs/langs/zh_HK/main.lang b/htdocs/langs/zh_HK/main.lang index bbb4ed227c4..b72b47c566c 100644 --- a/htdocs/langs/zh_HK/main.lang +++ b/htdocs/langs/zh_HK/main.lang @@ -10,7 +10,7 @@ DIRECTION=ltr # DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages # freemono is for ru_RU or uk_UA, uz_UZ # freeserif is for Tamil -FONTFORPDF=helvetica +FONTFORPDF=msungstdlight FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=,