From 82f65a6410011d4efbeab6c95adb8088cedb516c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2024 20:46:52 +0200 Subject: [PATCH 01/72] 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 | 2 +- .../core/modules/bom/doc/doc_generic_bom_odt.modules.php | 8 ++++---- .../commande/doc/doc_generic_order_odt.modules.php | 2 +- .../contract/doc/doc_generic_contract_odt.modules.php | 2 +- .../expedition/doc/doc_generic_shipment_odt.modules.php | 2 +- .../facture/doc/doc_generic_invoice_odt.modules.php | 2 +- .../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 | 2 +- .../project/task/doc/doc_generic_task_odt.modules.php | 8 ++++---- .../propale/doc/doc_generic_proposal_odt.modules.php | 2 +- .../reception/doc/doc_generic_reception_odt.modules.php | 2 +- .../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 | 2 +- .../doc/doc_generic_supplier_order_odt.modules.php | 2 +- .../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 | 2 +- 24 files changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4ecf61ffd1842..de999b305bb2d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -911,7 +911,7 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, // 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 3d767b59571a4..6a707b7736260 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 @@ -333,7 +333,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->asset->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/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 9233a93f151b1..930b054b3479c 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 529ca3a85398a..3645718cfc04c 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 @@ -344,7 +344,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->commande->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/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index c5b938fe8f16a..92882228e1792 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 @@ -356,7 +356,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->contrat->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/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index c8781cdd2cca7..b60f8b9c1c8df 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 @@ -342,7 +342,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->expedition->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/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index aa8cc2584737c..ea303eae66f50 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 @@ -384,7 +384,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->facture->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/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index fec763d30d044..f74f434070110 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 @@ -313,7 +313,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem $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 1a784af2dcbf0..1607db5cd7c0d 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 85450edf7f07d..4c8b329389407 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 c07cea2dbc8f6..679cec0a89384 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 @@ -611,7 +611,7 @@ public function write_file($object, $outputlangs, $srctemplatepath) $srctemplatepath, array( 'PATH_TO_TMP' => $conf->project->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/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b330aaac9b245..b86f6756d44a6 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 @@ -547,10 +547,10 @@ public function write_file($object, $outputlangs, $srctemplatepath) $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 e5fddcddd5fda..160d7cf4b5f04 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 @@ -376,7 +376,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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. + '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/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index c51179964e279..082b9f20198a5 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 @@ -337,7 +337,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->reception->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/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 5e9b54f03c119..0ea2d5535162a 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -291,7 +291,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 4db3e9f93d291..1739914c5f171 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 @@ -338,7 +338,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 8246efc372d6f..0e3f2be33c785 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 @@ -340,7 +340,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->fournisseur->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_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index a6750022925f9..e272fa2f9e1f1 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 @@ -335,7 +335,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->fournisseur->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_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 17e7fb8ae2c9a..d0622a1686f53 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 c488f8035b508..a46099083c582 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 @@ -311,7 +311,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 8dd43bbdc32d1..332af37d8c7db 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 @@ -342,7 +342,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 cabdf9611aa44..1989ded79e399 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 7b7c9b3e99cb0..1506e58d4e0d5 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 @@ -358,10 +358,10 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 7bea09384ef9a..def8d1843d0ca 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 @@ -353,7 +353,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->recruitment->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' => '}' ) From 7166d2570baf7b3396ffc8c36d2a3c00d4ee56cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 00:27:18 +0200 Subject: [PATCH 02/72] Fix Zip generation of ODT with PHPZip --- htdocs/includes/odtphp/odf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 42fc9cd2a1ac4..90d0afca1ba28 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -740,7 +740,7 @@ private function _save() // Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice) $this->addImageToManifest($imageValue); } - if (! $this->file->addFromString('./META-INF/manifest.xml', $this->manifestXml)) { + if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { throw new OdfException('Error during file export: manifest.xml'); } $this->file->close(); From 111e3fcd32b956bc6d86b3e67618d3c2c7ca766c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 00:52:42 +0200 Subject: [PATCH 03/72] Revert "NEW - Add a new hook on order list (#31315)" This reverts commit 1e64870a9ec465f090f94e907a4dd3c1a1257305. --- htdocs/commande/list.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2d80c7afec500..bf39beba029f8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2566,21 +2566,6 @@ } } } - - // Call Hook modifyTextInfo - $parameters = array('textinfo' => $text_info); - $reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action); - if ($reshook == 1) { - // for add information - $text_info .= $hookmanager->resPrint; - } elseif ($reshook == 0) { - // for replace information - $text_info = $hookmanager->resPrint; - } elseif ($reshook == -1) { - // for errors - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - if ($notshippable == 0) { $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); $text_info = $text_icon.' '.$langs->trans('Shippable').'
'.$text_info; From 542a4fb0607915e55d3d3297da4cc6f962f81d16 Mon Sep 17 00:00:00 2001 From: ems-co Date: Thu, 17 Oct 2024 02:03:51 +0300 Subject: [PATCH 04/72] 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 f968f7c467280..bf1f86cc7b58d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1827,6 +1827,7 @@ $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 05/72] 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 a66489366ee70..2f5bc39610b95 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 @@ protected function _signature_area(&$pdf, $object, $posy, $outputlangs) $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 b9617aa6ed0c6..dba0f3c90f126 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 @@ protected function drawSignatureArea(&$pdf, $object, $posy, $outputlangs) $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 06/72] 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 09c7e82c1f55f..2b11fbd3ff6e8 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 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $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 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $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 ce414d29d7d41d7756ddb9617002c5ff85e1b3c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 01:23:23 +0200 Subject: [PATCH 07/72] Fix phan --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 3cc19ec9933bb..a84ff2b7d8f93 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -1206,6 +1206,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); + // @phan-suppress-next-line PhanPluginSuspiciousParamOrder $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection); $posy = $pdf->getY(); @@ -1213,6 +1214,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show recipient information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); + // @phan-suppress-next-line PhanPluginSuspiciousParamOrder $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection); } From 0c678878b763370f6d6020609a563dfd730d2372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 17 Oct 2024 01:24:15 +0200 Subject: [PATCH 08/72] fix typo of hidden parameter in commonobject.class.php (#31417) Co-authored-by: Laurent Destailleur --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4f86c955552a1..2e5009addd89f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9144,7 +9144,7 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key $out .= $extrafields->showOutputField($key, $value, '', $this->table_element); break; case "create": - $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICOT', 'email,phone,ip,password')); + $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } @@ -9152,7 +9152,7 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); break; case "edit": - $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICOT', 'email,phone,ip,password')); + $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } 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 09/72] 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 9247460591525..e28c1c0bea697 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 6fca870750ce4f6a2629ef7d2e600a2ac760886b Mon Sep 17 00:00:00 2001 From: Michael Bussmann Date: Thu, 17 Oct 2024 02:08:38 +0200 Subject: [PATCH 10/72] EPC-QR,Sponge, Translation of INVOICE_ADD_EPC_QR_CodePay, Alignment (#31327) * EPC_QR fixes Display translation of INVOICE_ADD_EPC_QR_CodePay Fixed alignment of INVOICE_ADD_EPC_QR_CodePay when QR-Code at bottom * Reverted local font size Signed-off-by: Michael Bussmann --------- Signed-off-by: Michael Bussmann --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 6466aaa298e22..5b9d4c1a5b8a2 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -129,7 +129,7 @@ public function __construct($db) global $conf, $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills")); + $langs->loadLangs(array("main", "bills", 'admin')); $this->db = $db; $this->name = "sponge"; @@ -210,7 +210,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } // Load translation files required by the page - $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); + $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", 'admin')); global $outputlangsbis; $outputlangsbis = null; @@ -1444,9 +1444,9 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan $EPCQrCodeString = $object->buildEPCQrCodeString(); $pdf->write2DBarcode($EPCQrCodeString, 'QRCODE,M', $qrPosX, $qrPosY, 25, 25, $styleQr, 'N'); - $pdf->SetXY($qrPosX + 5, $posy); + $pdf->SetXY($qrPosX + 30, $posy + 5); $pdf->SetFont('', '', $default_font_size - 5); - $pdf->MultiCell(30, 3, $langs->trans("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); + $pdf->MultiCell(30, 3, $outputlangs->transnoentitiesnoconv("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); $posy = $pdf->GetY() + 2; } } From dacbfecb02f359862936f160ea12a1ad31022ff2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 02:12:49 +0200 Subject: [PATCH 11/72] Move trans into correct lang file --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 6 +++--- htdocs/langs/en_US/admin.lang | 1 - htdocs/langs/en_US/bills.lang | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5b9d4c1a5b8a2..61d4850439664 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -126,10 +126,10 @@ class pdf_sponge extends ModelePDFFactures */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills", 'admin')); + $langs->loadLangs(array("main", "bills")); $this->db = $db; $this->name = "sponge"; @@ -210,7 +210,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } // Load translation files required by the page - $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", 'admin')); + $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); global $outputlangsbis; $outputlangsbis = null; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e3d6f60d66626..cc9cd9963bf7c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2393,7 +2393,6 @@ INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices (with a bank a INVOICE_ADD_SWISS_QR_CODEMore=Switzerland's standard for invoices; make sure ZIP & City are filled and that the accounts have valid Swiss/Liechtenstein IBANs. INVOICE_ADD_EPC_QR_CODE=Show the EPC QR code on invoices (with a bank account defined for credit transfer) INVOICE_ADD_EPC_QR_CODEMore=This feature allows you to add or remove an EPC QR Code on your invoices, which facilitates automatic SEPA credit transfers. Enabling this option helps your clients make payments easily by scanning the QR code, reducing manual entry errors. Use this feature if you have clients in countries like Austria, Belgium, Finland, Germany, and the Netherlands where this system is supported. Disable it if it's not required for your business operations or client base. -INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with a smartphone supporting payment with EPC QR code. INVOICE_SHOW_SHIPPING_ADDRESS=Show shipping address INVOICE_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...) SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT=Show billing contact on proposal diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index c41cadb34bc49..1ede99d2278dc 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -669,3 +669,4 @@ SearchValidatedSupplierInvoicesWithDate=Search unpaid supplier invoices with a v SendEmailsRemindersOnSupplierInvoiceDueDate=Send reminder by email for validated and unpaid supplier invoices PaymentMadeForSeveralInvoices=Payment made for several invoices SituationInvoiceProgressCurrent=Invoice progress +INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with a smartphone supporting payment with EPC QR code. From 59fd0dbae7109d42fb1c40115b81ed862b2a0f9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2024 20:46:52 +0200 Subject: [PATCH 12/72] 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 5262e6ba36983..f988590e45a6f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -906,7 +906,7 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, // 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 c9b72c8ca837f..1f63e7bac911c 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 b9aebc42a5b63..34cb01441c51f 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 4f8f554c2a0a8..a4dd2d4df947e 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 5fc3d4b5cc5dd..5bd1064aa127a 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 e20b163e22982..4d9231c410dff 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 8e0fba186b67b..625c1a94ce8ed 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 d21191fc63d52..f840303ab8f04 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem $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 c0593db24f30a..d53ceb6c5dd73 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 842ba71402d15..00a5e9210996a 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 5360a18d382d7..2bf654acb0489 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 @@ public function write_file($object, $outputlangs, $srctemplatepath) $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 d542d255b4a4c..57183399fae60 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 @@ public function write_file($object, $outputlangs, $srctemplatepath) $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 01f3e26666e6d..e704c17912993 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 868364d088e1f..667716cc5bf72 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 2022fd03dd8c9..8236016c4b989 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 38be94f32663f..847ea2bcabf9f 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 e3a0f52108362..a355edff0105b 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 775571b5081f7..0a6ab9690e84c 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 dbb72c23aed9e..80202ddf29dd7 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 acfdee2c9b58e..a6eb2b37288be 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 95fe0f7214770..48bffa5948aa0 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 d96b2c0b740b6..f6052a07415c1 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 b6b9a9867150a..7788a8e05b6d0 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 d6a3309058f4c..f81991cfbd3a9 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 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $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 4f71729311e0d39ac37c65060829258e92cff402 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 18:17:12 +0200 Subject: [PATCH 13/72] Fix missing migration on model_pdf --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 483e98a4fbaff..65901dcd91e9e 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -268,6 +268,8 @@ ALTER TABLE llx_ticket ADD COLUMN origin_references text DEFAULT NULL; ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL; ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; +ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; + ALTER TABLE llx_societe ADD COLUMN geolat double(24,8) DEFAULT NULL; ALTER TABLE llx_societe ADD COLUMN geolong double(24,8) DEFAULT NULL; ALTER TABLE llx_societe ADD COLUMN geopoint point DEFAULT NULL; From a7a251717ee940c37c8f2b0002e6ac64dee92a3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 23:08:48 +0200 Subject: [PATCH 14/72] Minor fix in azur/cyan --- .../modules/propale/doc/pdf_azur.modules.php | 28 +++++++++---------- .../modules/propale/doc/pdf_cyan.modules.php | 14 ++++++---- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 282edf3174263..b66f019bfe46f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1016,7 +1016,7 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1035,8 +1035,8 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if (!empty($object->fk_account) || !empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); - if (!empty($object->fk_bank)) { + $bankid = (empty($object->fk_account) ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); + if (!empty($object->fk_bank) && $object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } $account = new Account($this->db); @@ -1516,12 +1516,12 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } else { $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); + $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } } @@ -1534,7 +1534,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $pdf->SetTextColor(128, 0, 0); $title .= ' - '.$outputlangs->transnoentities("NotValidated"); } - $pdf->MultiCell(100, 4, $title, '', 'R'); + $pdf->MultiCell($w, 4, $title, '', 'R'); $pdf->SetFont('', 'B', $default_font_size); @@ -1552,7 +1552,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) { @@ -1586,18 +1586,18 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $posy = $pdf->getY(); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R'); $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R'); if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Get contact @@ -1609,7 +1609,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } @@ -1618,7 +1618,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $top_shift = 0; // Show list of linked objects $current_y = $pdf->getY(); - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); if ($current_y < $pdf->getY()) { $top_shift = $pdf->getY() - $current_y; } @@ -1758,7 +1758,7 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) * Show area for the customer to sign * * @param TCPDF $pdf Object PDF - * @param Propal $object Object invoice + * @param Propal $object Object proposal * @param int $posy Position depart * @param Translate $outputlangs Object langs * @return int Position pour suite diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 6b75bc4663a6c..9904071d7f425 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -999,7 +999,7 @@ public function drawInfoTable(&$pdf, $object, $posy, $outputlangs) } $posxval = 52; - if (getDolGlobalString('MAIN_PDF_DATE_TEXT')) { + if (getDolGlobalString('MAIN_PDF_DELIVERY_DATE_TEXT')) { $displaydate = "daytext"; } else { $displaydate = "day"; @@ -1133,7 +1133,7 @@ public function drawInfoTable(&$pdf, $object, $posy, $outputlangs) // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + $bankid = ($object->fk_account <= 0 ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); if ($object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } @@ -1361,7 +1361,12 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { + $totalvat .= $tvacompl; + } else { + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + } + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); @@ -1404,8 +1409,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); /* - if ($object->close_code == 'discount_vat') - { + if ($object->close_code == 'discount_vat') { $index++; $pdf->SetFillColor(255,255,255); From 3aedad68e12297256b09dcedaa3e4354b244f533 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 23:15:32 +0200 Subject: [PATCH 15/72] FIX duplicate answers in list when using global search on proposals --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 69c0204929bf8..510d75874e481 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -561,7 +561,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $sql = 'SELECT'; -if ($search_all > 0) { +if ($search_all) { $sql = 'SELECT DISTINCT'; } $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,'; From 59829485c67d8ea1286c48c380afbb0c2221cea8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 23:15:32 +0200 Subject: [PATCH 16/72] FIX duplicate answers in list when using global search on proposals --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 69c0204929bf8..1cd7f22552e02 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -561,7 +561,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $sql = 'SELECT'; -if ($search_all > 0) { +if ($search_all !== '') { $sql = 'SELECT DISTINCT'; } $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,'; From 3eebba611672c6a8f3636ea9cbb8417643bbb20e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2024 23:46:30 +0200 Subject: [PATCH 17/72] FIX When PDF_ADD_POSITION is on, the number was doing pagebreak before the pagebreak done by the addition of description. --- .../modules/propale/doc/pdf_cyan.modules.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 9904071d7f425..2276252ca3f47 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -568,10 +568,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -606,18 +602,18 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); $pageposafter = $pdf->getPage(); - if ($pageposafter > $pageposbefore) { // There is a pagebreak + if ($pageposafter > $pageposbefore) { // There is a pagebreak (not enough space for total+free text+footer) $pdf->rollbackTransaction(true); - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it to simple footer, so we can retry as if we have just the simple footer. $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text but no page break. + if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page manually because no break page was done automatically for the last part. $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -625,7 +621,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->setPage($pageposafter + 1); } } else { - // We found a page break + // We found a page break that was done automatically and there is ow enough space for total+free text+footer. // Allows data in the first page if description is long enough to break in multiples pages if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; @@ -646,7 +642,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // 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 + // We suppose that a too long description or photo were moved completely on next page, so we set the value for $curY and current page that will be used by the following output. if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; @@ -654,6 +650,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // Position + 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 edd33fd17b48384efefe8cf21c82061d6e67f67d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 00:25:34 +0200 Subject: [PATCH 18/72] FIX Error management on cheque deposit. --- htdocs/compta/paiement/cheque/card.php | 1 + .../compta/paiement/cheque/class/remisecheque.class.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 9af72aa1a1fa0..a9a66b683f219 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -168,6 +168,7 @@ exit; } else { setEventMessages($object->error, $object->errors, 'errors'); + $action = 'new'; } } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 70274fd13c360..e74ea51730ca4 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -357,7 +357,7 @@ public function validate($user) $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " SET statut = 1, ref = '".$this->db->escape($numref)."'"; $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $sql .= " AND statut = 0"; dol_syslog("RemiseCheque::Validate", LOG_DEBUG); @@ -368,13 +368,15 @@ public function validate($user) if ($num == 1) { $this->ref = $numref; $this->statut = 1; + $this->status = 1; } else { $this->errno = -1029; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } else { $this->errno = -1033; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + $this->error = $this->db->lasterror(); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } From 65e750cb4e49e708a1dc036839fd6f61f09658bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 00:47:46 +0200 Subject: [PATCH 19/72] FIX Get number of bank deposit wa not using the date. --- htdocs/compta/paiement/cheque/card.php | 1 + htdocs/compta/paiement/cheque/class/remisecheque.class.php | 2 +- htdocs/core/modules/cheque/mod_chequereceipt_mint.php | 7 ++++--- htdocs/core/modules/cheque/mod_chequereceipt_thyme.php | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index a9a66b683f219..4c997d5b9ad43 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -144,6 +144,7 @@ if ($action == 'create' && GETPOSTINT("accountid") > 0 && $user->hasRight('banque', 'cheque')) { if (GETPOSTISARRAY('toRemise')) { $object->type = $type; + $object->date_bordereau = dol_now(); $arrayofid = GETPOST('toRemise', 'array:int'); $result = $object->create($user, GETPOSTINT("accountid"), 0, $arrayofid); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index e74ea51730ca4..1b091ec27b634 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -345,7 +345,7 @@ public function delete($user) */ public function validate($user) { - global $langs, $conf; + global $conf; $this->errno = 0; diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 3f7607947509a..7bbea64d472cc 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -124,7 +124,7 @@ public function getNextValue($objsoc, $object) $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { @@ -139,8 +139,8 @@ public function getNextValue($objsoc, $object) return -1; } - //$date=time(); - $date = $object->date_bordereau; + $date = (empty($object) ? dol_now() : $object->date_bordereau); + $yymm = dol_print_date($date, "%y%m"); if ($max >= (pow(10, 4) - 1)) { @@ -150,6 +150,7 @@ public function getNextValue($objsoc, $object) } dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); + return $this->prefix.$yymm."-".$num; } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 9b97481dcba1e..dd6eea47d8508 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -128,7 +128,9 @@ public function getNextValue($objsoc, $object) return 0; } - $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, empty($object) ? dol_now() : $object->date_bordereau); + $date = (empty($object) ? dol_now() : $object->date_bordereau); + + $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, $date); return $numFinal; } From 8f868ef3b9e2a723888d9ac2fcb879ba0f476de1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 01:07:31 +0200 Subject: [PATCH 20/72] Fix text overlapping --- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 5cecdaa413dcc..560c7ad1ec9ed 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -292,7 +292,7 @@ public function Header(&$pdf, $page, $pages, $outputlangs) $pdf->SetFont('', '', $default_font_size); $pdf->SetXY(10, 32); - $pdf->MultiCell(0, 2, $outputlangs->transnoentities("BankAccount"), 0, 'L'); + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("BankAccount"), 0, 'L'); pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1); $pdf->SetFont('', '', $default_font_size); From f9eb82de7fec81c9a991ef2bb28dbe105ef3e85c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Oct 2024 18:43:59 +0200 Subject: [PATCH 21/72] 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 de6d3b05f394e..5e4f0f16462e7 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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 a84ff2b7d8f93..d151becb4b6a0 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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 61d4850439664..84ba8550b2eeb 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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 2276252ca3f47..680e3e3d873aa 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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $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 7132a4de3ad98..885a25b84b56b 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 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $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 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $posYAfterImage = $curY + $imglinesize['height']; } } + // Description of product line $curX = $this->posxdesc - 1; $showpricebeforepagebreak = 1; @@ -604,6 +601,11 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $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 22/72] 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 0bf20b1b48efc..6f8aead90c888 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 cad0d9ffd7933..da8e70b6375f7 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 96dc828134e63..bcabab0d61799 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 ce3f73e148aaf..4ed9db8e735d7 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -960,8 +960,8 @@ public function delete($user, $notrigger = 0) '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 23/72] 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 45d60332fdff3..f946347119234 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1288,6 +1288,16 @@ public function getServerStatusValues($filter = '') } } + +// 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 24/72] 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 a0c72cdd55fae..a92bc4cac5302 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 25/72] 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 ca1d72e1cd36e..a3d2a9ebdedfb 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 26/72] 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 22ea97feb6d57..5b377edaee413 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1338,6 +1338,14 @@ public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidat $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 27/72] 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 dfaba07f66311..8a0b73e8b2f9a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4917,8 +4917,8 @@ public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir * 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 525b5e9123ad9..8ba6c8be50e3f 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -535,8 +535,8 @@ $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 @@ // 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 @@ $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 @@ $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 @@ $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 28/72] 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 8e0a8bb66ce90..e8c2a7a925d8a 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 @@ || 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 1f30071838552..e46375262bd48 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2529,4 +2529,53 @@ public function checkForUpdate() } 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 29558bfd04280..35e3c6cccb191 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 29/72] 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 35e3c6cccb191..1a1571fba346f 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 30/72] 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 e46375262bd48..37cec9f0a1407 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2559,7 +2559,13 @@ public function checkForCompliance() $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 31/72] 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 e8c2a7a925d8a..bf4cdaffd4a4f 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -849,8 +849,6 @@ $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 32/72] 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 d89c11a76c3c6..40fa8f3ee14e8 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 33/72] 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 37cec9f0a1407..57736c6263220 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2544,7 +2544,7 @@ public function checkForCompliance() 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 @@ public function checkForCompliance() $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 34/72] 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 f946347119234..f1fa63374009f 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1290,11 +1290,13 @@ public function getServerStatusValues($filter = '') // 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 35/72] 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 bf4cdaffd4a4f..b561267b5cb94 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -267,6 +267,30 @@ } } + /* + 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 ($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 36/72] Fix phan --- htdocs/core/db/mysqli.class.php | 72 +++++++++++++++------------------ 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index f1fa63374009f..fcca43a491898 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -261,6 +261,7 @@ public function connect($host, $login, $passwd, $name, $port = 0) 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 @@ public function getServerStatusValues($filter = '') } -// Protection if class mysqli doe not exists to avoid error -if (!class_exists('mysqli')) { - /** - * A dummy class to avoid error when class is not available - */ - class mysqli - { - // Empty content - } -} - -/** - * Class to make SSL connection - */ -class mysqliDoli extends mysqli -{ +if (class_exists('myslqi')) { /** - * 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 + * Class to make SSL connection */ - public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") + class mysqliDoli extends mysqli { - $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; + /** + * 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); } - 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 37/72] 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 5e4f0f16462e7..23ef65337e3df 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 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide '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 b0c7b8750a429f99e955cde3880a6734bfc8afad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2024 00:10:54 +0200 Subject: [PATCH 38/72] fix overwritten value (#31470) --- htdocs/commande/list_det.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 9fc9e4059a77b..86a30b9cfc954 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -2016,7 +2016,7 @@ $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { $generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { From 1d197e42bbe2ab6c5fecce36ca6181c4156d3e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2024 00:11:04 +0200 Subject: [PATCH 39/72] fix shippable tooltip value overwritten (#31468) --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index bf39beba029f8..ef7f802c61bf4 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2508,7 +2508,7 @@ $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { From 710905470bd014fc105826213757dcced2ffe88b Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sun, 20 Oct 2024 01:11:53 +0300 Subject: [PATCH 40/72] fix translation for non latin languages (#31473) --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index b561267b5cb94..8cd9320b6dc64 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1337,7 +1337,7 @@ $(document).ready(function() { jQuery("#fileinstall").on("change", function() { if(this.files[0].size > '.($maxmin * 1024).') { - alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'"); + alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'"); this.value = ""; } }); From 58c0b97300d7663ecadd8e8e10302c9b9b38fedd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2024 20:17:40 +0200 Subject: [PATCH 41/72] FIX for #31237 #31524 --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index eb49f75e8da6c..6931f6d7d7656 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2077,7 +2077,7 @@ public function fetch($rowid, $ref = '', $ref_ext = '', $barcode = '', $idprof1 $this->model_pdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; - $result = 1; + $result = $this->id; // fetch optionals attributes and labels $this->fetch_optionals(); From 4d047feca7163f83c328838832d8ecc5ec6a3e23 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:20:54 +0200 Subject: [PATCH 42/72] Fix bad sql whe exporting salaries (#31526) Co-authored-by: Hystepik --- htdocs/core/modules/modSalaries.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index f2c1cba7aad9e..48d5c82111f44 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -158,7 +158,8 @@ public function __construct($db) $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'salary as s ON s.fk_user = u.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_salary = s.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id'; $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('user').')'; } From 201d7bf90113dfb348eb5bff38b3f5b2c3d425e9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 23 Oct 2024 20:25:48 +0200 Subject: [PATCH 43/72] FIX #31452 Predefined supplier invoice - Langage key & link to supplier card (#31514) --- htdocs/fourn/facture/card-rec.php | 34 +++++++++++++++---------------- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 9655de0b780bb..8998a54eb5468 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1,16 +1,16 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016 Meziane Sof - * Copyright (C) 2017-2018 Frédéric France - * Copyright (C) 2023-2024 Nick Fragoulis - * Copyright (C) 2024 MDW +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015-2024 Alexandre Spangaro + * Copyright (C) 2016 Meziane Sof + * Copyright (C) 2017-2018 Frédéric France + * Copyright (C) 2023-2024 Nick Fragoulis + * Copyright (C) 2024 MDW * * 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 @@ -28,7 +28,7 @@ /** * \file htdocs/fourn/facture/card-rec.php - * \ingroup invoice fournisseurs + * \ingroup supplier invoice * \brief Page to show predefined invoice */ @@ -478,7 +478,7 @@ } if ($qty < 0) { $langs->load("errors"); - setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + setEventMessages($langs->trans('ErrorQtyForSupplierInvoiceCantBeNegative'), null, 'errors'); $error++; } @@ -819,7 +819,7 @@ } if ($qty < 0) { $langs->load("errors"); - setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + setEventMessages($langs->trans('ErrorQtyForSupplierInvoiceCantBeNegative'), null, 'errors'); $error++; } @@ -931,7 +931,7 @@ print ''; // Third party - print '' . $langs->trans("Customer") . '' . $object->thirdparty->getNomUrl(1, 'customer') . ''; + print '' . $langs->trans("Supplier") . '' . $object->thirdparty->getNomUrl(1, 'supplier') . ''; print ''; // Invoice subtype @@ -944,7 +944,7 @@ $note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public; $note_private = GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : $object->note_private; - // Help of substitution key + // Help for substitution key $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index ac68295b535d2..bbaa74bba2db3 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -141,6 +141,7 @@ ErrorFieldCantBeNegativeOnInvoice=Field %s cannot be negative o ErrorLinesCantBeNegativeForOneVATRate=Total of lines (net of tax) can't be negative for a given not null VAT rate (Found a negative total for VAT rate %s%%). ErrorLinesCantBeNegativeOnDeposits=Lines can't be negative in a deposit. You will face problems when you will need to consume the deposit in final invoice if you do so. ErrorQtyForCustomerInvoiceCantBeNegative=Quantity for line into customer invoices can't be negative +ErrorQtyForSupplierInvoiceCantBeNegative=Quantity for line into supplier invoices can't be negative ErrorWebServerUserHasNotPermission=User account %s used to execute web server has no permission for that ErrorNoActivatedBarcode=No barcode type activated ErrUnzipFails=Failed to unzip %s with ZipArchive From a11e369e5c3c92e1677c3b116ea32eb6fb1142c4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 23 Oct 2024 20:49:49 +0200 Subject: [PATCH 44/72] FIX Salary - Payment card - Missing date (#31512) * FIX Salary - Payment card - Missing date * Coryright --- htdocs/salaries/class/paymentsalary.class.php | 9 +++++---- htdocs/salaries/payment_salary/card.php | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 96d414b1d120c..cea7ce1948f24 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2011-2024 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -343,6 +343,7 @@ public function fetch($id) $this->datec = $this->db->jdate($obj->datec); $this->tms = $this->db->jdate($obj->tms); $this->datepaye = $this->db->jdate($obj->datep); + $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepayment = $obj->fk_typepayment; $this->num_paiement = $obj->num_payment; diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 5f30b4fb11821..a15fb006e1057 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -4,7 +4,9 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * Copyright (C) 2024 Alexandre SPANGARO + * Copyright (C) 2024 Frédéric France * * 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 From c48b035a1552fd05f589607c70947e5e82d91699 Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:59:46 +0200 Subject: [PATCH 45/72] =?UTF-8?q?FIX=20issue=20on=20action=20set=20conditi?= =?UTF-8?q?on=20in=20particular=20when=20you=20set=20a=20deposi=E2=80=A6?= =?UTF-8?q?=20(#31518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix issue on action set condition in particular when you set a deposit cond on propal * fix some identation issues * fix retour github actions pre commit * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/card.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 97ed893601d0f..63dd1ae743655 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -146,7 +146,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { $backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php'; @@ -1614,7 +1613,20 @@ $result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payment - $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha')); + $sql = "SELECT code "; + $sql .= "FROM " . $db->prefix() . "c_payment_term"; + $sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int')); + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + if ($obj->code == 'DEP30PCTDEL') { + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha')); + } else { + $object->deposit_percent = 0; + $object->update($user); + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), $object->deposit_percent); + } + } } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { From 1778401423447338d93ea79c0144fb07812d587b Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+BB2A-Anthony@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:06:00 +0200 Subject: [PATCH 46/72] FIX---PHP-warning-multiprice-in-liste-product-if-level-is-not-defined-on-product (#31507) * FIX - PHP warning multiprice in liste product if level is not defined on product * Update list.php --------- Co-authored-by: Anthony Berton Co-authored-by: Laurent Destailleur --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 09eb8cc08e986..f4dbed9b1561a 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1949,7 +1949,7 @@ foreach ($arraypricelevel as $key => $value) { if (!empty($arrayfields['p.sellprice'.$key]['checked'])) { print ''; - if (!empty($productpricescache[$obj->rowid])) { + if (!empty($productpricescache[$obj->rowid]) && isset($productpricescache[$obj->rowid][$key]['price_base_type'])) { if ($productpricescache[$obj->rowid][$key]['price_base_type'] == 'TTC') { print ''.price($productpricescache[$obj->rowid][$key]['price_ttc']).' '.$langs->trans("TTC").''; } else { From b37b2ba76fad3a66f4de914c66dd366c1287ff3d Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 23 Oct 2024 23:08:05 +0200 Subject: [PATCH 47/72] fix: test on const with space.... (#31505) --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 804451777b84b..90555b00b0cc3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -321,7 +321,7 @@ $object->date = dol_now(); } - if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { + if (!empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { $last_of_type = $object->willBeLastOfSameType(true); if (empty($object->date_validation) && !$last_of_type[0]) { setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); From 39afafc5859ffa5534171732315a4ff7a35ba8d2 Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:11:02 +0200 Subject: [PATCH 48/72] FIX: If you have no stock of your product, an error is displayed when you delete the reception. (#31504) * fix * delete * f * indent * indent --- htdocs/reception/class/reception.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ca1d87b076f7c..cc8c0923e85db 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1058,6 +1058,11 @@ public function delete(User $user) $mouvS->origin = null; $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) { + $error++; + $this->error = $mouvS->error; + $this->errors = $mouvS->errors; + } } } else { $error++; $this->errors[] = "Error ".$this->db->lasterror(); From e8f7237c63d6f7e69521d7e0a621a8c10daa1f32 Mon Sep 17 00:00:00 2001 From: mikygee Date: Wed, 23 Oct 2024 23:52:08 +0200 Subject: [PATCH 49/72] Bug fix #31369 date_solde not taken into account when sent through API (#31490) * Bug fix #31369 date_solde not taken into account when sent through API * Move $account->date_solde = time() above --------- Co-authored-by: mikael Co-authored-by: Laurent Destailleur --- htdocs/compta/bank/class/api_bankaccounts.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 663eef6f6f391..1726f6395a730 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -159,6 +159,8 @@ public function post($request_data = null) $result = $this->_validate($request_data); $account = new Account($this->db); + // Date of the initial balance (required to create an account). + $account->date_solde = time(); foreach ($request_data as $field => $value) { if ($field === 'caller') { // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller @@ -168,8 +170,6 @@ public function post($request_data = null) $account->$field = $this->_checkValForAPI($field, $value, $account); } - // Date of the initial balance (required to create an account). - $account->date_solde = time(); // courant and type are the same thing but the one used when // creating an account is courant $account->courant = $account->type; // deprecated From 23722b3db8d60f82f30b3e952b13aeb4a5fe75b3 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 02:54:31 +0200 Subject: [PATCH 50/72] Fix v20 linked doc note info repeated (#31462) * FIX : space used by linked elements in PDF notes * fix data repeated on object public note --- htdocs/core/lib/pdf.lib.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index a3d2a9ebdedfb..e5f6695c92908 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2501,10 +2501,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $outputlangs->load('orders'); if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); - foreach ($objects as $elementobject) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); + if (empty($object->context['DolPublicNoteAppendedGetLinkedObjects'])) { // Check if already appended before add to avoid repeat data + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); + foreach ($objects as $elementobject) { + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); + } } } elseif (count($objects) == 1) { $elementobject = array_shift($objects); @@ -2563,7 +2565,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } } - $object->note_public = dol_concatdesc($object->note_public, $refListsTxt); + if (empty($object->context['DolPublicNoteAppendedGetLinkedObjects'])) { // Check if already appended before add to avoid repeat data + $object->note_public = dol_concatdesc($object->note_public, $refListsTxt); + } } elseif (count($objects) == 1) { $elementobject = array_shift($objects); $order = null; @@ -2601,6 +2605,8 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } } + $object->context['DolPublicNoteAppendedGetLinkedObjects'] = 1; + // For add external linked objects if (is_object($hookmanager)) { $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs); From d9d0618eec42f549e82c21d3178f8221a8077550 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Oct 2024 03:06:23 +0200 Subject: [PATCH 51/72] Fix avoid unexpected deletion on accounting account when using multicompany --- htdocs/install/mysql/migration/repair.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index d7fba7d6918fd..ef8989f34da0c 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -310,7 +310,7 @@ drop table tmp_societe_double; -- Sequence to removed duplicated values of llx_accounting_account. Run several times if you still have duplicate. drop table tmp_accounting_account_double; --select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2; -create table tmp_accounting_account_double as (select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2); +create table tmp_accounting_account_double as (select account_number, fk_pcg_version, entity, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version, entity having count(rowid) >= 2); --select * from tmp_accounting_account_double; delete from llx_accounting_account where (rowid) in (select max_rowid from tmp_accounting_account_double); --update to avoid duplicate, delete to delete drop table tmp_accounting_account_double; From 399d778a7e337ceb1977038f09661bb5d66e7a60 Mon Sep 17 00:00:00 2001 From: ATM-NicolasV <92087862+ATM-NicolasV@users.noreply.github.com> Date: Thu, 24 Oct 2024 03:14:23 +0200 Subject: [PATCH 52/72] Fix:edition rapide de la date de livraison et propagation vers la commande (#31437) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * pouvoir modifier la date de livraison au statut brouillon et propagation de la valeur lors de la création d'une commande * remove comment --------- Co-authored-by: ATM-nicolasV --- htdocs/fourn/commande/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 10683c77d9ac6..29f547e5da15d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1814,7 +1814,7 @@ $usehourmin = 1; } print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, '', "set"); + print $form->selectDate($datedelivery ?: -1, 'liv_', $usehourmin, $usehourmin, '', "set"); print ''; // Bank Account diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 2a9841bad76fb..8d831e96da19e 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1692,7 +1692,7 @@ print ''; - if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { + if ($action != 'editdate_livraison' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { print ''; } print '
'; print $langs->trans('DeliveryDate'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'
'; From e31adc98faefc3afc352a3fa8fb64d7f7c9d9649 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:57:57 +0200 Subject: [PATCH 53/72] Fix watermark alpha transparency (#31535) --- htdocs/core/lib/pdf.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e5f6695c92908..92b538c5824ed 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -814,17 +814,24 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) $watermark_x = $w / 2; $watermark_y = $h / 3; $pdf->SetFont('', 'B', 40); - $pdf->SetTextColor(255, 192, 203); + $pdf->SetTextColor(255, 0, 0); //rotate $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k)); //print watermark $pdf->SetXY($watermark_x_pos, $watermark_y_pos); + + // set alpha to semi-transparency + $pdf->SetAlpha(0.3); $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0); + //antirotate $pdf->_out('Q'); $pdf->SetXY($savx, $savy); + + // Restore alpha + $pdf->SetAlpha(1); } From 57614cc4666cff48da6ea6c318927fccf40a816a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 24 Oct 2024 13:59:02 +0200 Subject: [PATCH 54/72] FIX #31365 Bank - Card - Ref haven't max length in edit mode (#31533) --- htdocs/compta/bank/card.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 3c5b4534a1158..5f853b553bde6 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -1,13 +1,13 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2014-2017 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Marcos García - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2022 Charlene Benke +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2014-2024 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Marcos García + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2022 Charlene Benke * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -950,7 +950,7 @@ // Ref print ''.$langs->trans("Ref").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; From 58cbfa8c877f51fe0111cb0dbd496d22d013e1cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Oct 2024 17:59:35 +0200 Subject: [PATCH 55/72] FIX Edit a link --- htdocs/core/class/html.formfile.class.php | 3 +-- htdocs/core/class/link.class.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index de999b305bb2d..8cf0dc801cebb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -2153,11 +2153,10 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s if ($nboflinks > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; } - foreach ($links as $link) { print ''; //edit mode - if ($action == 'update' && $selected === $link->id) { + if ($action == 'update' && $selected === (int) $link->id) { print ''; print ''; print ''; diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 34f05db4c1152..8ea08e7d52a6a 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -254,7 +254,7 @@ public function fetchAll(&$links, $objecttype, $objectid, $sortfield = null, $so if ($num > 0) { while ($obj = $this->db->fetch_object($resql)) { $link = new Link($this->db); - $link->id = $obj->rowid; + $link->id = (int) $obj->rowid; $link->entity = $obj->entity; $link->datea = $this->db->jdate($obj->datea); $link->url = $obj->url; From 3e9068c1c64227643af304a9a0689a00c369ab4b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 25 Oct 2024 13:42:46 +0200 Subject: [PATCH 56/72] FIX Accountancy - Loan - Error on transfer (#31546) --- htdocs/accountancy/journal/bankjournal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index c37587dadc3e5..aa17090174e18 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -562,9 +562,9 @@ $resultmid = $db->query($sqlmid); if ($resultmid) { $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_capital]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : $amounttouse; - $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_insurance]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : $amounttouse; - $tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_interest]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interes : $amounttouse; + $tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($objmid->amount_capital) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : 0; + $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($objmid->amount_insurance) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : 0; + $tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($objmid->amount_interest) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interest : 0; } } elseif ($links[$key]['type'] == 'banktransfert') { $accountLinestatic->fetch($links[$key]['url_id']); From c42605b0c5ba2a112333b98c173302798300d7f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Oct 2024 16:41:25 +0200 Subject: [PATCH 57/72] FIX Filter on month of the balance of leaves. --- htdocs/holiday/view_log.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index d18fc712d61fd..1f7a95c706e00 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -337,7 +337,7 @@ // Filter: Date if (!empty($arrayfields['cpl.date_action']['checked'])) { print ''; - print ''; + print ''; print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'valignmiddle width75', true); print ''; } @@ -560,8 +560,8 @@ } if ($log_holiday == '2') { - print ''; - print ''.$langs->trans('NoRecordFound').''; + print ''; + print ''.$langs->trans('NoRecordFound').''; print ''; } From 9746e84d9e63157008238a46682bcb13182b2c9f Mon Sep 17 00:00:00 2001 From: iLLixM <162678117+iLLixM@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:14:48 +0200 Subject: [PATCH 58/72] =?UTF-8?q?FIX=20#31538=20Addition=20to=20EPC-QR=20v?= =?UTF-8?q?alues=20=E2=80=8B=E2=80=8Bto=20correct=20remittance=20informati?= =?UTF-8?q?on=20(#31557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/commoninvoice.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 430c477e89a35..abc8f7e2a4995 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1690,6 +1690,7 @@ public function buildEPCQrCodeString() // Add the amount and reference $lines[] = 'EUR' . $totalTTCString; // Amount (optional) + $lines[] = ''; // Purpose (optional) $lines[] = ''; // Payment reference (optional) $lines[] = $this->ref; // Remittance Information (optional) From 93edeb48fe08a3feda0eb731df79257cbc8eb331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Oct 2024 15:54:16 +0200 Subject: [PATCH 59/72] Fix missing token --- htdocs/fourn/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 0bede5a6b4d37..fc5b6a8c93387 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3584,9 +3584,9 @@ function setRadioForTypeOfInvoice() { // Show link for "recalculate" if ($object->getVentilExportCompta() == 0) { $s = '' . $langs->trans("ReCalculate") . ' '; - $s .= '' . $langs->trans("Mode1") . ''; + $s .= '' . $langs->trans("Mode1") . ''; $s .= ' / '; - $s .= '' . $langs->trans("Mode2") . ''; + $s .= '' . $langs->trans("Mode2") . ''; print '
'; print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '
' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); print '       '; From eaa31ed4a3c444350469c979919510b5f94b153b Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Mon, 28 Oct 2024 21:16:17 +0100 Subject: [PATCH 60/72] FIX: Fix bug select columns and acces to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000) --- htdocs/public/ticket/list.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index a73e669e5d6ca..035e66d973178 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -69,10 +69,10 @@ unset($_SESSION['track_id_customer']); unset($_SESSION['email_customer']); } -if (isset($_SESSION['track_id_customer'])) { +if (empty($track_id) && isset($_SESSION['track_id_customer'])) { $track_id = $_SESSION['track_id_customer']; } -if (isset($_SESSION['email_customer'])) { +if (empty($email) && isset($_SESSION['email_customer'])) { $email = strtolower($_SESSION['email_customer']); } @@ -209,6 +209,7 @@ // Store current page url $url_page_current = dol_buildpath('/public/ticket/list.php', 1); + $contextpage = $url_page_current; // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x")) { @@ -266,7 +267,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate') { - $enabled = abs(dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1, 1, 0)); + $enabled = abs((int) dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1, 1, 0)); $enabled = (($enabled == 0 || $enabled == 3) ? 0 : $enabled); $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => ($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1, 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $enabled && $extrafields->attributes[$object->table_element]['perms'][$key]); } From 3caead1dc086ebef46fae311689649078deb3f24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Oct 2024 11:48:06 +0100 Subject: [PATCH 61/72] Help debug with button "Refresh token" --- htdocs/admin/emailcollector_card.php | 2 +- htdocs/admin/oauthlogintokens.php | 109 +++++++++++++++++- .../class/emailcollector.class.php | 17 ++- .../OAuth/OAuth2/Service/AbstractService.php | 21 +++- 4 files changed, 143 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index e5bf314225909..c25d024099548 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -413,7 +413,7 @@ } else { $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; if (!empty($supportedoauth2array)) { diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 08f98cebad58f..8471f14da08d0 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; $supportedoauth2array = getSupportedOauth2Array(); @@ -114,6 +115,101 @@ $action = ''; } +// Test a refresh of a token using the refresh token +if ($action == 'refreshtoken' && $user->admin) { + $keyforprovider = GETPOST('keyforprovider'); + $OAUTH_SERVICENAME = GETPOST('service'); + + // Show value of token + $tokenobj = null; + // Load OAUth libraries + require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + + $keyforsupportedoauth2array = $OAUTH_SERVICENAME; + if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); + } else { + $keyforprovider = ''; + } + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); + $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; + + $keyforparamtenant = 'OAUTH_'.strtoupper(empty($supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']).($keyforprovider ? '-'.$keyforprovider : '').'_TENANT'; + + // Dolibarr storage + $storage = new DoliStorage($db, $conf, $keyforprovider, getDolGlobalString($keyforparamtenant)); + try { + // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' + print ''."\n"; + + dol_syslog("oauthlogintokens.php: Read token for service ".$OAUTH_SERVICENAME); + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + + $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30)); + // We have to save the refresh token in a memory variable because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); + print ''; + + //print $tokenobj->getExtraParams()['id_token'].'
'; + //print $tokenobj->getAccessToken().'
'; + //print $tokenobj->getRefreshToken().'
'; + + //var_dump($expire); + + // We do the refresh even if not expired, this is the goal of action. + $oauthname = explode('-', $OAUTH_SERVICENAME); + $keyforoauthservice = strtoupper($oauthname[0]).(empty($oauthname[1]) ? '' : '-'.$oauthname[1]); + $credentials = new Credentials( + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_ID'), + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_SECRET'), + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_URLCALLBACK') + ); + + $serviceFactory = new \OAuth\ServiceFactory(); + $httpClient = new \OAuth\Common\Http\Client\CurlClient(); + // TODO Set options for proxy and timeout + // $params=array('CURLXXX'=>value, ...) + //$httpClient->setCurlParameters($params); + $serviceFactory->setHttpClient($httpClient); + + $scopes = array(); + if (preg_match('/^Microsoft/', $OAUTH_SERVICENAME)) { + //$extraparams = $tokenobj->getExtraParams(); + $tmp = explode('-', $OAUTH_SERVICENAME); + $scopes = explode(',', getDolGlobalString('OAUTH_'.strtoupper($tmp[0]).(empty($tmp[1]) ? '' : '-'.$tmp[1]).'_SCOPE')); + } + + // ex service is Google-Emails we need only the first part Google + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, $scopes); + + if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) { + // ServiceInterface does not provide refreshAccessToekn, AbstractService does + dol_syslog("oauthlogintokens.php: call refreshAccessToken to get the new access token"); + $tokenobj = $apiService->refreshAccessToken($tokenobj); // This call refresh and store the new token (but does not include the refresh token) + + dol_syslog("oauthlogintokens.php: call setRefreshToken"); + $tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token + + dol_syslog("oauthlogintokens.php: call storeAccessToken to save the new access token + the old refresh token"); + $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); // This save the new token including the refresh token + + if ($expire) { + setEventMessages($langs->trans("OldTokenWasExpiredItHasBeenRefresh"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("OldTokenWasNotExpiredButItHasBeenRefresh"), null, 'mesgs'); + } + } else { + dol_print_error($db, 'apiService is not a correct OAUTH2 Abstract service'); + } + + dol_syslog("oauthlogintokens.php: Read token again for service ".$OAUTH_SERVICENAME); + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + } catch (Exception $e) { + // Return an error if token not found + print $e->getMessage(); + } +} + /* * View @@ -176,7 +272,7 @@ $keybeforeprovider = $keyforsupportedoauth2array; $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; $nameofservice = ucfirst(strtolower(empty($supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'])); @@ -191,6 +287,8 @@ } $state = $shortscope; // TODO USe a better state + $urltorefresh = $_SERVER["PHP_SELF"].'?action=refreshtoken&token='.newToken(); + // Define $urltorenew, $urltodelete, $urltocheckperms if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). @@ -220,6 +318,9 @@ if ($urltorenew) { $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); } + if ($urltorefresh) { + $urltorefresh .= '&keyforprovider='.urlencode($keyforprovider).'&service='.urlencode($OAUTH_SERVICENAME); + } if ($urltodelete) { $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); } @@ -234,6 +335,7 @@ // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' print ''."\n"; $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + print ''; //print $storage->token.'
'; //print $tokenobj->getExtraParams()['id_token'].'
'; //print $tokenobj->getAccessToken().'
'; @@ -348,6 +450,11 @@ print $form->textwithpicto('', $langs->trans('RequestAccess')); print '
'; } + // Request remote token + if ($urltorefresh && $refreshtoken) { + print ''.$langs->trans('RefreshToken').''; + } + // Check remote access if ($urltocheckperms) { print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index cfa1c65e93cfa..bab0e76a46fe5 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1144,7 +1144,7 @@ public function doCollectOneCollector($mode = 0) } else { $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; if (!empty($supportedoauth2array)) { @@ -1185,11 +1185,22 @@ public function doCollectOneCollector($mode = 0) $serviceFactory = new \OAuth\ServiceFactory(); $oauthname = explode('-', $OAUTH_SERVICENAME); // ex service is Google-Emails we need only the first part Google - $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + + $scopes = array(); + if (preg_match('/^Microsoft/', $OAUTH_SERVICENAME)) { + //$extraparams = $tokenobj->getExtraParams(); + $tmp = explode('-', $OAUTH_SERVICENAME); + $scopes = explode(',', getDolGlobalString('OAUTH_'.strtoupper($tmp[0]).(empty($tmp[1]) ? '' : '-'.$tmp[1]).'_SCOPE')); + } + + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, $scopes); + '@phan-var-force OAuth\OAuth2\Service\AbstractService|OAuth\OAuth1\Service\AbstractService $apiService'; // createService is only ServiceInterface - // We have to save the token because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); $tokenobj = $apiService->refreshAccessToken($tokenobj); + + // We have to save the token because answer give it only once $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); } diff --git a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php index b6f89118d8359..bc28762c688ff 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php +++ b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php @@ -218,12 +218,31 @@ public function refreshAccessToken(TokenInterface $token) 'refresh_token' => $refreshToken, ); + // @CHANGE LDR + //global $conf; $conf->global->OAUTH_ADD_SCOPE_AND_TENANT_IN_REFRESH_MESSAGE = 1; + if (getDolGlobalString('OAUTH_ADD_SCOPE_AND_TENANT_IN_REFRESH_MESSAGE')) { + if (!empty($this->scopes)) { + $parameters['scope'] = implode($this->getScopesDelimiter(), $this->scopes); + } + if ($this->storage->getTenant()) { + $parameters['tenant'] = $this->storage->getTenant(); + } + } + //var_dump($parameters); + $responseBody = $this->httpClient->retrieveResponse( $this->getAccessTokenEndpoint(), $parameters, $this->getExtraOAuthHeaders() ); - //print $responseBody;exit; // We must have a result "{"token_type":"Bearer","scope... + + + // @CHANGE LDR + $data = json_decode((string) $responseBody, true); + if (is_array($data) && !empty($data['error_description'])) { + print 'Oauth2 AbstractService error received: '.$data['error_description']; + } + //print $responseBody;exit; // We must have a result string "{"token_type":"Bearer","error_description":...,"scope... $token = $this->parseAccessTokenResponse($responseBody); $this->storage->storeAccessToken($this->service(), $token); From f35052937830ee8940d876aa7d30d1c0479ddf16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Oct 2024 15:16:35 +0100 Subject: [PATCH 62/72] Fix export salary --- htdocs/core/modules/modSalaries.class.php | 13 ++++++------- htdocs/langs/en_US/salaries.lang | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index 48d5c82111f44..d82d9b4f04873 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -44,8 +44,6 @@ class modSalaries extends DolibarrModules */ public function __construct($db) { - global $conf; - $this->db = $db; $this->numero = 510; // Perms from 501..519 @@ -151,17 +149,18 @@ public function __construct($db) $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'SalariesAndPayments'; + $this->export_icon[$r] = 'salary'; $this->export_permission[$r] = array(array("salaries", "export")); - $this->export_fields_array[$r] = array('u.firstname'=>"Firstname", 'u.lastname'=>"Lastname", 'u.login'=>"Login", 'u.salary'=>'CurrentSalary', 'p.datep'=>'DatePayment', 'p.datesp'=>'DateStartPeriod', 'p.dateep'=>'DateEndPeriod', 'p.amount'=>'AmountPayment', 'p.num_payment'=>'Numero', 'p.label'=>'Label', 'p.note'=>'Note'); - $this->export_TypeFields_array[$r] = array('u.firstname'=>"Text", 'u.lastname'=>"Text", 'u.login'=>'Text', 'u.salary'=>"Numeric", 'p.datep'=>'Date', 'p.datesp'=>'Date', 'p.dateep'=>'Date', 'p.amount'=>'Numeric', 'p.num_payment'=>'Numeric', 'p.label'=>'Text'); + $this->export_fields_array[$r] = array('s.rowid' => 'SalaryID', 's.label'=>'Label', 's.datesp'=>'DateStartPeriod', 's.dateep'=>'DateEndPeriod', 's.amount' => 'SalaryAmount', 's.paye' => 'Status', 'u.firstname'=>"Firstname", 'u.lastname'=>"Lastname", 'u.login'=>"Login", 'u.salary'=>'CurrentSalary', 'p.datep'=>'DatePayment', 'p.amount'=>'AmountPayment', 'p.num_payment'=>'Numero', 'p.note'=>'Note'); + $this->export_TypeFields_array[$r] = array('s.rowid' => 'Numeric', 's.label'=>'Text', 's.amount' => 'Numeric', 's.paye' => 'Numeric', 'u.firstname'=>"Text", 'u.lastname'=>"Text", 'u.login'=>'Text', 'u.salary'=>"Numeric", 'p.datep'=>'Date', 's.datesp'=>'Date', 's.dateep'=>'Date', 'p.amount'=>'Numeric', 'p.num_payment'=>'Numeric'); $this->export_entities_array[$r] = array('u.firstname'=>'user', 'u.lastname'=>'user', 'u.login'=>'user', 'u.salary'=>'user', 'p.datep'=>'payment', 'p.datesp'=>'payment', 'p.dateep'=>'payment', 'p.amount'=>'payment', 'p.label'=>'payment', 'p.note'=>'payment', 'p.num_payment'=>'payment'); $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'salary as s ON s.fk_user = u.rowid'; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'salary as s'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON s.fk_user = u.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_salary = s.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id'; - $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('user').')'; + $this->export_sql_end[$r] .= ' AND s.entity IN ('.getEntity('salary').')'; } diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index adf8ed60dff16..2a6c1d4fe2932 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -9,6 +9,8 @@ NewSalary=New salary AddSalary=Add salary NewSalaryPayment=New salary card AddSalaryPayment=Add salary payment +SalaryID=Salary ID +SalaryAmount=Salary amount SalaryPayment=Salary payment SalariesPayments=Salaries payments SalariesPaymentsOf=Salaries payments of %s From a186e16568abb5117c8098633658bcd6f2f901ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Oct 2024 15:32:54 +0100 Subject: [PATCH 63/72] Backport fix for mysql 8 export --- htdocs/core/class/utils.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index d0c91199c5509..d8fb319bda5fa 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -390,7 +390,7 @@ public function dumpDatabase($compression = 'none', $type = 'auto', $usedefault if ($compression == 'none') fclose($handle); if ($compression == 'gz') gzclose($handle); if ($compression == 'bz') bzclose($handle); - if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error + if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*M?!999999/', $errormsg)) { // Start of file is ok, NOT an error $errormsg = ''; } else From 8b4dcb1194362baa455a9a5cf5f9ca7abff8c22e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Oct 2024 15:43:16 +0100 Subject: [PATCH 64/72] FIX email templates for expense report not visible --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1b583102a5be4..37b5faf54fe68 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2858,7 +2858,7 @@ } // Presend form -$modelmail = 'expensereport'; +$modelmail = 'expensereport_send'; $defaulttopic = 'SendExpenseReportRef'; $diroutput = $conf->expensereport->dir_output; $trackid = 'exp'.$object->id; From 2350d1df99cc487b3b40507e4c7dbf65b609eb96 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Oct 2024 21:35:51 +0100 Subject: [PATCH 65/72] FIX a dictionary CANNOT have zero value in entity field (#31625) --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 40fa8f3ee14e8..11470af801094 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -434,7 +434,7 @@ function getEntity($element, $shared = 1, $currentobject = null) $out = $mc->getEntity($element, $shared, $currentobject); } else { $out = ''; - $addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'c_holiday_types', 'email_template', 'default_values', 'overwrite_trans'); + $addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'email_template', 'default_values', 'overwrite_trans'); if (in_array($element, $addzero)) { $out .= '0,'; } From dc73fe6d68ae736fe2b78ecb89b1f99a8b461fcf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Oct 2024 21:40:32 +0100 Subject: [PATCH 66/72] Fix add option to restore compatibility --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 11470af801094..ebe210afbc8d2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -435,6 +435,9 @@ function getEntity($element, $shared = 1, $currentobject = null) } else { $out = ''; $addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'email_template', 'default_values', 'overwrite_trans'); + if (getDolGlobalString('HOLIDAY_ALLOW_ZERO_IN_DIC')) { + $addzero[] = 'c_holiday_types'; + } if (in_array($element, $addzero)) { $out .= '0,'; } From 9e1c640eeed7cdca52bd463ca1a9738255f750b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Oct 2024 18:03:31 +0100 Subject: [PATCH 67/72] FIX open redirection --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 40fa8f3ee14e8..d6bd59ef75786 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1041,8 +1041,8 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } // Sanitizing for special parameters. - // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. - if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') { + // Note: There is no reason to allow the backtopage/backtopageforcancel/backtopagejs, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. + if (preg_match('/backtopage/', $paramname) || $paramname == 'backtolist' || $paramname == 'backtourl') { $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retrieve it after other replacements. do { From 7343384c71a2a401ad4bce777b973c9e2dbba8a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Oct 2024 18:12:01 +0100 Subject: [PATCH 68/72] Removed doc --- .../jquery/plugins/jpicker/Example.html | 774 ------------------ 1 file changed, 774 deletions(-) delete mode 100644 htdocs/includes/jquery/plugins/jpicker/Example.html diff --git a/htdocs/includes/jquery/plugins/jpicker/Example.html b/htdocs/includes/jquery/plugins/jpicker/Example.html deleted file mode 100644 index b93bd0152e3b3..0000000000000 --- a/htdocs/includes/jquery/plugins/jpicker/Example.html +++ /dev/null @@ -1,774 +0,0 @@ - - - - - - Digital Magic Productions - jPicker - A jQuery Color Picker Plugin - - - - - - - -
-

jPicker - A jQuery Color Picker Plugin.

-

- jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects. It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.

- jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari, and Opera.

- If you are updating a current version, you MUST always use the CSS and image files from the download as there may have been changes.

- If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the Color object returned by the callback functions.

- View John Dyer's prototype plugin here.

- View jPicker details a docs below.

- Check out the source from Google Code. -



-

jPicker Inline Example

-

- jPicker can be used inline by binding to any block level element.

- jPicker() -- no arguments -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#Inline').jPicker();
-    });
-</script>
-<div id="Inline"></div>
-
-



