From 542a4fb0607915e55d3d3297da4cc6f962f81d16 Mon Sep 17 00:00:00 2001 From: ems-co Date: Thu, 17 Oct 2024 02:03:51 +0300 Subject: [PATCH 01/26] Update list.php (#31430) --- htdocs/societe/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index f968f7c4672..bf1f86cc7b5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1827,6 +1827,7 @@ while ($i < $imaxinloop) { $userstatic->user_mobile = $val['user_mobile']; $userstatic->job = $val['job']; $userstatic->gender = $val['gender']; + $userstatic->statut = $val['statut']; print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); $j++; if ($j < $nbofsalesrepresentative) { From 202263dbb52e2e8d77e1d24ce998a928119a0ecb Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:04:36 +0300 Subject: [PATCH 02/26] fix PDF proposal signature area (#31420) * fix signature * fix signature --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index a66489366ee..2f5bc39610b 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1758,7 +1758,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 2); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); - $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->SetXY($posx, $tab_top + $tab_hl + 3); $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { $pdf->addEmptySignatureAppearance($posx, $tab_top + $tab_hl, $largcol, $tab_hl * 3); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index b9617aa6ed0..dba0f3c90f1 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1824,7 +1824,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 2); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); - $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->SetXY($posx, $tab_top + $tab_hl + 3); $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { $pdf->addEmptySignatureAppearance($posx, $tab_top + $tab_hl, $largcol, $tab_hl * 3); From 7903a8b7804780d9395d1a49004c63ce27cb5a93 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:14:26 +0300 Subject: [PATCH 03/26] fix typo (#31418) --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 09c7e82c1f5..2b11fbd3ff6 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2616,7 +2616,7 @@ class pdf_sponge extends ModelePDFFactures $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_HIDE_PRICE_EXCL_TAX') ? true : false, + 'status' => !getDolGlobalString('PDF_INVOICE_HIDE_PRICE_EXCL_TAX') ? true : false, 'title' => array( 'textkey' => 'TotalHTShort' ), @@ -2627,7 +2627,7 @@ class pdf_sponge extends ModelePDFFactures $this->cols['totalincltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX') ? false : true, + 'status' => !getDolGlobalString('PDF_INVOICE_SHOW_PRICE_INCL_TAX') ? false : true, 'title' => array( 'textkey' => 'TotalTTCShort' ), From 84225c90770ba485eef09f613a9247e1fa2f5e6e Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:24:59 -0600 Subject: [PATCH 04/26] fix: variable name (#31411) --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 92474605915..e28c1c0bea6 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1342,7 +1342,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if ($bentityon) { // only if entity enable $maskrefclient_sql .= " AND entity IN (".getEntity($sharetable).")"; } elseif (!empty($forceentity)) { - $sql .= " AND entity IN (".$db->sanitize($forceentity).")"; + $maskrefclient_sql .= " AND entity IN (".$db->sanitize($forceentity).")"; } if ($where) { $maskrefclient_sql .= $where; //use the same optional where as general mask From 59fd0dbae7109d42fb1c40115b81ed862b2a0f9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2024 20:46:52 +0200 Subject: [PATCH 05/26] NEW Can choose the zip handler to build ODT --- htdocs/core/class/html.formfile.class.php | 2 +- .../modules/asset/doc/doc_generic_asset_odt.modules.php | 8 ++++---- .../core/modules/bom/doc/doc_generic_bom_odt.modules.php | 8 ++++---- .../commande/doc/doc_generic_order_odt.modules.php | 8 ++++---- .../contract/doc/doc_generic_contract_odt.modules.php | 8 ++++---- .../expedition/doc/doc_generic_shipment_odt.modules.php | 8 ++++---- .../facture/doc/doc_generic_invoice_odt.modules.php | 8 ++++---- .../modules/member/doc/doc_generic_member_odt.class.php | 2 +- .../core/modules/mrp/doc/doc_generic_mo_odt.modules.php | 2 +- .../product/doc/doc_generic_product_odt.modules.php | 2 +- .../project/doc/doc_generic_project_odt.modules.php | 8 ++++---- .../project/task/doc/doc_generic_task_odt.modules.php | 8 ++++---- .../propale/doc/doc_generic_proposal_odt.modules.php | 8 ++++---- .../reception/doc/doc_generic_reception_odt.modules.php | 8 ++++---- .../core/modules/societe/doc/doc_generic_odt.modules.php | 2 +- .../modules/stock/doc/doc_generic_stock_odt.modules.php | 2 +- .../doc/doc_generic_supplier_invoice_odt.modules.php | 8 ++++---- .../doc/doc_generic_supplier_order_odt.modules.php | 8 ++++---- .../doc/doc_generic_supplier_proposal_odt.modules.php | 2 +- .../modules/ticket/doc/doc_generic_ticket_odt.modules.php | 2 +- .../modules/user/doc/doc_generic_user_odt.modules.php | 2 +- .../usergroup/doc/doc_generic_usergroup_odt.modules.php | 2 +- .../mymodule/doc/doc_generic_myobject_odt.modules.php | 8 ++++---- .../doc_generic_recruitmentjobposition_odt.modules.php | 6 +++--- 24 files changed, 65 insertions(+), 65 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5262e6ba369..f988590e45a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -906,7 +906,7 @@ class FormFile // Show file size $size = (!empty($file['size']) ? $file['size'] : dol_filesize($filedir."/".$file["name"])); - $out .= ''.dol_print_size($size, 1, 1).''; + $out .= ''.dol_print_size($size, 1, 1).''; // Show file date $date = (!empty($file['date']) ? $file['date'] : dol_filemtime($filedir."/".$file["name"])); diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index c9b72c8ca83..1f63e7bac91 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -327,10 +327,10 @@ class doc_generic_asset_odt extends ModelePDFAsset $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->asset->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->asset->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { 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 b9aebc42a5b..34cb01441c5 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 @@ -333,10 +333,10 @@ class doc_generic_bom_odt extends ModelePDFBom $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->bom->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->bom->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 4f8f554c2a0..a4dd2d4df94 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -343,10 +343,10 @@ class doc_generic_order_odt extends ModelePDFCommandes $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->commande->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->commande->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 5fc3d4b5cc5..5bd1064aa12 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -355,10 +355,10 @@ class doc_generic_contract_odt extends ModelePDFContract $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->contrat->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->contrat->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index e20b163e229..4d9231c410d 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -341,10 +341,10 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->expedition->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->expedition->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 8e0fba186b6..625c1a94ce8 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -383,10 +383,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->facture->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->facture->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index d21191fc63d..f840303ab8f 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -312,7 +312,7 @@ class doc_generic_member_odt extends ModelePDFMember $srctemplatepath, array( 'PATH_TO_TMP' => $conf->adherent->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index c0593db24f3..d53ceb6c5dd 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -327,7 +327,7 @@ class doc_generic_mo_odt extends ModelePDFMo $srctemplatepath, array( 'PATH_TO_TMP' => $conf->mrp->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 842ba71402d..00a5e921099 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -339,7 +339,7 @@ class doc_generic_product_odt extends ModelePDFProduct $srctemplatepath, array( 'PATH_TO_TMP' => $conf->product->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 5360a18d382..2bf654acb04 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -614,10 +614,10 @@ class doc_generic_project_odt extends ModelePDFProjects $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->project->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->project->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index d542d255b4a..57183399fae 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -549,10 +549,10 @@ class doc_generic_task_odt extends ModelePDFTask $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->project->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->project->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 01f3e26666e..e704c179129 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -375,10 +375,10 @@ class doc_generic_proposal_odt extends ModelePDFPropales $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity], - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity], + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 868364d088e..667716cc5bf 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -336,10 +336,10 @@ class doc_generic_reception_odt extends ModelePdfReception $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->reception->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->reception->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 2022fd03dd8..8236016c4b9 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -280,7 +280,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $srctemplatepath, array( 'PATH_TO_TMP' => $conf->societe->multidir_temp[$object->entity], - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 38be94f3266..847ea2bcabf 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -342,7 +342,7 @@ class doc_generic_stock_odt extends ModelePDFStock $srctemplatepath, array( 'PATH_TO_TMP' => $conf->product->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index e3a0f521083..a355edff010 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -339,10 +339,10 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->fournisseur->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->fournisseur->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 775571b5081..0a6ab9690e8 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -334,10 +334,10 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->fournisseur->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->fournisseur->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index dbb72c23aed..80202ddf29d 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -364,7 +364,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $srctemplatepath, array( 'PATH_TO_TMP' => $conf->supplier_proposal->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index acfdee2c9b5..a6eb2b37288 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -310,7 +310,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $srctemplatepath, array( 'PATH_TO_TMP' => $conf->ticket->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 95fe0f72147..48bffa5948a 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -341,7 +341,7 @@ class doc_generic_user_odt extends ModelePDFUser $srctemplatepath, array( 'PATH_TO_TMP' => $conf->user->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index d96b2c0b740..f6052a07415 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -363,7 +363,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $srctemplatepath, array( 'PATH_TO_TMP' => $conf->user->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index b6b9a986715..7788a8e05b6 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -352,10 +352,10 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->mymodule->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->mymodule->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index d6a3309058f..f81991cfbd3 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -352,9 +352,9 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi $srctemplatepath, array( 'PATH_TO_TMP' => $conf->recruitment->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { From e53858a735dc08e3cfa4615f10eaa3b7c85bed4f Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:33:34 +0200 Subject: [PATCH 06/26] fix usage of on bottom --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 98c1e45630f..bcebdad50d1 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -597,6 +597,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->setPage($pageposbefore + 1); $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage; + $showpricebeforepagebreak = 0; } $pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it. From dd4536b7bdd1846b7591ee7f072272e8891863ee Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:34:54 +0200 Subject: [PATCH 07/26] fix usage of on bottom --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 436dd4c1f70..3ad55bcf3fc 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -585,6 +585,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->setPage($pageposbefore + 1); $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage; + $showpricebeforepagebreak = 0; } // I remove the line commented below because it probably uselesss (or bug source) no need to change bottom margin because we have checked image fit From f9eb82de7fec81c9a991ef2bb28dbe105ef3e85c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 18:43:59 +0200 Subject: [PATCH 08/26] FIX pagebreak when option PDF_ADD_POSITION is set --- .../modules/commande/doc/pdf_eratosthene.modules.php | 9 +++++---- .../modules/expedition/doc/pdf_espadon.modules.php | 10 +++++----- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 9 +++++---- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- .../modules/supplier_order/doc/pdf_cornas.modules.php | 10 ++++++---- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index de6d3b05f39..5e4f0f16462 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -557,10 +557,6 @@ class pdf_eratosthene extends ModelePDFCommandes $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -644,6 +640,11 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index a84ff2b7d8f..d151becb4b6 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -574,10 +574,6 @@ class pdf_espadon extends ModelePdfExpedition $posYAfterDescription = 0; $heightforsignature = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -666,8 +662,12 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font - // weight + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // weight $weighttxt = ''; if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->weight) { $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 61d48504396..84ba8550b2e 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -714,10 +714,6 @@ class pdf_sponge extends ModelePDFFactures $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $page_bottom_margin)) { // If photo too high, we moved completely on new page @@ -799,6 +795,11 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 2276252ca3f..680e3e3d873 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -650,7 +650,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font - // Position + // # of line if ($this->getColumnStatus('position')) { $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 7132a4de3ad..885a25b84b5 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -519,10 +519,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - // We start with Photo of product line if ($this->getColumnStatus('photo')) { // We start with Photo of product line @@ -549,6 +545,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $posYAfterImage = $curY + $imglinesize['height']; } } + // Description of product line $curX = $this->posxdesc - 1; $showpricebeforepagebreak = 1; @@ -604,6 +601,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); From 86d3352332e08b372b7da5a5ac02b95fc10a6c14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 23:14:31 +0200 Subject: [PATCH 09/26] Fix delete project when mrp module never enabled --- htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql | 2 +- .../install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql | 2 +- htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql | 2 +- htdocs/projet/class/project.class.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql index 0bf20b1b48e..6f8aead90c8 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) ---Put here your own copyright and developer email--- +-- Copyright (C) 2024 Laurent Destailleur -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql index cad0d9ffd79..da8e70b6375 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- Copyright (C) 2024 Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql index 96dc828134e..bcabab0d617 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ce3f73e148a..4ed9db8e735 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -960,8 +960,8 @@ class Project extends CommonObject 'fichinter' => 'fk_projet', 'don' => array('field' => 'fk_projet', 'module' => 'don'), 'actioncomm' => 'fk_project', - 'mrp_mo' => 'fk_project', - 'entrepot' => 'fk_project' + 'mrp_mo' => array('field' => 'fk_project', 'module' => 'mrp'), + 'entrepot' => 'fk_project', ); foreach ($listoftables as $key => $value) { if (is_array($value)) { From c9ed9bb6eb52cb7891bfac94d6f9d9568f6b8ff2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 23:48:24 +0200 Subject: [PATCH 10/26] FIX Avoid fatal error when mysqli not available --- htdocs/core/db/mysqli.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 45d60332fdf..f9463471192 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1288,6 +1288,16 @@ class DoliDBMysqli extends DoliDB } } + +// Protection if class mysqli doe not exists to avoid error +if (!class_exists('mysqli')) +{ + class mysqli + { + + } +} + /** * Class to make SSL connection */ From e17e9e8703703b749844aeb4cc63cfc6148c745c Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sat, 19 Oct 2024 00:56:00 +0200 Subject: [PATCH 11/26] Sanitize JS string fort alert() (#31465) --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index a0c72cdd55f..a92bc4cac53 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -597,7 +597,7 @@ function CloseBill() { if (!empty($conf->global->TAKEPOS_FORBID_SALES_TO_DEFAULT_CUSTOMER)) { echo "customerAnchorTag = document.querySelector('a[id=\"customer\"]'); "; echo "if (customerAnchorTag && customerAnchorTag.innerText.trim() === '".$langs->trans("Customer")."') { "; - echo "alert('".$langs->trans("NoClientErrorMessage")."'); "; + echo "alert('".dol_escape_js($langs->trans("NoClientErrorMessage"))."'); "; echo "return; } \n"; } ?> From 2f1d9cd9c022b87a86db7f35f6d908e08d5656ef Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:57:57 +0200 Subject: [PATCH 12/26] FIX : space used by linked elements in PDF notes (#31459) --- htdocs/core/lib/pdf.lib.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ca1d72e1cd3..a3d2a9ebded 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2534,10 +2534,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (count($objects) > 1) { $order = null; + + $refListsTxt = ''; if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :'); + $refListsTxt.= $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :'; } else { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefSending").' :'); + $refListsTxt.=$outputlangs->transnoentities("RefSending").' :'; } // We concat this record info into fields xxx_value. title is overwrote. foreach ($objects as $elementobject) { @@ -2552,14 +2554,16 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } } } - + $refListsTxt.= (!empty($refListsTxt)?' ':''); if (! is_object($order)) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref)); + $refListsTxt.= $outputlangs->transnoentities($elementobject->ref); } else { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '')); - $object->note_public = dol_concatdesc($object->note_public, ' / '.$outputlangs->transnoentities($elementobject->ref)); + $refListsTxt.= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); + $refListsTxt.= ' / '.$outputlangs->transnoentities($elementobject->ref); } } + + $object->note_public = dol_concatdesc($object->note_public, $refListsTxt); } elseif (count($objects) == 1) { $elementobject = array_shift($objects); $order = null; From 352bdaf9c45e808366978dca42fc936048b5a91d Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:33:31 +0200 Subject: [PATCH 13/26] FIX : Extrafield following between rec invoice and classic invoice (#31445) --- htdocs/compta/facture/class/facture-rec.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 22ea97feb6d..5b377edaee4 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1338,6 +1338,14 @@ class FactureRec extends CommonInvoice $facture->multicurrency_tx = $facturerec->multicurrency_tx; } + if (isset($facture->array_options) && isset($facturerec->array_options)) { + foreach ($facturerec->array_options as $key => $value) { + if (isset($facture->array_options[$key])) { + $facture->array_options[$key] = $value; + } + } + } + $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { $this->errors = $facture->errors; From abefce7ae2215ed7230a0b48e0ef35b7a724223f Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:55:58 +0200 Subject: [PATCH 14/26] FIX 17.0: supplier invoice template card: buyer and seller swapped in VAT-related function calls (probably a copy-paste from customer invoice templates) (#31446) --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/fourn/facture/card-rec.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dfaba07f663..8a0b73e8b2f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4917,8 +4917,8 @@ abstract class CommonObject * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * * @param string $action Action code - * @param string $seller Object of seller third party - * @param string $buyer Object of buyer third party + * @param Societe $seller Object of seller third party + * @param Societe $buyer Object of buyer third party * @param int $selected Object line selected * @param int $dateSelector 1=Show also date range input fields * @param string $defaulttpldir Directory where to find the template diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 525b5e9123a..8ba6c8be50e 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -535,8 +535,8 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $prod->id); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; } @@ -544,7 +544,7 @@ if (empty($reshook)) { // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = (GETPOST('pbq', 'int') ? GETPOST('pbq', 'int') : 0); - $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); + $datapriceofproduct = $prod->getSellPrice($object->thirdparty, $mysoc, $pqp); $pu_ht = $datapriceofproduct['pu_ht']; $pu_ttc = $datapriceofproduct['pu_ttc']; @@ -659,8 +659,8 @@ if (empty($reshook)) { $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $info_bits = 0; if ($tva_npr) { $info_bits |= 0x01; @@ -1080,7 +1080,7 @@ if ($action == 'create') { $disableedit = 1; $disablemove = 1; $disableremove = 1; - $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines('', $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } print "\n"; @@ -1569,7 +1569,7 @@ if ($action == 'create') { $canchangeproduct = 0; $object->statut = $object->suspended; - $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } // Form to add new line From 0844ed2f9bee21b722dcd7446ac1ae698cbec4cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 13:16:13 +0200 Subject: [PATCH 15/26] NEW Include a protection into check update to detect malware --- htdocs/admin/modules.php | 16 ++++-- htdocs/core/modules/DolibarrModules.class.php | 49 +++++++++++++++++++ htdocs/langs/en_US/errors.lang | 2 + 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 8e0a8bb66ce..e8c2a7a925d 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2024 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2023 Juanjo Menent @@ -837,11 +837,21 @@ if ($mode == 'common' || $mode == 'commonkanban') { || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE') ) ) { - $checkRes = $objMod->checkForUpdate(); + $checkRes = $objMod->checkForUpdate(); // Check for update version if ($checkRes > 0) { setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion); } elseif ($checkRes < 0) { - setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings'); + setEventMessage($objMod->getName().': '.$langs->trans('CheckVersionFail'), 'warnings'); + } + } + + if ($objMod->isCoreOrExternalModule() == 'external' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { + $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law + if (!is_numeric($checkRes) && $checkRes != '') { + $langs->load("errors"); + var_dump($checkRes); + var_dump($langs->trans($checkRes)); + setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); } } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 1f300718385..e46375262bd 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2529,4 +2529,53 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } return 0; } + + /** + * Check for module compliance with Dolibarr rules and law + * If a module is reported by this function,it is surely a malware. Delete it as soon as possible. + * + * @return int|string Return integer <0 if Error, 0 == not compliant, 'string' with message if module not compliant + */ + public function checkForCompliance() + { + global $conf, $langs; + + // Get list of illegal modules name or ID + if (empty($conf->cache['noncompliantmodules'])) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + + $urlforblacklistmodules = 'www.dolibarr.org/_service_noncompliantmodules.php'; + + $result = getURLContent($urlforblacklistmodules, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only + if (isset($result['content']) && $result['http_code'] == 200) { + $langs->load("errors"); + + // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . - + $arrayoflines = preg_split("/[\n,]/", $result['content']); + foreach ($arrayoflines as $line) { + $tmpfieldsofline = explode(';', $line); + $modulekey = strtolower($tmpfieldsofline[0]); + $conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0]; + $conf->cache['noncompliantmodules'][$modulekey]['id'] = $tmpfieldsofline[1]; + $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[2]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[2]); + if (!empty($tmpfieldsofline[3])) { + $conf->cache['noncompliantmodules'][$modulekey]['message2'] = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", $tmpfieldsofline[3]); + } + } + } + } + + if (!empty($conf->cache['noncompliantmodules'])) { + $modulekey = strtolower($this->name); + if (in_array($modulekey, array_keys($conf->cache['noncompliantmodules']))) { + $answer = trim($conf->cache['noncompliantmodules'][$modulekey]['message']); + if (!empty($conf->cache['noncompliantmodules'][$modulekey]['message2'])) { + $answer .= '
'.$conf->cache['noncompliantmodules'][$modulekey]['message2']; + } + return $answer; + } + } + + return 0; + } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 29558bfd042..35e3c6cccb1 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -377,6 +377,8 @@ WarningGoOnAccountancySetupToAddAccounts=If this list is empty, go into menu %s WarningCorrectedInvoiceNotFound=Corrected invoice not found WarningCommentNotFound=Please check placement of start and end comments for %s section in file %s before submitting your action WarningAlreadyReverse=Stock movement already reversed +WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibar foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, collecting your data without your consent or deploying malware). Use it at your own risk! +WarningModuleAffiliatedToAPiratPlatform=Be careful to never get a module (paid or free) from a pirate platform like %s SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. SwissQrCreditorAddressInvalid = Creditor address is invalid (are ZIP and city set? (%s) From 2aa67ba98325b4a55896dbf400e25cdc91bb55c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 13:31:56 +0200 Subject: [PATCH 16/26] Trans --- htdocs/langs/en_US/errors.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 35e3c6cccb1..1a1571fba34 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -378,7 +378,7 @@ WarningCorrectedInvoiceNotFound=Corrected invoice not found WarningCommentNotFound=Please check placement of start and end comments for %s section in file %s before submitting your action WarningAlreadyReverse=Stock movement already reversed WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibar foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, collecting your data without your consent or deploying malware). Use it at your own risk! -WarningModuleAffiliatedToAPiratPlatform=Be careful to never get a module (paid or free) from a pirate platform like %s +WarningModuleAffiliatedToAPiratPlatform=Be careful when getting a module (paid or free) from a suspicious non official platform like %s SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. SwissQrCreditorAddressInvalid = Creditor address is invalid (are ZIP and city set? (%s) From e97c1dc48edfbfcdc2ec5f8e04822ec98858ec82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 13:50:57 +0200 Subject: [PATCH 17/26] Better message --- htdocs/core/modules/DolibarrModules.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e46375262bd..37cec9f0a14 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2559,7 +2559,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $conf->cache['noncompliantmodules'][$modulekey]['id'] = $tmpfieldsofline[1]; $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[2]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[2]); if (!empty($tmpfieldsofline[3])) { - $conf->cache['noncompliantmodules'][$modulekey]['message2'] = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", $tmpfieldsofline[3]); + $message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}'); + $listofillegalurl = ''; + foreach (explode(" ", $tmpfieldsofline[3]) as $illegalurl) { + $listofillegalurl .= ($listofillegalurl ? ' '.$langs->trans("or").' ' : '').''.preg_replace('/[^a-z0-9\.\-]/', '', $illegalurl).''; + } + $message2 = str_replace('{s}', $listofillegalurl, $message2); + $conf->cache['noncompliantmodules'][$modulekey]['message2'] = $message2; } } } From 85f1338b19fa933f8581fbe6738deb6a68f09cec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 14:29:59 +0200 Subject: [PATCH 18/26] Fix var_dump --- htdocs/admin/modules.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e8c2a7a925d..bf4cdaffd4a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -849,8 +849,6 @@ if ($mode == 'common' || $mode == 'commonkanban') { $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law if (!is_numeric($checkRes) && $checkRes != '') { $langs->load("errors"); - var_dump($checkRes); - var_dump($langs->trans($checkRes)); setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); } } From 11d01197e34cf5bc9c0952e3f7436f7e72246033 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 14:51:30 +0200 Subject: [PATCH 19/26] Split code to avoid false positive --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d89c11a76c3..40fa8f3ee14 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10390,7 +10390,8 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST', 'ReflectionFunction')); $forbiddenphpfunctions = array(); - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode", "str_rot13", "hex2bin")); // decode string functions used to obfuscated function name + // @phpcs:ignore + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64"."_"."decode", "rawurl"."decode", "url"."decode", "str"."_rot13", "hex"."2bin")); // name of forbidden functions are split to avoid false positive $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); From c160da91eda7291b29a579b26b360ce0d80bd908 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 15:29:43 +0200 Subject: [PATCH 20/26] Change URL for module blacklist feature --- htdocs/core/modules/DolibarrModules.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 37cec9f0a14..57736c62632 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2544,7 +2544,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (empty($conf->cache['noncompliantmodules'])) { require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - $urlforblacklistmodules = 'www.dolibarr.org/_service_noncompliantmodules.php'; + $urlforblacklistmodules = 'https://ping.dolibarr.org/modules-blacklist.txt'; $result = getURLContent($urlforblacklistmodules, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only if (isset($result['content']) && $result['http_code'] == 200) { @@ -2557,11 +2557,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $modulekey = strtolower($tmpfieldsofline[0]); $conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0]; $conf->cache['noncompliantmodules'][$modulekey]['id'] = $tmpfieldsofline[1]; - $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[2]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[2]); - if (!empty($tmpfieldsofline[3])) { + $conf->cache['noncompliantmodules'][$modulekey]['signature'] = $tmpfieldsofline[2]; + $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[3]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[3]); + if (!empty($tmpfieldsofline[4])) { $message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}'); $listofillegalurl = ''; - foreach (explode(" ", $tmpfieldsofline[3]) as $illegalurl) { + foreach (explode(" ", $tmpfieldsofline[4]) as $illegalurl) { $listofillegalurl .= ($listofillegalurl ? ' '.$langs->trans("or").' ' : '').''.preg_replace('/[^a-z0-9\.\-]/', '', $illegalurl).''; } $message2 = str_replace('{s}', $listofillegalurl, $message2); From 88d0636dccf08243e6a1dc1c049924709aa0b718 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 19:40:04 +0200 Subject: [PATCH 21/26] Fix travis --- htdocs/core/db/mysqli.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index f9463471192..f1fa6337400 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1290,11 +1290,13 @@ class DoliDBMysqli extends DoliDB // Protection if class mysqli doe not exists to avoid error -if (!class_exists('mysqli')) -{ +if (!class_exists('mysqli')) { + /** + * A dummy class to avoid error when class is not available + */ class mysqli { - + // Empty content } } From 4a0035085975424fd049b25b550a9307a2885b67 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 20:46:10 +0200 Subject: [PATCH 22/26] Fix test on malware --- htdocs/admin/modules.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index bf4cdaffd4a..b561267b5cb 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -267,6 +267,30 @@ if ($action == 'install' && $allowonlineinstall) { } } + /* + if (!$error) { + if (GETPOST('checkforcompliance')) { + $dir = $dirins; + $file = $modulenameval; + // $installedmodule + try { + $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) { + if (class_exists($modName)) { + $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; + + //var_dump($objMod); + } + } + } catch(Exception $e) { + // Nothing done + } + } + } + */ + if (!$error) { setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings'); } @@ -845,7 +869,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } - if ($objMod->isCoreOrExternalModule() == 'external' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { + if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law if (!is_numeric($checkRes) && $checkRes != '') { $langs->load("errors"); From df2211e9f21eb90319a9a70991329a1e7c5c7b00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Oct 2024 00:03:46 +0200 Subject: [PATCH 23/26] Fix phan --- htdocs/core/db/mysqli.class.php | 74 +++++++++++++++------------------ 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index f1fa6337400..fcca43a4918 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -261,6 +261,7 @@ class DoliDBMysqli extends DoliDB try { if (!class_exists('mysqli')) { dol_print_error(null, 'Driver mysqli for PHP not available'); + return false; } if (strpos($host, 'ssl://') === 0) { $tmp = new mysqliDoli($host, $login, $passwd, $name, $port); @@ -1289,49 +1290,40 @@ class DoliDBMysqli extends DoliDB } -// Protection if class mysqli doe not exists to avoid error -if (!class_exists('mysqli')) { +if (class_exists('myslqi')) { /** - * A dummy class to avoid error when class is not available + * Class to make SSL connection */ - class mysqli + class mysqliDoli extends mysqli { - // Empty content - } -} - -/** - * Class to make SSL connection - */ -class mysqliDoli extends mysqli -{ - /** - * Constructor. - * This create an opened connection to a database server and eventually to a database - * - * @param string $host Address of database server - * @param string $user Name of database user - * @param string $pass Password of database user - * @param string $name Name of database - * @param int $port Port of database server - * @param string $socket Socket - */ - public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") - { - $flags = 0; - if (PHP_VERSION_ID >= 80100) { - parent::__construct(); - } else { - // @phan-suppress-next-line PhanDeprecatedFunctionInternal - parent::init(); - } - if (strpos($host, 'ssl://') === 0) { - $host = substr($host, 6); - parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); - // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal - parent::ssl_set(null, null, "", null, null); - $flags = MYSQLI_CLIENT_SSL; - } - parent::real_connect($host, $user, $pass, $name, $port, $socket, $flags); + /** + * Constructor. + * This create an opened connection to a database server and eventually to a database + * + * @param string $host Address of database server + * @param string $user Name of database user + * @param string $pass Password of database user + * @param string $name Name of database + * @param int $port Port of database server + * @param string $socket Socket + */ + public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") + { + $flags = 0; + if (PHP_VERSION_ID >= 80100) { + parent::__construct(); + } else { + // @phan-suppress-next-line PhanDeprecatedFunctionInternal + parent::init(); + } + if (strpos($host, 'ssl://') === 0) { + $host = substr($host, 6); + parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); + // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal + parent::ssl_set(null, null, "", null, null); + $flags = MYSQLI_CLIENT_SSL; + } + parent::real_connect($host, $user, $pass, $name, $port, $socket, $flags); + } } } From eb3bba03cdaa43996149dfdff2e59f5af04e7188 Mon Sep 17 00:00:00 2001 From: Joachim Kueter Date: Sat, 19 Oct 2024 01:18:55 +0200 Subject: [PATCH 24/26] Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 --- .../core/modules/commande/doc/pdf_eratosthene.modules.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 5e4f0f16462..23ef65337e3 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -8,7 +8,9 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Nick Fragoulis + * Copyright (C) 2024 Joachim Kueter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1847,7 +1849,7 @@ class pdf_eratosthene extends ModelePDFCommandes 'border-left' => true, // add left line separator ); - if (!getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { + if (!getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) { $this->cols['vat']['status'] = true; } From 2b85f401afd209e102b86b99262db164d4cffb6d Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:03:49 +0200 Subject: [PATCH 25/26] Fix breaks on edge --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index bcebdad50d1..968db0a2e34 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -626,7 +626,7 @@ class pdf_cyan extends ModelePDFPropales // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $heightforfooter)) { + if ($afterPosData['page'] > $pageposbefore && (empty($showpricebeforepagebreak) || ($curY + 4) > ($this->page_hauteur - $heightforfooter))) { $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; } From 9ee4f2bd0377e758b99ba7d6c16612a6529feff9 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:05:28 +0200 Subject: [PATCH 26/26] Fix breaks on edge --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 3ad55bcf3fc..89493ae6416 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -614,7 +614,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->setPageOrientation('', 0, $heightforfooter); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $heightforfooter)) { + if ($afterPosData['page'] > $pageposbefore && (empty($showpricebeforepagebreak) || ($curY + 4) > ($this->page_hauteur - $heightforfooter))) { $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; }