-

jPicker Expandable Example

-

- jPicker can also display only a small picker icon that opens a popup for editing.

- jPicker({ window: { expandable: true }}) -

-<script type="text/javascript">
-  $(document).ready(
-    function()
-    {
-      $('#Expandable').jPicker(
-        {
-          window:
-          {
-            expandable: true
-          }
-        });
-    });
-</script>
-<span id="Expandable"></span>
- -



-

jPicker Alpha Channel Example

-

- jPicker can also pick colors with alpha (transparency) values.

- jPicker({ window: { expandable: true }}) -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#Alpha').jPicker(
-        {
-          window:
-          {
-            expandable: true
-          },
-          color:
-          {
-            alphaSupport: true,
-            active: new $.jPicker.Color({ ahex: '99330099' })
-          }
-        });
-    });
-</script>
-<span id="Alpha"></span>
- -



-

jPicker Binded Example

-

- jPicker can also be binded to an input element.

- jPicker() -- no arguments -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#Binded').jPicker();
-    });
-</script>
-<input id="Binded" type="text" value="e2ddcf" />
- -



-

Multiple jPicker Binded Example

-

- jPicker can also be binded to multiple elements at a time.

- jPicker() -- no arguments -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('.Multiple').jPicker();
-    });
-</script>
-<input class="Multiple" type="text" value="e2ddcf" /><br />
-<input class="Multiple" type="text" value="" /><br />
-<input class="Multiple" type="text" value="fda0f7" />
-
-
-
-



-

jPicker Callback Functions

-

- Register for callback function to have it interact with your page.

- jPicker([settings, [commitCallback, [liveCallback, [cancelCallback]]]]) -

-<script type="text/javascript">
-  $(document).ready(
-    function()
-    {
-      var LiveCallbackElement = $('#Live'),
-          LiveCallbackButton = $('#LiveButton');  // you don't want it searching this
-                                                  // on every live callback!!!
-      $('#Callbacks').jPicker(
-        {},
-        function(color, context)
-        {
-          var all = color.val('all');
-          alert('Color chosen - hex: ' + (all && '#' + all.hex || 'none') +
-            ' - alpha: ' + (all && all.a + '%' || 'none'));
-          $('#Commit').css(
-            {
-              backgroundColor: all && '#' + all.hex || 'transparent'
-            }); // prevent IE from throwing exception if hex is empty
-        },
-        function(color, context)
-        {
-          if (context == LiveCallbackButton.get(0)) alert('Color set from button');
-          var hex = color.val('hex');
-          LiveCallbackElement.css(
-            {
-              backgroundColor: hex && '#' + hex || 'transparent'
-            }); // prevent IE from throwing exception if hex is empty
-        },
-        function(color, context)
-        {
-          alert('"Cancel" Button Clicked');
-        });      
-      $('#LiveButton').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('hex', 'e2ddcf', this);
-        });
-    });
-</script>
-<input id="Callbacks" type="text" value="e2ddcf" />
-<span id="Commit" style="background-color: #e2ddcf; display: block; --
-          float: left; height: 50px; margin: 10px; width: 50px;"> --
-          Commit</span>
-<span id="Live" style="display: block; float: left; height: 50px; --
-          margin: 10px; width: 50px;">Live</span>
-<input id="LiveButton" type="button" value="Set To #e2ddcf" />
-
- Commit - Live - -



-

jPicker Settings And Colors

-

- Use the "val" method on the active color for interaction with the picker.

- (jQuery).jPicker.List[index] -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#AlterColors').jPicker();
-      $('#GetActiveColor').click(
-        function()
-        {
-          alert($.jPicker.List[0].color.active.val('ahex'));
-        });
-      $('#GetRG').click(
-        function()
-        {
-          var rg=$.jPicker.List[0].color.active.val('rg');
-          alert('red: ' + rg.r + ', green: ' + rg.g);
-        });
-      $('#SetHue').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('h', 133);
-        });
-      $('#SetValue').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('v', 38);
-        });
-      $('#SetRG').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('rg', { r: 213, g: 118 });
-        });
-    });
-</script>
-<input id="AlterColors" type="text" value="e2ddcf" /><br />
-<input id="GetActiveColor" type="button" value="Get Active Color" /><br />
-<input id="GetRG" type="button" value="Get Red/Green Value" /><br />
-<input id="SetHue" type="button" value="Set Hue To 133" /><br />
-<input id="SetValue" type="button" value="Set Value To 38" /><br />
-<input id="SetRG" type="button" value="Set Red/Green To 213, 118" />
-
-
-
-
-
- -



-

jPicker Core

-

- jPicker Core function - returns the jQuery object.

- jPicker([settings, [commitCallback, [liveCallback, [cancelCallback]]]]) -



-

Settings

-

- settings [object]: (with defaults)
-

-{
-  window: // used to define the position of the popup window
-          // only useful in binded mode
-  {
-    title: null, // any title for the jPicker window itself - displays
-                 // "Drag Markers To Pick A Color" if left null
-    position:
-    {
-      x: 'screenCenter', // acceptable values "left", "center", "right",
-                         // "screenCenter", or relative px value
-      y: 'top', // acceptable values "top", "bottom", "center", or relative px
-                // value
-    },
-    expandable: false, // default to large static picker - set to true to make an
-                       // expandable picker (small icon with popup) - set
-                       // automatically when binded to input element
-    liveUpdate: true, // set false if you want the user to click "OK" before the
-                      // binded input box updates values (always "true" for
-                      // expandable picker)
-    alphaSupport: false, // set to true to enable alpha picking
-    alphaPrecision: 0, // set decimal precision for alpha percentage display -
-                       // hex codes do not map directly to percentage integers -
-                       // range 0-2
-    updateInputColor: true // set to false to prevent binded input colors from
-                           // changing
-  },
-  color:
-  {
-    mode: 'h', // acceptable values "h" (hue), "s" (saturation), "v" (brightness),
-               // "r" (red), "g" (green), "b" (blue), "a" (alpha)
-    active: new $.jPicker.Color({ hex: 'ffc000' }), // accepts any declared
-               // jPicker.Color object or hex string WITH OR WITHOUT '#'
-    quickList: // this list of quick pick colors - override for a different list
-      [
-        new $.jPicker.Color({ h: 360, s: 33, v: 100}), // accepts any declared
-               // jPicker.Color object or hex string WITH OR WITHOUT '#'
-        new $.jPicker.Color({ h: 360, s: 66, v: 100}),
-        (...) // removed for brevity
-        new $.jPicker.Color({ h: 330, s: 100, v: 50}),
-        new $.jPicker.Color()
-      ]
-  },
-  images
-  {
-    clientPath: '/jPicker/images/', // Path to image files
-    colorMap: // colorMap size and arrow icon
-    {
-      width: 256, // Map width - don't override unless using a smaller image set
-      height: 256, // Map height - don't override unles using a smaller image set
-      arrow:
-      {
-        file: 'mappoint.gif', // Arrow icon image file
-        width: 15, // Arrow icon width
-        height: 15 // Arrow icon height
-      }
-    },
-    colorBar: // colorBar size and arrow icon
-    {
-      width: 20, // Bar width - don't override unless using a smaller image set
-      height: 256, // Bar height - don't override unless using a smaller image set
-      arrow:
-      {
-        file: 'rangearrows.gif', // Arrow icon image file
-        width: 40, // Arrow icon width
-        height: 9 // Arrow icon height
-      }
-    },
-    picker: // picker icon and size
-    {
-      file: 'picker.gif', // Picker icon image file
-      width: 25, // Picker width - don't override unless using a smaller image set
-      height: 24 // Picker height - don't override unless using a smaller image set
-    }
-  },
-  localization:
-  {
-    text:
-    {
-      title: 'Drag Markers To Pick A Color',
-      newColor: 'new',
-      currentColor: 'current',
-      ok: 'OK',
-      cancel: 'Cancel'
-    },
-    tooltips:
-    {
-      colors:
-      {
-        newColor: 'New Color - Press “OK” To Commit',
-        currentColor: 'Click To Revert To Original Color'
-      },
-      buttons:
-      {
-        ok: 'Commit To This Color Selection',
-        cancel: 'Cancel And Revert To Original Color'
-      },
-      hue:
-      {
-        radio: 'Set To “Hue” Color Mode',
-        textbox: 'Enter A “Hue” Value (0-360°)'
-      },
-      saturation:
-      {
-        radio: 'Set To “Saturation” Color Mode',
-        textbox: 'Enter A “Saturation” Value (0-100%)'
-      },
-      brightness:
-      {
-        radio: 'Set To “Brightness” Color Mode',
-        textbox: 'Enter A “Brightness” Value (0-100%)'
-      },
-      red:
-      {
-        radio: 'Set To “Red” Color Mode',
-        textbox: 'Enter A “Red” Value (0-255)'
-      },
-      green:
-      {
-        radio: 'Set To “Green” Color Mode',
-        textbox: 'Enter A “Green” Value (0-255)'
-      },
-      blue:
-      {
-        radio: 'Set To “Blue” Color Mode',
-        textbox: 'Enter A “Blue” Value (0-255)'
-      },
-      alpha:
-      {
-        radio: 'Set To “Alpha” Color Mode',
-        textbox: 'Enter A “Alpha” Value (0-100)'
-      },
-      hex:
-      {
-        textbox: 'Enter A “Hex” Color Value (#000000-#ffffff)',
-        alpha: 'Enter A “Alpha” Value (#00-#ff)'
-      }
-    }
-  }
-}
-



-

Callback Pattern

-

- function(jPicker.Color color, object context){...} -



-

jPicker List

-

- The list of active jPicker objects.

- (jQuery).jPicker.List[] -



-

jPicker Color Class

-

- Definition of the jPicker.Color class.
-

-(jQuery).jPicker.Color()
-(jQuery).jPicker.Color({ ahex: 'ffffffff' })
-(jQuery).jPicker.Color({ hex: 'ffffff', [a: (0-255)] })
-(jQuery).jPicker.Color({ r: (0-255), g: (0-255), b: (0-255), [a: (0-255)] })
-(jQuery).jPicker.Color({ h: (0-360), s: (0-100), v: (0-100), [a: (0-255)] })
-{
-  val: function(name, value, context),
-  bind: function(callback) where callback is function(color, [context]),
-  unbind: function(callback)
-}
-
-method "val" usage
-
-val(name) : get value
-
-  'r':     red         (0-255)
-  'g':     green       (0-255)
-  'b':     blue        (0-255)
-  'a':     alpha       (0-255)
-  'h':     hue         (0-360)
-  's':     saturation  (0-100)
-  'v':     value       (0-100)
-  'hex':   hex         (000000-ffffff)
-  'ahex':  ahex        (00000000-ffffffff)
-  'all':   all         all
-  
-  ex. Usage
-
-    val('r'):     (0-255)
-    val('h'):     (0-360)
-    val('hex'):   (000000-ffffff)
-    val('rg'):    { r: (0-255), g: (0-255) }
-    val('rgba'):  { r: (0-255), g: (0-255), b: (0-255), a: (0-255) }
-    val('hvga'):  { h: (0-255), v: (0-100), g: (0-255), a: (0-255) }
-    val('all'):   { r: (0-255), g: (0-255), b: (0-255), a: (0-255), h: (0-360) --
-                    s: (0-100), v: (0-100), hex: (000000-ffffff), --
-                    ahex: (00000000-ffffffff) }
-
-val(name, value, [context]) : set value
-
-  'r':     red         (0-255)
-  'g':     green       (0-255)
-  'b':     blue        (0-255)
-  'a':     alpha       (0-255)
-  'h':     hue         (0-360)
-  's':     saturation  (0-100)
-  'v':     value       (0-100)
-  'hex':   hex         (000000-ffffff)
-  'ahex':  ahex        (00000000-ffffffff)
-  
-  ex. Usage
-
-    val('r', (0-255)) || val('r', { r: (0-255) })
-    val('h', (0-360)) || val('h', { h: (0-360) })
-    val('hex', (000000-ffffff)) || val('hex', { hex: (000000-ffffff) })
-    val('rg', { r: (0-255), g: (0-255) })
-    val('rgba', { r: (-255), g: (0-255), b: (0-255), a: (0-255) })
-    val(null, { r: (0-255), g: (0-255) })
-    val('hvga'):  incorrect usage - cannot set hsv AND rgb as they will conflict
-



-

jPicker ColorMethod Utility Class

-

- Static methods for altering and retrieving different color spaces.
-

-(jQuery).jPicker.ColorMethods.hexToRgba:
-    function(hex)
-    returns { r: (0-255), g: (0-255), b: (0-255), a: (0-255) }
-    
-(jQuery).jPicker.ColorMethods.validateHex:
-    function(hex)
-    returns new hex string
-    
-(jQuery).jPicker.ColorMethods.rgbaToHex:
-    function({ r: (0-255), g: (0-255), b: (0-255), a: (0-255) })
-    returns hex string
-    
-(jQuery).jPicker.ColorMethods.intToHex:
-    function(number)
-    returns hex string
-    
-(jQuery).jPicker.ColorMethods.hexToInt:
-    function(hex)
-    return integer
-
-(jQuery).jPicker.ColorMethods.rgbToHsv:
-    function({ r: (0-255), g: (0-255), b: (0-255) })
-    returns { h: (0-360), s: (0-100), v: (0-100) }
-
-(jQuery).jPicker.ColorMethods.hsvToRgb:
-    function({ h: (0-360), s: (0-100), v: (0-100) })
-    returns { r: (0-255), g: (0-255), b: (0-255) }
-
-



-

Known Issues

-
    -
  • -

    Attaching multiple jPicker objects on a single page will slow performance.

    -
      -
    • jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances.
    • -
    -
  • -

-

Coming Soon

-
    -
  • -
      -
    • Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists.
    • -
    -
  • -

-

Planned For Future Release

-
    -
  • - Move the jPicker object to a single instance that all selection instances point to. -
      -
    • This will result in much faster operation and initialization for pages with multiple pickers.
    • -
    -
  • -
  • Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element.
  • -

-

Change Log

-
    -
  • -

    V1.1.5:

    -
      -
    • Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work.
    • -
    • Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled.
    • -
    • Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled.
    • -
    • Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0.
    • -
    -
  • -
  • -

    V1.1.4:

    -
      -
    • Changed "alpha" range from 0-100 to 0-255 to correct truncating and rounding errors caused by attempting to get an integer percentage that matches a hex value.
    • -
    • "alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value.
    • -
    • Color object now accepts "alpha" values in a range of 0-255 and also returns the same when getting the "alpha" value. You will need to run ((alpha * 100) / 255) to retrieve a percentage value.
    • -
    • Reworked the table layout and labels to remove the need for the label to reference the radio input box. This reduces injected code and removes the need to generate unique ids on the radio buttons.
    • -
    • Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color.
    • -
    • Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color.
    • -
    • Added a dynamic, invisible "iframe" behind a dialog picker in all browsers that fail jQuery.support.boxModel (currently IE <= 7 Quirks Mode). This prevents "select" box from showing through the picker.
    • -
    -
  • -
  • -

    V1.1.3:

    -
      -
    • Now adding popup color pickers to document.body instead of inline with the popup control. This corrects issues with the picker not showing beyond a relative container scope.
    • -
    • No longer need to hide popup icon in Internet Explorer for picker elements lower in the DOM than the currently active one since the picker itself is attached to document.body (it is always higher in the DOM now).
    • -
    • Popup pickers are now bring-to-front selectable. Clicking on the picker will bring it above all other pickers on the page instead of having to drag one out from underneath another.
    • -
    • Corrected jPicker.List/setTimeout bug which allowed an instance to bind to the List in an order other than the order the initialization function was called.
    • -
    • Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color.
    • -
    -
    -
  • -
  • -

    V1.1.2:

    -
      -
    • Reworked the find methods and contexts for element searches. Now using ":first" instead of ".eq(0)" to take advantage of early out searches. Much faster initialization of the picker, on the order of 6 times.
    • -
    • Now using setTimeout for calling visual updates. Dramatically improved marker dragging in all browsers. Reduces blocking as re-rendering is internal to the browser and independent of the other javascript still in progress.
    • -
    • Marker updates can now cancel a previous valueChanged event when a new mouseMove event comes in. IE8 marker dragging is still slower, much over 5 times faster than it was.
    • -
    • Reworked entire quickPick list creation. It now adds up source code and does a single "html" method instead of multiple "append" methods. This is a large part of the speed increase on initialization.
    • -
    • The vast majority of all running scripts on both initialization and dragging is now occupied altering the style rules and finding elements (init only) instead of jPicker code.
    • -
    • All methods previously called with global context now use the "call" method for using the context of the class running the method. "this" in a callback is now the DOM node (jQuery style) and jPicker instead of "window".
    • -
    • Added "effects" section of window settings to allow different show/hide effects and durations.
    • -
    • Removed change log and read me from the full source code to separate files (ChangeLog.txt and ReadMe.txt) and an HTML demonstration/documentation page (Example.txt).
    • -
    -
    -
  • -
  • -

    V1.1.1:

    -
      -
    • Correct IE exception caused by attempting to set "#transparent" to CSS background-color.
    • -
    -
    -
  • -
  • -

    V1.1.0:

    -
      -
    • Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation.
    • -
    • The Color object now supports a changed event that you can bind to (or just bind to the picker events still included).
    • -
    • Event order has been reversed, instead of an change event on the map/bar/text fields updating the display, they now update the Color object which then fires the events that update the display.
    • -
    • alphaSupport re-implemented by request - default behavior is off.
    • -
    • Hex code now only 6 characters again.
    • -
    • Color object can now have its value changed from code, using the "val" method, and it will fire all events necessary to update the display.
    • -
    • Removed all "get_*" methods from the color object, instead opting for a single "val" method for getting and setting, more in line with familiar jQuery methods.
    • -
    • Better rendering for all IE versions in Quirks mode.
    • -
    -
    -
  • -
  • -

    V1.0.13:

    -
      -
    • Updated transparency algorithm for red/green/blue color modes. The algorithm from John Dyers' color picker was close but incorrect. Bar colors are now pixel perfect with the new algorithm.
    • -
    • Changed from using "background-position" on the color maps to an element of full height using the "top" attribute for image-map location using "overflow: hidden" to hide overdraw.
    • -
    • IE7/8 ignores opacity on elements taller than 4096px. Image maps therefore no longer include a blank first map so the Bar is just under 4096. Blank is now accomplished by setting the "top" setting to below the map display.
    • -
    • New colorBar picker image that does not draw outside of the element since the elements now hide overdraw.
    • -
    • Added IE5.5/6 support for the picker. This is why it now uses maps of full height and the "top" attribute for map locations.
    • -
    • Moved the images in the maps to 4 pixels apart from each other. IE7/8 change the first pixel of the bottom-border of 2px to partially transparent showing a portion of a different color map without this.
    • -
    -
    -
  • -
  • -

    V1.0.12:

    -
      -
    • Added minified CSS file.
    • -
    • Added IE7/8 Quirks Mode support.
    • -
    • Added configurable string constants for all text and tooltips. You can now change the default values for different languages.
    • -
    • Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES.
    • -
    • Better NULL color handling and an additional "No Color Selected" quick pick color.
    • -
    • More consistent behavior across multiple versions of browsers.
    • -
    • Added alpha response to the binded color picker icon.
    • -
    • Removed "alphaSupport" variable. It is now always supported.
    • -
    -
    -
  • -
  • -

    V1.0.11b:

    -
      -
    • Corrected NULL behavior in IE. jQuery was getting an exception when attempting to assign a backgroundColor style of '#'. Now assigns 'transparent' if color is NULL.
    • -
    • Can now create new Color object WITH OR WITHOUT the '#' prefix.
    • -
    -
    -
  • -
  • -

    V1.0.11:

    -
      -
    • Added ability for NULL colors (delete the hex value). Color will be returned as color.hex == ''. Can set the default color to an empty hex string as well.
    • -
    • cancelCallback now returns the original color for use in programming responses.
    • -
    -
    -
  • -
  • -

    V1.0.10:

    -
      -
    • Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier.
    • -
    -
    -
  • -
  • -

    V1.0.9:

    -
      -
    • Added optional title variable for each jPicker window.
    • -
    -
    -
  • -
  • -

    V1.0.8:

    -
      -
    • Moved all images into a few sprites - now using backgroundPosition to change color maps and bars instead of changing the image - this should be faster to download and run.
    • -
    -
    -
  • -
  • -

    V1.0.7:

    -
      -
    • RENAMED CSS FILE TO INCLUDE VERSION NUMBER!!! YOU MUST USE THIS VERSIONED CSS FILE!!! There will be no need to do your own CSS version number increments from now on.
    • -
    • Added opacity feedback to color preview boxes.
    • -
    • Removed reliance on "id" value of containing object. Subobjects are now found by class and container instead of id's. This drastically reduces injected code.
    • -
    • Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required.
    • -
    -
    -
  • -
  • -

    V1.0.6:

    -
      -
    • Corrected picker bugs introduced with 1.0.5.
    • -
    • Removed alpha slider bar until activated - default behavior for alpha is now OFF.
    • -
    • Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol).
    • -
    • Removed title tags (tooltips) from color maps and bars - They get in the way in some browsers (e.g. IE - dragging marker does NOT prevent or hide the tooltip).
    • -
    • THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!
    • -
    -
    -
  • -
  • -

    V1.0.5:

    -
      -
    • Added opacity support to picker and color/callback methods. New property "a" (alpha - range from 0-100) in all color objects now - defaults to 100% opaque. (Thank you Pavol)
    • -
    • Added title attributes to input elements - gives short tooltip directions on what button or field does.
    • -
    • Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization.
    • -
    • THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!
    • -
    -
    -
  • -
  • -

    V1.0.4:

    -
      -
    • Added ability for smaller picker icon with expandable window on any DOM element (not just input).
    • -
    • "draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker.
    • -
    -
    -
  • -
  • -

    V1.0.3

    -
      -
    • Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol)
    • -
    -
    -
  • -
  • -

    V1.0.2

    -
      -
    • Random bug fixes - speed concerns.
    • -
    -
    -
  • -
  • -

    V1.0.1

    -
      -
    • Corrected closure based memeory leak - there may be others?
    • -
    -
    -
  • -
  • -

    V1.0.0

    -
      -
    • First Release.
    • -
    -
    -
  • -
-
- - \ No newline at end of file From 786e2dedbe26118c4910530baf2d67c6f68f6232 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Oct 2024 18:16:52 +0100 Subject: [PATCH 69/72] Removed html doc --- .../includes/jquery/plugins/jcrop/index.html | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 htdocs/includes/jquery/plugins/jcrop/index.html diff --git a/htdocs/includes/jquery/plugins/jcrop/index.html b/htdocs/includes/jquery/plugins/jcrop/index.html deleted file mode 100644 index 209c929c61d01..0000000000000 --- a/htdocs/includes/jquery/plugins/jcrop/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - -Jcrop: the jQuery Image Cropping Plugin - - - -
-

Jcrop Image Cropping Plugin

- - - Jcrop - is the image cropping plugin for - jQuery.
- You've successfully unpacked Jcrop. -
- -

Static Demos

- - - -

Live Demo

- - - -

Jcrop Links

- - - -
- - © 2008 Kelly Hallman and DeepLiquid.com
- Free software released under - MIT License -
-
- - - - From 26e89a7760d55db355f989c91d5961725fc03b76 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 30 Oct 2024 21:10:49 +0100 Subject: [PATCH 70/72] FIX this constant break the dictionary admin without Multicompany (#31638) --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a6c057ddacdb5..416ab130901d8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -435,7 +435,7 @@ function getEntity($element, $shared = 1, $currentobject = null) } else { $out = ''; $addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'email_template', 'default_values', 'overwrite_trans'); - if (getDolGlobalString('HOLIDAY_ALLOW_ZERO_IN_DIC')) { + if (getDolGlobalString('HOLIDAY_ALLOW_ZERO_IN_DIC')) { // this constant break the dictionary admin without Multicompany $addzero[] = 'c_holiday_types'; } if (in_array($element, $addzero)) { From d42465ff1f877dd02d90496b5be5c58f84dae7c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Oct 2024 14:35:10 +0100 Subject: [PATCH 71/72] FIX error message in xls import when stream zip is not availabe. --- htdocs/core/modules/import/import_xlsx.modules.php | 7 +++++++ htdocs/imports/import.php | 10 ++++++++++ htdocs/langs/en_US/errors.lang | 1 + 3 files changed, 18 insertions(+) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0bf5e587d4ce5..3692f6d70e6eb 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -125,6 +125,13 @@ public function __construct($db, $datatoimport) $this->label_lib = 'PhpSpreadSheet'; $this->version_lib = '1.8.0'; + $arrayofstreams = stream_get_wrappers(); + if (!in_array('zip', $arrayofstreams)) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorStreamMustBeEnabled', 'zip'); + return; + } + $this->datatoimport = $datatoimport; if (preg_match('/^societe_/', $datatoimport)) { $this->thirdpartyobject = new Societe($this->db); diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 869bddbb3fde0..660ba435eec46 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -783,6 +783,16 @@ $classname = "Import".ucfirst($model); require_once $dir.$file; $obj = new $classname($db, $datatoimport); + + if (!empty($obj->error)) { + $langs->load("errors"); + $param = '&datatoimport='.$datatoimport.'&format='.$format; + setEventMessages($obj->error, null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"].'?step=3'.$param.'&filetoimport='.urlencode($relativepath)); + exit; + } + + if ($model == 'csv') { $obj->separator = $separator_used; $obj->enclosure = $enclosure; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index bbaa74bba2db3..2e18fb389b3f4 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -342,6 +342,7 @@ ErrorEndHourIsNull=End date field cannot be empty ErrorStartHourIsNull=Start date field cannot be empty ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. ErrorEmptyValueForQty=Quantity cannot be zero. +ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 870a78a0e89f4c96215879314f3364464c11f77f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Oct 2024 19:40:11 +0100 Subject: [PATCH 72/72] FIX bad test on permission makes agenda event creation on object not linked to object. --- htdocs/comm/action/card.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 539aec3b8dda4..ac96a98483c82 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -356,7 +356,7 @@ } if (!$error) { - // Initialisation object actioncomm + // Initialisation of object actioncomm $object->priority = GETPOSTISSET("priority") ? GETPOSTINT("priority") : 0; $object->fulldayevent = ($fulldayevent ? 1 : 0); $object->location = GETPOST("location", 'alphanohtml'); @@ -365,11 +365,15 @@ if (GETPOST("elementtype", 'alpha')) { $elProp = getElementProperties(GETPOST("elementtype", 'alpha')); $modulecodetouseforpermissioncheck = $elProp['module']; + $submodulecodetouseforpermissioncheck = $elProp['subelement']; $hasPermissionOnLinkedObject = 0; if ($user->hasRight($modulecodetouseforpermissioncheck, 'read')) { $hasPermissionOnLinkedObject = 1; + } elseif ($user->hasRight($modulecodetouseforpermissioncheck, $submodulecodetouseforpermissioncheck, 'read')) { + $hasPermissionOnLinkedObject = 1; } + if ($hasPermissionOnLinkedObject) { $object->fk_element = GETPOSTINT("fk_element"); $object->elementtype = GETPOST("elementtype", 'alpha'); @@ -430,7 +434,9 @@ $object->note_private = trim(GETPOST("note", "restricthtml")); if (GETPOSTISSET("contactid")) { - $object->contact = $contact; + $object->contact_id = GETPOSTINT("contactid"); + + $object->contact = $contact; // For backward compatibility } if (GETPOSTINT('socid') > 0) {