From 3ea0646e2a00284139fb8c0a56b1bb9c33a3a574 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 7 Feb 2023 17:24:07 +0100 Subject: [PATCH 01/44] =?UTF-8?q?NEW=20:=20Ajout=20ic=C3=B4ne=20listincsv?= =?UTF-8?q?=20sur=20objets=20r=C3=A9f=C3=A9rents=20produit=20et=20tiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog.md | 2 ++ class/actions_listincsv.class.php | 11 +++++++++++ core/modules/modListInCSV.class.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 185e23d..3c6b22a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,6 +2,8 @@ ## Unreleased +- NEW : Ajout icône listincsv sur objets référents produit et tiers *07/02/2023* - 1.6.0 + ## 1.5 diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 6d0d113..6377057 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -82,6 +82,17 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { $TContext = explode(':', $parameters['context']); $context_list = preg_grep('/(.*list$)/i', $TContext); + + // Gestion des objets référents produits + if(empty($context_list)) { + $context_list = preg_grep('/(productstats.*)/i', $TContext); + } + + // Gestion des écrans objets référents tiers + if(empty($context_list)) { + $context_list = preg_grep('/(consumptionthirdparty)/i', $TContext); + } + if (!empty($context_list) || in_array('stockatdate', $TContext)) { global $langs, $user, $conf; diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index e445306..f204fe0 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.5.0'; + $this->version = '1.6.0'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From a14456ab4991adf7b9aae33dd20c49eb01de5555 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 10 Feb 2023 11:57:48 +0100 Subject: [PATCH 02/44] Release 1.6 --- ChangeLog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 3c6b22a..242a7cf 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,8 +2,10 @@ ## Unreleased -- NEW : Ajout icône listincsv sur objets référents produit et tiers *07/02/2023* - 1.6.0 +## 1.6 + +- NEW : Ajout icône listincsv sur objets référents produit et tiers *07/02/2023* - 1.6.0 ## 1.5 From ff0f49c466feecaa5d25c0582c39896fc9eabe60 Mon Sep 17 00:00:00 2001 From: ATM-Sami Date: Tue, 7 Nov 2023 08:37:28 +0100 Subject: [PATCH 03/44] add product price list by customer for csv export --- class/actions_listincsv.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 6377057..e595bf8 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -93,7 +93,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $context_list = preg_grep('/(consumptionthirdparty)/i', $TContext); } - if (!empty($context_list) || in_array('stockatdate', $TContext)) + if (!empty($context_list) || in_array('stockatdate', $TContext) || in_array('thirdpartycustomerprice', $TContext)) { global $langs, $user, $conf; $langs->load('listincsv@listincsv'); From ee34b30f47c1889eaa7661122061dbbe3a8392b9 Mon Sep 17 00:00:00 2001 From: ATM-Sami Date: Tue, 7 Nov 2023 08:39:40 +0100 Subject: [PATCH 04/44] update changelog and mod --- ChangeLog.md | 2 +- core/modules/modListInCSV.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 242a7cf..f511190 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,10 +1,10 @@ #Change Log ## Unreleased +- NEW : Ajout de la possibilité d'exporter la liste des prix clients *07/10/2023* - 1.7.0 ## 1.6 - - NEW : Ajout icône listincsv sur objets référents produit et tiers *07/02/2023* - 1.6.0 ## 1.5 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index f204fe0..cb20d54 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.6.0'; + $this->version = '1.7.0'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From bde8332f94c6ed2cf6037c4de1f85a9038a71455 Mon Sep 17 00:00:00 2001 From: ATM-Sami Date: Tue, 7 Nov 2023 08:46:15 +0100 Subject: [PATCH 05/44] good practices --- class/actions_listincsv.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index e595bf8..f9beedf 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -93,7 +93,17 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $context_list = preg_grep('/(consumptionthirdparty)/i', $TContext); } - if (!empty($context_list) || in_array('stockatdate', $TContext) || in_array('thirdpartycustomerprice', $TContext)) + // Gestion des écrans objets référents tiers + if(empty($context_list)) { + $context_list = preg_grep('/(stockatdate)/i', $TContext); + } + + // Gestion des écrans objets référents tiers + if(empty($context_list)) { + $context_list = preg_grep('/(thirdpartycustomerprice)/i', $TContext); + } + + if (!empty($context_list)) { global $langs, $user, $conf; $langs->load('listincsv@listincsv'); From 02d8b1f411ce62b4a3e1f296a8cc3974cf07dd6b Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Wed, 8 Nov 2023 15:22:53 +0100 Subject: [PATCH 06/44] release 1.7 --- ChangeLog.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f511190..3cd7d3a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,18 +1,19 @@ #Change Log ## Unreleased -- NEW : Ajout de la possibilité d'exporter la liste des prix clients *07/10/2023* - 1.7.0 + +## 1.7 +- NEW : Ajout de la possibilité d'exporter la liste des prix clients *07/10/2023* - 1.7.0 + ## 1.6 - NEW : Ajout icône listincsv sur objets référents produit et tiers *07/02/2023* - 1.6.0 ## 1.5 - - NEW : Ajout de la class TechATM pour l'affichage de la page "A propos" *10/05/2022* 1.15.0 ## 1.4 - - FIX: Family name - *02/06/2022* - 1.4.3 - FIX: Delete Trigger - *02/06/2022* - 1.4.2 - FIX: context detection - *15/03/2022* - 1.4.1 From 180f4958ac4ee7343d1683f68501ce3e2a4faf6d Mon Sep 17 00:00:00 2001 From: Jonathan Lescaut Date: Tue, 21 Nov 2023 16:32:00 +0100 Subject: [PATCH 07/44] FIX_compat_v19 --- admin/listincsv_setup.php | 2 +- .../core/class/commonhookactions.class.php | 58 +++++++++++++++++++ class/actions_listincsv.class.php | 9 +-- js/listincsv.js.php | 2 +- 4 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 backport/v19/core/class/commonhookactions.class.php diff --git a/admin/listincsv_setup.php b/admin/listincsv_setup.php index 0f9995d..bc465b8 100644 --- a/admin/listincsv_setup.php +++ b/admin/listincsv_setup.php @@ -116,7 +116,7 @@ print '
'; print ''; print ''; -print $form->selectyesno("LISTINCSV_DELETESPACEFROMNUMBER",$conf->global->LISTINCSV_DELETESPACEFROMNUMBER,1); +print $form->selectyesno("LISTINCSV_DELETESPACEFROMNUMBER", getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER'),1); print ''; print '
'; print ''; diff --git a/backport/v19/core/class/commonhookactions.class.php b/backport/v19/core/class/commonhookactions.class.php new file mode 100644 index 0000000..34104c4 --- /dev/null +++ b/backport/v19/core/class/commonhookactions.class.php @@ -0,0 +1,58 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/class/commonhookactions.class.php + * \ingroup core + * \brief File of parent class of all other hook actions classes + */ + + +if (file_exists(DOL_DOCUMENT_ROOT . 'htdocs/core/class/commonhookactions.class.php')){ + + require_once DOL_DOCUMENT_ROOT . '/htdocs/core/class/commonhookactions.class.php'; + /** + * Parent class of all other hook actions classes + */ + abstract class RetroCompatCommonHookActions extends \CommonHookActions + { + + } +}else{ + /** + * Parent class of all other hook actions classes + */ + abstract class RetroCompatCommonHookActions + { + /** + * @var string String of results. + */ + public $resprints; + + /** + * @var array Array of results. + */ + public $results = array(); + } + +} + + + diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index f9beedf..8452049 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -22,11 +22,12 @@ * \brief This file is an example hook overload class file * Put some comments here */ +require_once __DIR__ . '/../backport/v19/core/class/commonhookactions.class.php'; /** * Class ActionsListInCSV */ -class ActionsListInCSV +class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions { /** * @var array Hook results. Propagated to $hookmanager->resArray for later reuse @@ -108,7 +109,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) global $langs, $user, $conf; $langs->load('listincsv@listincsv'); - if(!empty($user->rights->listincsv->export)) { + if(!empty($user->hasRight('listincsv', 'export'))) { require_once __DIR__ . './../lib/listincsv.lib.php'; @@ -183,10 +184,10 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) // Suppression de la ligne TOTAL en pied de tableau - global->LISTINCSV_DONT_REMOVE_TOTAL)) { ?> $table.find('tr.liste_total').remove(); + $table.find('tr.liste_total').remove(); //Suppression des espaces pour les nombres - global->LISTINCSV_DELETESPACEFROMNUMBER)) { ?> + $table.find('td').each(function(e) { let nbWthtSpace = $(this).text().replace(/ /g,'').replace(/\xa0/g,''); diff --git a/js/listincsv.js.php b/js/listincsv.js.php index 196a37a..e23ba76 100644 --- a/js/listincsv.js.php +++ b/js/listincsv.js.php @@ -71,7 +71,7 @@ function exportTableToCSV($table, filename) { tmpRowDelim = String.fromCharCode(0), // null character // actual delimiter characters for CSV format - colDelim = '"global->EXPORT_CSV_SEPARATOR_TO_USE)?$conf->global->EXPORT_CSV_SEPARATOR_TO_USE:';')?>"', + colDelim = '""', rowDelim = '"\r\n"', // Grab text from table into CSV formatted string From 1f7ed551e86d9d329472a3f0b7feb21cdd7f8f95 Mon Sep 17 00:00:00 2001 From: Jonathan Lescaut Date: Fri, 24 Nov 2023 11:47:43 +0100 Subject: [PATCH 08/44] retour PR --- backport/v19/core/class/commonhookactions.class.php | 2 +- class/actions_listincsv.class.php | 2 +- js/listincsv.js.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backport/v19/core/class/commonhookactions.class.php b/backport/v19/core/class/commonhookactions.class.php index 34104c4..c16585d 100644 --- a/backport/v19/core/class/commonhookactions.class.php +++ b/backport/v19/core/class/commonhookactions.class.php @@ -25,7 +25,7 @@ */ -if (file_exists(DOL_DOCUMENT_ROOT . 'htdocs/core/class/commonhookactions.class.php')){ +if (file_exists(DOL_DOCUMENT_ROOT . '/htdocs/core/class/commonhookactions.class.php')){ require_once DOL_DOCUMENT_ROOT . '/htdocs/core/class/commonhookactions.class.php'; /** diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 8452049..2e288d6 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -214,7 +214,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) }); - "', - rowDelim = '"\r\n"', + colDelim = '""', + rowDelim = '"\r\n"', // Grab text from table into CSV formatted string csv = '\ufeff"' + $rows.map(function(i, row) { From d04768f7b888b02249a14db81198f8d931d6934e Mon Sep 17 00:00:00 2001 From: Jonathan Lescaut Date: Fri, 24 Nov 2023 11:51:19 +0100 Subject: [PATCH 09/44] num version et changelog --- ChangeLog.md | 3 ++- core/modules/modListInCSV.class.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 3cd7d3a..29cc8fd 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,7 +2,8 @@ ## Unreleased - +## 1.8 +- FIX : Compat v19 et php8.2 *07/10/2023* - 1.8.0 ## 1.7 - NEW : Ajout de la possibilité d'exporter la liste des prix clients *07/10/2023* - 1.7.0 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index cb20d54..9ffee9c 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.7.0'; + $this->version = '1.8.0'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From a5c2e27ba8ae064ff8af7193151e53e44a443c47 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 18 Dec 2023 12:12:25 +0100 Subject: [PATCH 10/44] Release 1.8 --- ChangeLog.md | 27 ++++++--- core/modules/modListInCSV.class.php | 4 +- img/logo list in csv.svg | 90 ++++++++++++++++++++++++++++ img/object_modulelistincsv.png | Bin 0 -> 2138 bytes 4 files changed, 111 insertions(+), 10 deletions(-) create mode 100644 img/logo list in csv.svg create mode 100644 img/object_modulelistincsv.png diff --git a/ChangeLog.md b/ChangeLog.md index 29cc8fd..735ed3e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,34 +2,45 @@ ## Unreleased -## 1.8 + + +## release 1.8 + +- FIX : Module logo Image *18/12/2023* - 1.8.1 - FIX : Compat v19 et php8.2 *07/10/2023* - 1.8.0 -## 1.7 +## release 1.7 + - NEW : Ajout de la possibilité d'exporter la liste des prix clients *07/10/2023* - 1.7.0 -## 1.6 +## release 1.6 + - NEW : Ajout icône listincsv sur objets référents produit et tiers *07/02/2023* - 1.6.0 -## 1.5 +## release 1.5 + - NEW : Ajout de la class TechATM pour l'affichage de la page "A propos" *10/05/2022* 1.15.0 -## 1.4 +## release 1.4 + - FIX: Family name - *02/06/2022* - 1.4.3 - FIX: Delete Trigger - *02/06/2022* - 1.4.2 - FIX: context detection - *15/03/2022* - 1.4.1 - NEW: Include Dolibarr V13 stock to date - *28/02/2022* - 1.4.0 -## 1.3 +## release 1.3 + - FIX: Appel de `call_trigger()` sur un non-objet - *08/10/2021* - 1.3.1 - NEW: Déclenchement d'un trigger sur export d'un fichier avec listincsv - *19/05/2021* - 1.3.0 -## 1.2 +## release 1.2 + - FIX: La liste ne s'exporte plus - *20/05/2021* - 1.2.4 - FIX: Les champs de type "case à cocher" ne sont pas exportés - *17/05/2021* - 1.2.3 - FIX: Suppression du dossier Box ainsi que tu fichier box *11/05/2021* - 1.2.2 - FIX: $_SESSION devient newToken() *11/05/2021* - 1.2.1 - NEW: Déplacement du code qui crée le boutton vert "CSV" pour utilisation dans des modules externes avec un contexte ajax *06/05/2021* - 1.2.0 -## 1.1 +## release 1.1 + - NEW: Ajout d'une gestion de récupération des informations via un autre paramètre que l'action du formulaire le plus proche *06/05/2021* - 1.1.0 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 9ffee9c..9beca8f 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.8.0'; + $this->version = '1.8.1'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; @@ -73,7 +73,7 @@ function __construct($db) // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto='listincsv@listincsv'; + $this->picto='modulelistincsv@listincsv'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /listincsv/core/xxxxx) (0=disable, 1=enable) diff --git a/img/logo list in csv.svg b/img/logo list in csv.svg new file mode 100644 index 0000000..5b1c0fa --- /dev/null +++ b/img/logo list in csv.svg @@ -0,0 +1,90 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/img/object_modulelistincsv.png b/img/object_modulelistincsv.png new file mode 100644 index 0000000000000000000000000000000000000000..2cfdf035db2d74b31382fc85994effaff77db19f GIT binary patch literal 2138 zcmV-g2&MOlP)6ovP(Vb{nxY2OIHD%vBjVIi zI#Vl|&ctS>6H}9RQXiQ(lbJG3r)^?z+9YObOf+MriD{FfHA?XPt`8~?Uub*)8eL#P zSOFK<-P=FZt?TY8yZ6e9@$(+Qz2f5?=2_OjKA|A2H10aA&8?)@aicc2H88*NY5T2290GUykwWdE8m4Eb0 z*#ZWzMSRWQ7Xekg&b)eM`IX`z$1zw`A2D@CdXAI7x%=sPYBT7-5zouv)(-WujL=Fd61tftc-3m zb6_q%O`jdn7;w|w=DC0Pp=1@n<4fLUuIEhem= z-}|Bzd~eLN*UvNDl7U*O4mp-pZ+X4w_}}UmXTS1xpmx8<-su|)ZUVZV1drFpkr>96 zc@Wjt&*SpAeQc?QB%Vvj0U?|xb*eWn(eKh2CHE zbk{rUfAL1vZ~l3=UD6T|1OcU>loBE!E|1H9ETE~og-z#6(1{wNHBo3(AuS1Ym#h0T zKt2HqGUo8o@Oe@~1mx%6E}*5;5wK0I(c%W0-40wG{z5$fzu!|y0z?vpQi(H zSV;m*Pkpx6H$l0PBtUDYgSs2v%aw~4x9E{QW-ufPu(fsRX7_onM6>#M)!>kC@|cwuNhQ<8HiC|&3y z%-y^&G@rRcW-+(qWm>y#gq^=60dkXbcr*Jos+vx-{OC$9I_dz3QX449$Y=iWx!9e} zY^&P~z_QV=Vb+@X_3k&lzE*uab2DZ!FJm^FE|uc)xHx$2C^HA^+WHdRZSJV+40qKjqG(=T(p@dR%je#fVT)z;m?$EQE1tfA6dFfnPO85TR3_0?Z_ zClAnY)6S}@PgzyT4C7{R(}D_J;VK2OL0IOvUQ(x zcmMX;@a)cJj?|YkHF*MGocsS-hZ(7p5d?v)HS(0=!WO{ka-vs-_6}7)C)a~NYC#iIR%INhCI|E)DU$w?f;_{7n`t#^?#QlF#Benz(1LfA{- zf}@sUv4hbndwd?r2U|x2n=ftWcl!%jbL#I5F{Lpjd4iA6v4%?OJM2tNnFK&TeLVdP z32dp^8E)Esge}0fx_uZ_dRb10+^HdZcNQ4}eu-9@J5)udI~Z&l$fW+`uyr(YvZ)$? zmd;l6Djh`=e@~_TG$-t5==QkCFb`s4(lb=q&v2x^+;5B~=XH+Q%E?I@BkSgO2U$*t zWF=%WJ>^+4%!AM=bu`>;sF;>Ai3v$#8DLCAqf}#SZ{(2e7@IHc z2zq7v8xvVLVm|+EsG|5{Nr+SQp>2EqhUmKueddUaO!x`#gMS=;B0!`Qh%`?G2w-dN z^(=aimU|8UA5MxK?wwpBf$*PuEdjn9r3mP~BO1MjTR<$j*XSoeY5s=&0xTiGp~60l zM-;@@x8-l}tDpouc|2od!6XmjQV_-iA%BeYNFdNCcsPW>JKOR%917&}KO+E;t<807*qoM6N<$f(8)yQ~&?~ literal 0 HcmV?d00001 From 63065bfa75a4be14215f89e9502568da070243e7 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 18 Dec 2023 15:06:05 +0100 Subject: [PATCH 11/44] fix path --- backport/v19/core/class/commonhookactions.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backport/v19/core/class/commonhookactions.class.php b/backport/v19/core/class/commonhookactions.class.php index c16585d..5496f33 100644 --- a/backport/v19/core/class/commonhookactions.class.php +++ b/backport/v19/core/class/commonhookactions.class.php @@ -25,9 +25,9 @@ */ -if (file_exists(DOL_DOCUMENT_ROOT . '/htdocs/core/class/commonhookactions.class.php')){ +if (file_exists(DOL_DOCUMENT_ROOT . '/core/class/commonhookactions.class.php')){ - require_once DOL_DOCUMENT_ROOT . '/htdocs/core/class/commonhookactions.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/commonhookactions.class.php'; /** * Parent class of all other hook actions classes */ From 203175bcb4ed3e2b828fe1765458c05e91af8a6b Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:09:04 -0600 Subject: [PATCH 12/44] Create es_MX/postit.lang Translation to spanish (Mexico) --- langs/es_MX/postit.lang | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 langs/es_MX/postit.lang diff --git a/langs/es_MX/postit.lang b/langs/es_MX/postit.lang new file mode 100644 index 0000000..8ad9cb5 --- /dev/null +++ b/langs/es_MX/postit.lang @@ -0,0 +1,47 @@ +Module104852Name = PostIt +Module104852Desc = Le permite dejar PostIts en el tablero u objetos + +ATMAbout = Este módulo fue desarrollado por ATM Consulting
Puede encontrar la documentación en nuestro wiki

Para cualquier pregunta técnica o comentario, contáctenos en support@atm-consulting.fr

Para cualquier pregunta comercial, contáctenos en contact@atm-consulting.fr o +33 9 77 19 50 70

Encuentre nuestros otros módulos en Dolistore + +PostItSetup = Configuración del módulo PostIt +PostItAbout = Acerca del módulo Postit +PostitUserParameters=Parámetros de usuario + +NewNote=Título de mi nota +NoteComment=Descripción de la nota +Read=Leer notas +Write=Pegar, editar o responder a una nota +Admin=Tiene todos los derechos sobre sus notas o las de otros +NewResponse=Respuesta a la nota anterior + +PublicNote=Estado actual: público +SharedNote=Estado actual: compartido +PrivateNote=Estado actual: privado + +PublicNoteHelp=Estado actual: público, la nota sólo aparece en la tarjeta de este documento para todos los usuarios. +SharedNoteHelp=Estado actual: compartido, la nota aparece para todos los registros (de este tipo de documento) y para todos los usuarios. +PrivateNoteHelp=Estado actual: privado, la nota sólo aparece en la tarjeta de este documento y sólo es visible para usted. + +shortPublicNote=(estado público) +shortSharedNote=(estado compartido) +shortPrivateNote=(estado privado) + +AreYouSureYouWantToDeleteThisNote=¿Está seguro de que desea eliminar esta nota? + +private = privado +public = público +shared = compartido + +PostitList = Lista de PostIt +Home = Inicio + +POSTIT_COLOR_PRIVATE=Color de fondo de una nota privada +POSTIT_COLOR_PUBLIC=Color de fondo de una nota pública +POSTIT_COLOR_SHARED=Color de fondo de una nota compartida +AbricotNeedUpdate=Es necesario actualizar el módulo Apricot. +NewStickyNote = Agregar una nueva nota +POSTIT_MULTICOMPANY_SHARED=Compartir stick-its (estado: compartido y público) entre entidades +POSTITSharing=Compartir Stick-its +POSTITSharingDescription=Selección de entidades que compartirán sus stick-its (con estado compartido y público) con esta entidad. +Stickit-Multicompany=Gestión de stick-its multiempresa +FeatureAddedToMultiCompany=Los Stick-its ya no se comparten.
Ahora se puede acceder a compartir Stick-its (con estado compartido y público) entre entidades a través del módulo multiempresa y luego editando la entidad deseada. From cd0d41ff60d1e9b4e54e7cd5020a5a36fd6f28f7 Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:21:47 -0600 Subject: [PATCH 13/44] Update postit.lang --- langs/es_MX/postit.lang | 52 +++++++---------------------------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/langs/es_MX/postit.lang b/langs/es_MX/postit.lang index 8ad9cb5..978e6e0 100644 --- a/langs/es_MX/postit.lang +++ b/langs/es_MX/postit.lang @@ -1,47 +1,13 @@ -Module104852Name = PostIt -Module104852Desc = Le permite dejar PostIts en el tablero u objetos +Module104856Name = Lista en CSV +Module104856Desc = Agrega un ícono que le permite descargar listas en formato CSV -ATMAbout = Este módulo fue desarrollado por ATM Consulting
Puede encontrar la documentación en nuestro wiki

Para cualquier pregunta técnica o comentario, contáctenos en support@atm-consulting.fr

Para cualquier pregunta comercial, contáctenos en contact@atm-consulting.fr o +33 9 77 19 50 70

Encuentre nuestros otros módulos en Dolistore +ATMAbout = Este módulo fue desarrollado por ATM Consulting
Puede encontrar la documentación en nuestro wiki

Para cualquier pregunta técnica o comentario, contáctenos en support@atm-consulting.fr

Para cualquier pregunta comercial, contáctenos en contact@atm-consulting.fr o +33 9 77 19 50 70

Encuentre nuestros otros módulos en Dolistore -PostItSetup = Configuración del módulo PostIt -PostItAbout = Acerca del módulo Postit -PostitUserParameters=Parámetros de usuario +ListInCSVSetup = Configuración del módulo Lista en CSV +ListInCSVAbout = Acerca del módulo Lista en CSV -NewNote=Título de mi nota -NoteComment=Descripción de la nota -Read=Leer notas -Write=Pegar, editar o responder a una nota -Admin=Tiene todos los derechos sobre sus notas o las de otros -NewResponse=Respuesta a la nota anterior +NoSetupAvailable = No es necesaria ninguna configuración. Ahora está disponible un ícono junto al título de cada lista que le permite descargarla en un archivo CSV. -PublicNote=Estado actual: público -SharedNote=Estado actual: compartido -PrivateNote=Estado actual: privado - -PublicNoteHelp=Estado actual: público, la nota sólo aparece en la tarjeta de este documento para todos los usuarios. -SharedNoteHelp=Estado actual: compartido, la nota aparece para todos los registros (de este tipo de documento) y para todos los usuarios. -PrivateNoteHelp=Estado actual: privado, la nota sólo aparece en la tarjeta de este documento y sólo es visible para usted. - -shortPublicNote=(estado público) -shortSharedNote=(estado compartido) -shortPrivateNote=(estado privado) - -AreYouSureYouWantToDeleteThisNote=¿Está seguro de que desea eliminar esta nota? - -private = privado -public = público -shared = compartido - -PostitList = Lista de PostIt -Home = Inicio - -POSTIT_COLOR_PRIVATE=Color de fondo de una nota privada -POSTIT_COLOR_PUBLIC=Color de fondo de una nota pública -POSTIT_COLOR_SHARED=Color de fondo de una nota compartida -AbricotNeedUpdate=Es necesario actualizar el módulo Apricot. -NewStickyNote = Agregar una nueva nota -POSTIT_MULTICOMPANY_SHARED=Compartir stick-its (estado: compartido y público) entre entidades -POSTITSharing=Compartir Stick-its -POSTITSharingDescription=Selección de entidades que compartirán sus stick-its (con estado compartido y público) con esta entidad. -Stickit-Multicompany=Gestión de stick-its multiempresa -FeatureAddedToMultiCompany=Los Stick-its ya no se comparten.
Ahora se puede acceder a compartir Stick-its (con estado compartido y público) entre entidades a través del módulo multiempresa y luego editando la entidad deseada. +FileGenerationInProgress = Generación del archivo CSV en curso. +LISTINCSVExport=Permitir exportación de listas en CSV +LISTINCSV_DELETESPACEFROMNUMBER=Eliminar espacios contenidos en números From 70aaad3ebbfb91eb50dbbd39a5f47432f99572cf Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:33:42 -0600 Subject: [PATCH 14/44] Rename postit.lang to listincsv.lang --- langs/es_MX/{postit.lang => listincsv.lang} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename langs/es_MX/{postit.lang => listincsv.lang} (100%) diff --git a/langs/es_MX/postit.lang b/langs/es_MX/listincsv.lang similarity index 100% rename from langs/es_MX/postit.lang rename to langs/es_MX/listincsv.lang From 83bce0c791509a3d8c5acebbe1b7ed7d62f098de Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 23 Feb 2024 08:25:29 +0100 Subject: [PATCH 15/44] Update langs/es_MX/listincsv.lang --- langs/es_MX/listincsv.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langs/es_MX/listincsv.lang b/langs/es_MX/listincsv.lang index 978e6e0..190313f 100644 --- a/langs/es_MX/listincsv.lang +++ b/langs/es_MX/listincsv.lang @@ -1,7 +1,7 @@ Module104856Name = Lista en CSV Module104856Desc = Agrega un ícono que le permite descargar listas en formato CSV -ATMAbout = Este módulo fue desarrollado por ATM Consulting
Puede encontrar la documentación en nuestro wiki

Para cualquier pregunta técnica o comentario, contáctenos en support@atm-consulting.fr

Para cualquier pregunta comercial, contáctenos en contact@atm-consulting.fr o +33 9 77 19 50 70

Encuentre nuestros otros módulos en Dolistore +ATMAbout = Este módulo fue desarrollado por ATM Consulting
Puede encontrar la documentación en nuestro wiki

Para cualquier pregunta técnica o comentario, contáctenos en support@atm-consulting.fr

Para cualquier pregunta comercial, contáctenos en contact@atm-consulting.fr o +33 9 77 19 50 70

Encuentre nuestros otros módulos en Dolistore ListInCSVSetup = Configuración del módulo Lista en CSV ListInCSVAbout = Acerca del módulo Lista en CSV From 194f409e7a50b9216db73f34acfdf7d183ac0a92 Mon Sep 17 00:00:00 2001 From: Quentin VIAL--GOUTEYRON Date: Wed, 20 Mar 2024 09:55:52 +0100 Subject: [PATCH 16/44] FIX : Compat agefodd session onglet participant sur tableau stagiaire --- ChangeLog.md | 1 + class/actions_listincsv.class.php | 7 +++++++ core/modules/modListInCSV.class.php | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 735ed3e..e75b01e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,6 +6,7 @@ ## release 1.8 +- FIX : Compat agefodd session onglet participant sur tableau stagiaire *20/03/2024* - 1.8.2 - FIX : Module logo Image *18/12/2023* - 1.8.1 - FIX : Compat v19 et php8.2 *07/10/2023* - 1.8.0 diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 2e288d6..7800b8a 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -103,6 +103,9 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) if(empty($context_list)) { $context_list = preg_grep('/(thirdpartycustomerprice)/i', $TContext); } + if(empty($context_list)) { + $context_list = preg_grep('/(agefoddsessionsubscribers)/i', $TContext); + } if (!empty($context_list)) { @@ -132,6 +135,10 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) ?> $('#id-right > form#searchFormList div.titre').first().append(''); // Il peut y avoir plusieurs titre dans la page + $('div.fiche div.titre').eq(1).append(''); // Il peut y avoir plusieurs titre dans la page + if(typeof $('div.fiche div.titre').first().val() !== 'undefined') { diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 9beca8f..37d4f0e 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.8.1'; + $this->version = '1.8.2'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From b40875cb33e8f3d96307b77d06c0eb980e7b2cbb Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 25 Mar 2024 14:26:23 +0100 Subject: [PATCH 17/44] test object --- ChangeLog.md | 2 +- class/actions_listincsv.class.php | 2 +- core/modules/modListInCSV.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e75b01e..2c7ddf7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,7 +5,7 @@ ## release 1.8 - +- FIX : object test - *25/03/2024* - 1.8.3 - FIX : Compat agefodd session onglet participant sur tableau stagiaire *20/03/2024* - 1.8.2 - FIX : Module logo Image *18/12/2023* - 1.8.1 - FIX : Compat v19 et php8.2 *07/10/2023* - 1.8.0 diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 7800b8a..3e6f752 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -64,7 +64,7 @@ function doActions($parameters, &$object, &$action, $hookmanager) { global $db, $user; - if(GETPOSTISSET('exportlistincsv', 'bool') && method_exists($object, 'call_trigger')) { + if(GETPOSTISSET('exportlistincsv', 'bool') && is_object($object) && method_exists($object, 'call_trigger')) { $object->call_trigger('LISTINCSV_EXPORT_FILE_'.strtoupper($object->element), $user); } diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 37d4f0e..82652ad 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.8.2'; + $this->version = '1.8.3'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From 8e50e86919683cf7791e88d216f1fabc0bf7a9c3 Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Thu, 2 May 2024 00:26:53 -0600 Subject: [PATCH 18/44] Update config.default.php PHP Warning: Undefined variable $dolibarr_main_db_type in /custom/listincsv/config.default.php on line 22 --- config.default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.default.php b/config.default.php index 4be23d6..e0b3ce6 100644 --- a/config.default.php +++ b/config.default.php @@ -11,7 +11,7 @@ elseif(!defined('INC_FROM_DOLIBARR')) { include($dir."main.inc.php"); } else { - global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass; + global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_type; } if(!defined('DB_HOST')) { From bf14a4a956f274981046b09eee755af4c2ae8e5c Mon Sep 17 00:00:00 2001 From: Sami Date: Tue, 21 May 2024 17:14:17 +0200 Subject: [PATCH 19/44] update --- ChangeLog.md | 1 + core/modules/modListInCSV.class.php | 2 +- js/listincsv.js.php | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 2c7ddf7..4f7f868 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,7 @@ ## release 1.8 +- FIX : DA024994 - Problème de sélection sur la liste des demandes de congés (car elle contient des valeurs dans des inputs) - *21/05/2024* - 1.8.4 - FIX : object test - *25/03/2024* - 1.8.3 - FIX : Compat agefodd session onglet participant sur tableau stagiaire *20/03/2024* - 1.8.2 - FIX : Module logo Image *18/12/2023* - 1.8.1 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 82652ad..1238506 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.8.3'; + $this->version = '1.8.4'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; diff --git a/js/listincsv.js.php b/js/listincsv.js.php index 62a6ec9..f6a7a36 100644 --- a/js/listincsv.js.php +++ b/js/listincsv.js.php @@ -91,6 +91,9 @@ function exportTableToCSV($table, filename) { // Fix mails tronqués dans les listes par dol_trunc dans la fonction dol_print_email link=$col.find('a')[0].href; text = link.substr(7); + } else if ($col.find('input').length > 0 && $col.find('input').prop('type') === 'text') { + // Fix DA024994 liste avec des inputs + text=$col.find('input').val(); } else text = $col.text().trim(); // Spécifique pour "nettoyer" les données @@ -115,6 +118,7 @@ function exportTableToCSV($table, filename) { .split(tmpRowDelim).join(rowDelim) .split(tmpColDelim).join(colDelim) + '"'; + // Deliberate 'false', see comment below if (false && window.navigator.msSaveBlob) { From 5c02a9f47f2803b5572167a0b3092f28cda8b836 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 4 Jun 2024 11:40:45 +0200 Subject: [PATCH 20/44] Introduce hook to allow other modules to use listInCSV in custom lists --- class/actions_listincsv.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 3e6f752..22406bc 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -107,6 +107,13 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $context_list = preg_grep('/(agefoddsessionsubscribers)/i', $TContext); } + // Permettre à d'autres modules externes d'utiliser listInCSV + $parameters['context_list'] = &$context_list; + $reshook = $hookmanager->executeHooks('listInCSVFooterContext', $parameters); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + if (!empty($context_list)) { global $langs, $user, $conf; @@ -130,7 +137,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $(document).ready(function() { $('#id-right > form#searchFormList div.titre').first().append(''); // Il peut y avoir plusieurs titre dans la page From df96ff1d9ef12414f6cc5af6819ea97ff95b7514 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 11 Jun 2024 08:44:05 +0200 Subject: [PATCH 21/44] Easya/OpenDSI: ajout d'un hook: no. version + ChangeLog --- ChangeLog.md | 2 +- core/modules/modListInCSV.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4f7f868..353ff84 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,7 +1,7 @@ #Change Log ## Unreleased - +- NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 1238506..8531cc5 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.8.4'; + $this->version = '1.9.0'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From 53742f39563ae7fbcb1e7af33226178b08ef45f1 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Jun 2024 10:33:06 +0200 Subject: [PATCH 22/44] Release 1.9 --- ChangeLog.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 353ff84..17c4ba5 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,8 +1,9 @@ #Change Log ## Unreleased -- NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 +## release 1.9 +- NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 - FIX : DA024994 - Problème de sélection sur la liste des demandes de congés (car elle contient des valeurs dans des inputs) - *21/05/2024* - 1.8.4 From 84d21d3e941f92e4eb690032367af8dffd0ba947 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 2 Aug 2024 09:46:16 +0200 Subject: [PATCH 23/44] =?UTF-8?q?NEW:=20Compat=20v20:=20nettoyage=20js=20p?= =?UTF-8?q?our=20faciliter=20la=20compat=20ult=C3=A9rieure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog.md | 1 + class/actions_listincsv.class.php | 394 ++++++++++++++++-------------- js/listincsv.js.php | 4 +- 3 files changed, 210 insertions(+), 189 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 17c4ba5..22a499c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ ## Unreleased ## release 1.9 +- NEW : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.9.0 - NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 22406bc..30158ac 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -17,10 +17,10 @@ */ /** - * \file class/actions_listincsv.class.php + * \file class/actions_listincsv.class.php * \ingroup listincsv * \brief This file is an example hook overload class file - * Put some comments here + * Put some comments here */ require_once __DIR__ . '/../backport/v19/core/class/commonhookactions.class.php'; @@ -29,208 +29,228 @@ */ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions { - /** - * @var array Hook results. Propagated to $hookmanager->resArray for later reuse - */ - public $results = array(); - - /** - * @var string String displayed by executeHook() immediately after return - */ - public $resprints; - - /** - * @var array Errors - */ - public $errors = array(); - - /** - * Constructor - */ - public function __construct() - { - } - - /** - * doActions - * - * @param array() $parameters Hook metadatas (context, etc...) - * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string &$action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - function doActions($parameters, &$object, &$action, $hookmanager) { - - global $db, $user; - - if(GETPOSTISSET('exportlistincsv', 'bool') && is_object($object) && method_exists($object, 'call_trigger')) { - $object->call_trigger('LISTINCSV_EXPORT_FILE_'.strtoupper($object->element), $user); - } - - } - - /** - * printCommonFooter - * - * @param array() $parameters Hook metadatas (context, etc...) - * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string &$action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - function printCommonFooter($parameters, &$object, &$action, $hookmanager) - { - $TContext = explode(':', $parameters['context']); - $context_list = preg_grep('/(.*list$)/i', $TContext); + /** + * @var array Hook results. Propagated to $hookmanager->resArray for later reuse + */ + public $results = array(); + + /** + * @var string String displayed by executeHook() immediately after return + */ + public $resprints; + + /** + * @var array Errors + */ + public $errors = array(); + + /** + * Constructor + */ + public function __construct() { + } + + /** + * doActions + * + * @param array() $parameters Hook metadatas (context, etc...) + * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string &$action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + function doActions($parameters, &$object, &$action, $hookmanager) { + + global $db, $user; + + if (GETPOSTISSET('exportlistincsv', 'bool') && is_object($object) && method_exists($object, 'call_trigger')) { + $object->call_trigger('LISTINCSV_EXPORT_FILE_' . strtoupper($object->element), $user); + } + } + + /** + * printCommonFooter + * + * @param array() $parameters Hook metadatas (context, etc...) + * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string &$action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + function printCommonFooter($parameters, &$object, &$action, $hookmanager) { + $TContext = explode(':', $parameters['context']); + $context_list = preg_grep('/(.*list$)/i', $TContext); // Gestion des objets référents produits - if(empty($context_list)) { + if (empty($context_list)) { $context_list = preg_grep('/(productstats.*)/i', $TContext); } // Gestion des écrans objets référents tiers - if(empty($context_list)) { + if (empty($context_list)) { $context_list = preg_grep('/(consumptionthirdparty)/i', $TContext); } // Gestion des écrans objets référents tiers - if(empty($context_list)) { + if (empty($context_list)) { $context_list = preg_grep('/(stockatdate)/i', $TContext); } // Gestion des écrans objets référents tiers - if(empty($context_list)) { + if (empty($context_list)) { $context_list = preg_grep('/(thirdpartycustomerprice)/i', $TContext); } - if(empty($context_list)) { + if (empty($context_list)) { $context_list = preg_grep('/(agefoddsessionsubscribers)/i', $TContext); } - // Permettre à d'autres modules externes d'utiliser listInCSV - $parameters['context_list'] = &$context_list; - $reshook = $hookmanager->executeHooks('listInCSVFooterContext', $parameters); - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - - if (!empty($context_list)) - { - global $langs, $user, $conf; - $langs->load('listincsv@listincsv'); - - if(!empty($user->hasRight('listincsv', 'export'))) { - - require_once __DIR__ . './../lib/listincsv.lib.php'; - - $pathtojs = dol_buildpath('/listincsv/js/listincsv.js.php',1); - - $download = getListInCSVDownloadLink(); - - $socid = GETPOST('socid'); - if(empty($socid)) $socid = 0; - - // Inclusion d'un JS qui va permettre de télécharger la liste - ?> - - -executeHooks('listInCSVFooterContext', $parameters); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + + if (! empty($context_list)) { + global $langs, $user, $conf; + $langs->load('listincsv@listincsv'); + + if (! empty($user->hasRight('listincsv', 'export'))) { + + require_once __DIR__ . './../lib/listincsv.lib.php'; + + $pathtojs = dol_buildpath('/listincsv/js/listincsv.js.php', 1); + + $download = getListInCSVDownloadLink(); + + $socid = GETPOST('socid'); + if (empty($socid)) $socid = 0; + + $varsForJs = array( + 'downloadButton' => $download, + 'TContexts' => explode(':', $parameters['context']), + 'socid' => $socid, + 'langs' => array( + 'FileGenerationInProgress' => $langs->trans('FileGenerationInProgress') + ), + 'conf' => array( + 'LISTINCSV_DONT_REMOVE_TOTAL' => ! empty(getDolGlobalInt('LISTINCSV_DONT_REMOVE_TOTAL')), + 'LISTINCSV_DELETESPACEFROMNUMBER' => ! empty(getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER')) + ), + ); + // Inclusion d'un JS qui va permettre de télécharger la liste + ?> + + + Date: Thu, 8 Aug 2024 14:00:00 +0200 Subject: [PATCH 24/44] fix: on /accountancy/bookkeeping/listbyaccount.php tr colspan with account number must be keept --- class/actions_listincsv.class.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 22406bc..e648a2c 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -190,8 +190,19 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $table.find('tr.liste_titre_filter').remove(); // >= 6.0 $table.find('tr:has(td.liste_titre)').remove(); // < 6.0 - // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child').each(function(index){ + + // Suppression de la dernière colonne qui contient seulement les loupes des filtres + $table.find('th:last-child, td:last-child:not(.tdforbreak)').each(function(index){ + + // Suppression de la dernière colonne qui contient seulement les loupes des filtres + $table.find('th:last-child, td:last-child').each(function(index){ + $(this).find('dl').remove(); if($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne }); From 44461edc563f15e229618bf8091e528e3b94964f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 8 Aug 2024 18:10:21 +0200 Subject: [PATCH 25/44] fix: better filter method --- class/actions_listincsv.class.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index e648a2c..70d0693 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -190,19 +190,14 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $table.find('tr.liste_titre_filter').remove(); // >= 6.0 $table.find('tr:has(td.liste_titre)').remove(); // < 6.0 + let extraslectorfilter = ''; + extraslectorfilter = ':not(.tdforbreak)'; + // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child:not(.tdforbreak)').each(function(index){ - - // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child').each(function(index){ - + $table.find('th:last-child, td:last-child'+extraslectorfilter).each(function(index){ $(this).find('dl').remove(); if($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne }); From 1b28091ceb1929933ade756d30246aa84814947b Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 9 Aug 2024 08:58:16 +0200 Subject: [PATCH 26/44] Version number: 1.10 --- ChangeLog.md | 2 +- core/modules/modListInCSV.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 22a499c..1b93842 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,9 +1,9 @@ #Change Log ## Unreleased +- NEW : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.10.0 ## release 1.9 -- NEW : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.9.0 - NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 8531cc5..066b8be 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.0'; + $this->version = '1.10.0'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From 7ab95784447a30dcb8a3e69490c77342bb57626f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 9 Aug 2024 13:55:51 +0200 Subject: [PATCH 27/44] linter --- class/actions_listincsv.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 988e4e7..d8fefe7 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -215,10 +215,10 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { extraslectorfilter = ':not(.tdforbreak)'; // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child'+extraslectorfilter).each(function(index){ - $(this).find('dl').remove(); - if($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne - }); + $table.find('th:last-child, td:last-child''+extraslectorfilter).each(function (index) { + $(this).find('dl').remove(); + if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne + }); // Suppression de la ligne TOTAL en pied de tableau if (varsFromPHP.conf['LISTINCSV_DONT_REMOVE_TOTAL']) { From b91b84c36b3beeabdeea0d0688b02c5d355142ee Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 9 Aug 2024 13:56:15 +0200 Subject: [PATCH 28/44] linter --- class/actions_listincsv.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index d8fefe7..2ffbfda 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -209,7 +209,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { $table.find('tr:has(td.liste_titre)').remove(); // < 6.0 let extraslectorfilter = ''; - extraslectorfilter = ':not(.tdforbreak)'; From 15d7ab971733e9a00b17e18cb9376f5e339d05f2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 9 Aug 2024 13:56:44 +0200 Subject: [PATCH 29/44] linter --- class/actions_listincsv.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 2ffbfda..9a4cc33 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -215,7 +215,7 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { extraslectorfilter = ':not(.tdforbreak)'; // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child''+extraslectorfilter).each(function (index) { + $table.find('th:last-child, td:last-child'+extraslectorfilter).each(function (index) { $(this).find('dl').remove(); if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne }); From 1ee3d930a7510d75c8619d0733fa0b16e41fc53c Mon Sep 17 00:00:00 2001 From: VIAL-GOUTEYRON Quentin Date: Wed, 21 Aug 2024 10:13:47 +0200 Subject: [PATCH 30/44] Update modListInCSV.class.php --- core/modules/modListInCSV.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 066b8be..f1470ac 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.10.0'; + $this->version = '1.9.1'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From a2bf94a09179e4b37f99a02efc88ac85c17d9890 Mon Sep 17 00:00:00 2001 From: VIAL-GOUTEYRON Quentin Date: Wed, 21 Aug 2024 10:14:14 +0200 Subject: [PATCH 31/44] Update ChangeLog.md --- ChangeLog.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 1b93842..40f210f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,9 +1,10 @@ #Change Log ## Unreleased -- NEW : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.10.0 + ## release 1.9 +- FIX : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.9.1 - NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 From 58a0bd2c5307d96eda4df93a9b3a93f93f0441db Mon Sep 17 00:00:00 2001 From: Quentin VIAL--GOUTEYRON Date: Tue, 10 Dec 2024 09:49:40 +0100 Subject: [PATCH 32/44] FIX / COMPAT / 21 --- ChangeLog.md | 1 + core/modules/modListInCSV.class.php | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 17c4ba5..2edc14f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ ## Unreleased ## release 1.9 +- FIX : COMPAT 21 - *10/12/2024* - 1.9.1 - NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 8531cc5..e31e555 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.0'; + $this->version = '1.9.1'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; @@ -92,7 +92,7 @@ function __construct($db) // 'js' => array('/listincsv/js/listincsv.js'), // Set this to relative path of js file if module must load a js on all pages // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // 'dir' => array('output' => 'othermodulename'), // To force the default directories names - // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@listincsv')) // Set here all workflow context managed by module + // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'isModEnabled("module1") && isModEnabled("module2")', 'picto'=>'yourpicto@listincsv')) // Set here all workflow context managed by module // ); $this->module_parts = array( 'hooks'=>array( @@ -150,14 +150,14 @@ function __construct($db) $this->tabs = array(); // Dictionaries - if (! isset($conf->listincsv->enabled)) + if (! isModEnabled("listincsv")) { $conf->listincsv=new stdClass(); $conf->listincsv->enabled=0; } $this->dictionaries=array(); /* Example: - if (! isset($conf->listincsv->enabled)) $conf->listincsv->enabled=0; // This is to avoid warnings + if (! isModEnabled("listincsv")) $conf->listincsv->enabled=0; // This is to avoid warnings $this->dictionaries=array( 'langs'=>'mylangfile@listincsv', 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor @@ -168,7 +168,7 @@ function __construct($db) 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->listincsv->enabled,$conf->listincsv->enabled,$conf->listincsv->enabled) // Condition to show each dictionary + 'tabcond'=>array(isModEnabled("listincsv"),isModEnabled("listincsv"),isModEnabled("listincsv")) // Condition to show each dictionary ); */ @@ -187,13 +187,13 @@ function __construct($db) // $this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->hasRight("permkey", "level1", "level2")) + // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->hasRight("permkey", "level1", "level2")) // $r++; $this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used) $this->rights[$r][1] = $langs->trans('LISTINCSVExport'); // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'export'; // In php code, permission will be checked by test if ($user->rights->permkey->level1) + $this->rights[$r][4] = 'export'; // In php code, permission will be checked by test if ($user->hasRight("permkey", "level1")) $r++; @@ -212,8 +212,8 @@ function __construct($db) // 'url'=>'/listincsv/pagetop.php', // 'langs'=>'mylangfile@listincsv', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'enabled'=>'$conf->listincsv->enabled', // Define condition to show or hide menu entry. Use '$conf->listincsv->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->listincsv->level1->level2' if you want your menu with a permission rules + // 'enabled'=>'isModEnabled("listincsv")', // Define condition to show or hide menu entry. Use 'isModEnabled("listincsv")' if entry must be visible if module is enabled. + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("listincsv", "level1", "level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -228,7 +228,7 @@ function __construct($db) // 'langs'=>'mylangfile@listincsv', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'$conf->listincsv->enabled', // Define condition to show or hide menu entry. Use '$conf->listincsv->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->listincsv->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("listincsv", "level1", "level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; From 2db198b29fe359e95da68f759ab11ee70d884491 Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Fri, 20 Dec 2024 14:08:04 +0100 Subject: [PATCH 33/44] FIX when the page dont have set in hook doActions() --- class/actions_listincsv.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 6377057..990ae3e 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -63,7 +63,7 @@ function doActions($parameters, &$object, &$action, $hookmanager) { global $db, $user; - if(GETPOSTISSET('exportlistincsv', 'bool') && method_exists($object, 'call_trigger')) { + if(isset($object) && GETPOSTISSET('exportlistincsv', 'bool') && method_exists($object, 'call_trigger')) { $object->call_trigger('LISTINCSV_EXPORT_FILE_'.strtoupper($object->element), $user); } From 7b94e96f8f18bd26c36a30444b875adaa810964a Mon Sep 17 00:00:00 2001 From: ATM-nicolasV Date: Mon, 20 Jan 2025 16:58:30 +0100 Subject: [PATCH 34/44] add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN --- ChangeLog.md | 1 + class/actions_listincsv.class.php | 25 ++++++++++++++++++------- core/modules/modListInCSV.class.php | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 2edc14f..1ea0eb0 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ ## Unreleased ## release 1.9 +- FIX : Add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN - *20/01/2024* - 1.9.2 - FIX : COMPAT 21 - *10/12/2024* - 1.9.1 - NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index 22406bc..183b601 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -191,13 +191,24 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) $table.find('tr:has(td.liste_titre)').remove(); // < 6.0 // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child').each(function(index){ - $(this).find('dl').remove(); - if($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne - }); - - - // Suppression de la ligne TOTAL en pied de tableau + + $table.find('th:last-child, td:last-child').each(function(index) { + $(this).find('dl').remove(); + if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) { + $(this).remove(); // Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la dernière colonne + } + }); + + $table.find('th:first-child, td:first-child').each(function(index) { + $(this).find('dl').remove(); + if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) { + $(this).remove(); // Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la dernière colonne + } + }); + + + // Suppression de la ligne TOTAL en pied de tableau $table.find('tr.liste_total').remove(); //Suppression des espaces pour les nombres diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index e31e555..08eb184 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.1'; + $this->version = '1.9.2'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From c2107036e5e2d9ae9753250aa397236422ea7a8a Mon Sep 17 00:00:00 2001 From: ATM-nicolasV Date: Fri, 14 Mar 2025 10:34:13 +0100 Subject: [PATCH 35/44] =?UTF-8?q?d=C3=A9finission=20du=20chaine=20vide=20s?= =?UTF-8?q?i=20aucun=20titre=20trouv=C3=A9=20pour=20=C3=A9vit=C3=A9=20une?= =?UTF-8?q?=20erreur=20sur=20le=20trim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog.md | 1 + core/modules/modListInCSV.class.php | 2 +- js/listincsv.js.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 17c4ba5..5bb3825 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ ## Unreleased ## release 1.9 +- FIX : définission du chaine vide si aucun titre trouvé pour évité une erreur sur le trim - *14/03/2025* - 1.9.0 - NEW : DA025083 - Création d'un hook listInCSVFooterContext permettant à des modules externes d'utiliser ListInCSV. - *11/06/2024* - 1.9.0 ## release 1.8 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 8531cc5..f1470ac 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.0'; + $this->version = '1.9.1'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; diff --git a/js/listincsv.js.php b/js/listincsv.js.php index f6a7a36..13b9a39 100644 --- a/js/listincsv.js.php +++ b/js/listincsv.js.php @@ -86,7 +86,7 @@ function exportTableToCSV($table, filename) { let $colFirstChild = $col.children().first(); if ($col.find("span.linkobject:not(.hideobject)").length > 0) { // Fix sur liste produit si conf MAIN_DIRECT_STATUS_UPDATE active - text = $col.find("span.linkobject:not(.hideobject)").children().first().attr('title').trim(); + text = ($col.find("span.linkobject:not(.hideobject)").children().first().attr('title') || "").trim(); } else if ($col.find('a').length > 0 && $col.find('a')[0].href.indexOf('mailto:') == 0) { // Fix mails tronqués dans les listes par dol_trunc dans la fonction dol_print_email link=$col.find('a')[0].href; From fbdb28b0722afe2a64ce4f8fb6603898f469cb77 Mon Sep 17 00:00:00 2001 From: ATM-nicolasV Date: Fri, 14 Mar 2025 10:35:35 +0100 Subject: [PATCH 36/44] =?UTF-8?q?d=C3=A9finission=20du=20chaine=20vide=20s?= =?UTF-8?q?i=20aucun=20titre=20trouv=C3=A9=20pour=20=C3=A9vit=C3=A9=20une?= =?UTF-8?q?=20erreur=20sur=20le=20trim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 10e77ae..46a1511 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,7 +5,7 @@ ## release 1.9 -- FIX : définission du chaine vide si aucun titre trouvé pour évité une erreur sur le trim - *14/03/2025* - 1.9.0 +- FIX : définission du chaine vide si aucun titre trouvé pour évité une erreur sur le trim - *14/03/2025* - 1.9.3 - FIX : Add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN - *20/01/2024* - 1.9.2 - FIX : COMPAT 21 - *10/12/2024* - 1.9.1 - FIX : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.9.1 From 24c67f3e182ea52625305be06d90da8bcee3fd19 Mon Sep 17 00:00:00 2001 From: ATM-nicolasV Date: Fri, 14 Mar 2025 12:49:57 +0100 Subject: [PATCH 37/44] =?UTF-8?q?d=C3=A9finition=20d'une=20valeur=20par=20?= =?UTF-8?q?d=C3=A9faut=20si=20aucun=20titre=20trouv=C3=A9=20pour=20=C3=A9v?= =?UTF-8?q?iter=20une=20erreur=20sur=20la=20fonction=20trim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 46a1511..80ffd87 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,7 +5,7 @@ ## release 1.9 -- FIX : définission du chaine vide si aucun titre trouvé pour évité une erreur sur le trim - *14/03/2025* - 1.9.3 +- FIX : définition d'une valeur par défaut si aucun titre trouvé pour éviter une erreur sur la fonction trim - *14/03/2025* - 1.9.3 - FIX : Add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN - *20/01/2024* - 1.9.2 - FIX : COMPAT 21 - *10/12/2024* - 1.9.1 - FIX : Nettoyage et compatibilité Dolibarr 20 - *02/08/2024* - 1.9.1 From 6decff816d474b9197bed81c3a23f29c909aeeb8 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 18 Aug 2025 14:06:44 +0200 Subject: [PATCH 38/44] Warning Constant INC_FROM_DOLIBARR already defined --- ChangeLog.md | 1 + core/modules/modListInCSV.class.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 80ffd87..231083e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,7 @@ ## release 1.9 +- FIX : Warning Constant INC_FROM_DOLIBARR already defined - *18/08/2025* - 1.9.4 - FIX : définition d'une valeur par défaut si aucun titre trouvé pour éviter une erreur sur la fonction trim - *14/03/2025* - 1.9.3 - FIX : Add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN - *20/01/2024* - 1.9.2 - FIX : COMPAT 21 - *10/12/2024* - 1.9.1 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 5bbf983..1d5fa5e 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.3'; + $this->version = '1.9.4'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; @@ -264,7 +264,9 @@ function init($options='') { $sql = array(); - define('INC_FROM_DOLIBARR',true); + if (!defined('INC_FROM_DOLIBARR')) { + define('INC_FROM_DOLIBARR', true); + } dol_include_once('/listincsv/config.php'); dol_include_once('/listincsv/script/create-maj-base.php'); From 7d0db57e48bf1b931cff6a6df2656a337fcd1f54 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 2 Oct 2025 14:50:20 +0200 Subject: [PATCH 39/44] FIX : COMPAT 22 - *02/10/2025* - 1.9.5 --- ChangeLog.md | 1 + core/modules/modListInCSV.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 231083e..4ae1520 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,7 @@ ## release 1.9 +- FIX : COMPAT 22 - *02/10/2025* - 1.9.5 - FIX : Warning Constant INC_FROM_DOLIBARR already defined - *18/08/2025* - 1.9.4 - FIX : définition d'une valeur par défaut si aucun titre trouvé pour éviter une erreur sur la fonction trim - *14/03/2025* - 1.9.3 - FIX : Add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN - *20/01/2024* - 1.9.2 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 1d5fa5e..5e5f2c8 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.4'; + $this->version = '1.9.5'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From 752a29ebf4a9c36f824274a2f5790fc7d4c2f05b Mon Sep 17 00:00:00 2001 From: atm-nicolasV Date: Mon, 1 Dec 2025 12:27:08 +0100 Subject: [PATCH 40/44] compat v23 --- .gitignore | 2 +- README | 8 +- admin/listincsv_about.php | 18 +- admin/listincsv_setup.php | 40 ++--- .../core/class/commonhookactions.class.php | 8 +- class/actions_listincsv.class.php | 45 ++--- class/techatm.class.php | 160 +++++++++++------- config.default.php | 61 ++++--- config.php | 16 +- core/modules/modListInCSV.class.php | 106 ++++++------ ...99_modListInCSV_ListInCSVtrigger.class.php | 144 ++++++++-------- js/listincsv.js.php | 20 +-- langs/en_US/listincsv.lang | 2 +- langs/it_IT/listincsv.lang | 4 +- lib/listincsv.lib.php | 62 ++++--- script/create-maj-base.php | 5 +- 16 files changed, 378 insertions(+), 323 deletions(-) diff --git a/.gitignore b/.gitignore index 7125b52..2836ad2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .buildpath .project .settings/ -/nbproject \ No newline at end of file +/nbproject diff --git a/README b/README index 1e68a53..ec06e65 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ -/* +/* * Copyright (C) 2015 ATM Consulting * - * This program and files/directory inner it is free software: you can - * redistribute it and/or modify it under the terms of the + * This program and files/directory inner it is free software: you can + * redistribute it and/or modify it under the terms of the * GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. @@ -15,5 +15,3 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - diff --git a/admin/listincsv_about.php b/admin/listincsv_about.php index ac56edb..77ea66b 100644 --- a/admin/listincsv_about.php +++ b/admin/listincsv_about.php @@ -23,9 +23,9 @@ * Put some comments here */ // Dolibarr environment -$res = @include("../../main.inc.php"); // From htdocs directory +$res = @include "../../main.inc.php"; // From htdocs directory if (! $res) { - $res = @include("../../../main.inc.php"); // From "custom" directory + $res = @include "../../../main.inc.php"; // From "custom" directory } // Libraries @@ -37,7 +37,7 @@ // Access control if (! $user->admin) { - accessforbidden(); + accessforbidden(); } /* @@ -48,17 +48,17 @@ // Subheader $linkback = '' - . $langs->trans("BackToModuleList") . ''; + . $langs->trans("BackToModuleList") . ''; print_fiche_titre($langs->trans($page_name), $linkback); // Configuration header $head = listincsvAdminPrepareHead(); dol_fiche_head( - $head, - 'about', - $langs->trans("Module104856Name"), - 0, - 'listincsv@listincsv' + $head, + 'about', + $langs->trans("Module104856Name"), + 0, + 'listincsv@listincsv' ); // About page goes here diff --git a/admin/listincsv_setup.php b/admin/listincsv_setup.php index bc465b8..f9e9688 100644 --- a/admin/listincsv_setup.php +++ b/admin/listincsv_setup.php @@ -23,9 +23,9 @@ * Put some comments here */ // Dolibarr environment -$res = @include("../../main.inc.php"); // From htdocs directory +$res = @include "../../main.inc.php"; // From htdocs directory if (! $res) { - $res = @include("../../../main.inc.php"); // From "custom" directory + $res = @include "../../../main.inc.php"; // From "custom" directory } // Libraries @@ -37,7 +37,7 @@ // Access control if (! $user->admin) { - accessforbidden(); + accessforbidden(); } // Parameters @@ -46,30 +46,22 @@ /* * Actions */ -if (preg_match('/set_(.*)/',$action,$reg)) -{ +if (preg_match('/set_(.*)/', $action, $reg)) { $code=$reg[1]; - if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) - { + if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else - { + } else { dol_print_error($db); } } -if (preg_match('/del_(.*)/',$action,$reg)) -{ +if (preg_match('/del_(.*)/', $action, $reg)) { $code=$reg[1]; - if (dolibarr_del_const($db, $code, 0) > 0) - { + if (dolibarr_del_const($db, $code, 0) > 0) { Header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else - { + } else { dol_print_error($db); } } @@ -82,17 +74,17 @@ // Subheader $linkback = '' - . $langs->trans("BackToModuleList") . ''; + . $langs->trans("BackToModuleList") . ''; print_fiche_titre($langs->trans($page_name), $linkback); // Configuration header $head = listincsvAdminPrepareHead(); dol_fiche_head( - $head, - 'settings', - $langs->trans("Module104856Name"), - 0, - "listincsv@listincsv" + $head, + 'settings', + $langs->trans("Module104856Name"), + 0, + "listincsv@listincsv" ); //echo $langs->trans('NoSetupAvailable'); @@ -116,7 +108,7 @@ print '
'; print ''; print ''; -print $form->selectyesno("LISTINCSV_DELETESPACEFROMNUMBER", getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER'),1); +print $form->selectyesno("LISTINCSV_DELETESPACEFROMNUMBER", getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER'), 1); print ''; print '
'; print ''; diff --git a/backport/v19/core/class/commonhookactions.class.php b/backport/v19/core/class/commonhookactions.class.php index 5496f33..202e9e4 100644 --- a/backport/v19/core/class/commonhookactions.class.php +++ b/backport/v19/core/class/commonhookactions.class.php @@ -25,8 +25,7 @@ */ -if (file_exists(DOL_DOCUMENT_ROOT . '/core/class/commonhookactions.class.php')){ - +if (file_exists(DOL_DOCUMENT_ROOT . '/core/class/commonhookactions.class.php')) { require_once DOL_DOCUMENT_ROOT . '/core/class/commonhookactions.class.php'; /** * Parent class of all other hook actions classes @@ -35,7 +34,7 @@ abstract class RetroCompatCommonHookActions extends \CommonHookActions { } -}else{ +} else { /** * Parent class of all other hook actions classes */ @@ -53,6 +52,3 @@ abstract class RetroCompatCommonHookActions } } - - - diff --git a/class/actions_listincsv.class.php b/class/actions_listincsv.class.php index b94801c..6471a41 100644 --- a/class/actions_listincsv.class.php +++ b/class/actions_listincsv.class.php @@ -46,20 +46,24 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions /** * Constructor + * + * @return void */ - public function __construct() { + public function __construct() + { } /** * doActions * - * @param array() $parameters Hook metadatas (context, etc...) - * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string &$action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ - function doActions($parameters, &$object, &$action, $hookmanager) { + public function doActions($parameters, &$object, &$action, $hookmanager) + { global $db, $user; @@ -71,13 +75,14 @@ function doActions($parameters, &$object, &$action, $hookmanager) { /** * printCommonFooter * - * @param array() $parameters Hook metadatas (context, etc...) - * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string &$action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ - function printCommonFooter($parameters, &$object, &$action, $hookmanager) { + public function printCommonFooter($parameters, &$object, &$action, $hookmanager) + { $TContext = explode(':', $parameters['context']); $context_list = preg_grep('/(.*list$)/i', $TContext); @@ -111,12 +116,11 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (! empty($context_list)) { + if (!empty($context_list)) { global $langs, $user, $conf; $langs->load('listincsv@listincsv'); - if (! empty($user->hasRight('listincsv', 'export'))) { - + if (!empty($user->hasRight('listincsv', 'export'))) { require_once __DIR__ . './../lib/listincsv.lib.php'; $pathtojs = dol_buildpath('/listincsv/js/listincsv.js.php', 1); @@ -124,7 +128,8 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { $download = getListInCSVDownloadLink(); $socid = GETPOST('socid'); - if (empty($socid)) $socid = 0; + if (empty($socid)) + $socid = 0; $varsForJs = array( 'downloadButton' => $download, @@ -134,8 +139,8 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { 'FileGenerationInProgress' => $langs->trans('FileGenerationInProgress') ), 'conf' => array( - 'LISTINCSV_DONT_REMOVE_TOTAL' => ! empty(getDolGlobalInt('LISTINCSV_DONT_REMOVE_TOTAL')), - 'LISTINCSV_DELETESPACEFROMNUMBER' => ! empty(getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER')) + 'LISTINCSV_DONT_REMOVE_TOTAL' => !empty(getDolGlobalInt('LISTINCSV_DONT_REMOVE_TOTAL')), + 'LISTINCSV_DELETESPACEFROMNUMBER' => !empty(getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER')) ), ); // Inclusion d'un JS qui va permettre de télécharger la liste @@ -208,17 +213,17 @@ function printCommonFooter($parameters, &$object, &$action, $hookmanager) { $table.find('tr.liste_titre_filter').remove(); // >= 6.0 $table.find('tr:has(td.liste_titre)').remove(); // < 6.0 - // Suppression de la dernière colonne qui contient seulement les loupes des filtres + // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child').each(function(index) { + $table.find('th:last-child, td:last-child').each(function (index) { $(this).find('dl').remove(); if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) { $(this).remove(); // Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la dernière colonne } }); - $table.find('th:first-child, td:first-child').each(function(index) { + $table.find('th:first-child, td:first-child').each(function (index) { $(this).find('dl').remove(); if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) { $(this).remove(); // Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la dernière colonne diff --git a/class/techatm.class.php b/class/techatm.class.php index ae4f386..3db6775 100644 --- a/class/techatm.class.php +++ b/class/techatm.class.php @@ -2,11 +2,17 @@ /** * Class TechATM - * Class utilisée pour des mises à jours technique du module + * + * Technical class used for module technical updates + * Handles communication with ATM tech server for module information and updates */ namespace listincsv; +/** + * Class TechATM + * Class utilisée pour des mises à jours technique du module + */ class TechATM { @@ -58,35 +64,40 @@ class TechATM /** * Constructor * - * @param DoliDB $db + * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } /** - * @param DolibarrModules $moduleDescriptor + * Get about page content for a module + * + * @param DolibarrModules $moduleDescriptor Module descriptor + * @param bool $useCache Whether to use cached version + * @return string HTML content of the about page */ - function getAboutPage($moduleDescriptor, $useCache = true){ + public function getAboutPage($moduleDescriptor, $useCache = true) + { global $langs; - $url = self::ATM_TECH_URL.'/modules/modules-page-about.php'; - $url.= '?module='.$moduleDescriptor->name; - $url.= '&id='.$moduleDescriptor->numero; - $url.= '&version='.$moduleDescriptor->version; - $url.= '&langs='.$langs->defaultlang; - $url.= '&callv='.self::CALL_VERSION; + $url = self::ATM_TECH_URL . '/modules/modules-page-about.php'; + $url .= '?module=' . $moduleDescriptor->name; + $url .= '&id=' . $moduleDescriptor->numero; + $url .= '&version=' . $moduleDescriptor->version; + $url .= '&langs=' . $langs->defaultlang; + $url .= '&callv=' . self::CALL_VERSION; $cachePath = DOL_DATA_ROOT . "/modules-atm/temp/about_page"; - $cacheFileName = dol_sanitizeFileName($moduleDescriptor->name.'_'.$langs->defaultlang).'.html'; - $cacheFilePath = $cachePath.'/'.$cacheFileName; + $cacheFileName = dol_sanitizeFileName($moduleDescriptor->name . '_' . $langs->defaultlang) . '.html'; + $cacheFilePath = $cachePath . '/' . $cacheFileName; - if($useCache && is_readable($cacheFilePath)){ + if ($useCache && is_readable($cacheFilePath)) { $lastChange = filemtime($cacheFilePath); - if($lastChange > time() - 86400){ + if ($lastChange > time() - 86400) { $content = @file_get_contents($cacheFilePath); - if($content !== false){ + if ($content !== false) { return $content; } } @@ -94,29 +105,29 @@ function getAboutPage($moduleDescriptor, $useCache = true){ $content = $this->getContents($url); - if(!$content){ + if (!$content) { $content = ''; // About page goes here - $content.= '
'; - $content.= '
'.$langs->trans('ATMAbout').'
'; - $content.= '
'; - $content.= ''; - $content.= '
'; + $content .= '
'; + $content .= '
' . $langs->trans('ATMAbout') . '
'; + $content .= '
'; + $content .= ''; + $content .= '
'; } - if($useCache){ - if(!is_dir($cachePath)){ + if ($useCache) { + if (!is_dir($cachePath)) { $res = dol_mkdir($cachePath, DOL_DATA_ROOT); - }else{ + } else { $res = true; } - if($res){ - $comment = ''."\r\n"; + if ($res) { + $comment = '' . "\r\n"; file_put_contents( $cacheFilePath, - $comment.$content + $comment . $content ); } } @@ -125,40 +136,51 @@ function getAboutPage($moduleDescriptor, $useCache = true){ } /** - * @param string $moduleTechMane + * Get module documentation URL + * + * @param string $moduleTechMane Module technical name + * @return string URL to module documentation */ - public static function getModuleDocUrl($moduleTechMane){ - $url = self::ATM_TECH_URL.'/modules/doc-redirect.php'; - $url.= '?module='.$moduleTechMane; + public static function getModuleDocUrl($moduleTechMane) + { + $url = self::ATM_TECH_URL . '/modules/doc-redirect.php'; + $url .= '?module=' . $moduleTechMane; return $url; } /** - * @param DolibarrModules $moduleDescriptor + * Get URL to check for last module version + * + * @param DolibarrModules $moduleDescriptor Module descriptor + * @return string URL to check module version */ - public static function getLastModuleVersionUrl($moduleDescriptor){ - $url = self::ATM_TECH_URL.'/modules/modules-last-version.php'; - $url.= '?module='.$moduleDescriptor->name; - $url.= '&number='.$moduleDescriptor->numero; - $url.= '&version='.$moduleDescriptor->version; - $url.= '&dolversion='.DOL_VERSION; - $url.= '&callv='.self::CALL_VERSION; + public static function getLastModuleVersionUrl($moduleDescriptor) + { + $url = self::ATM_TECH_URL . '/modules/modules-last-version.php'; + $url .= '?module=' . $moduleDescriptor->name; + $url .= '&number=' . $moduleDescriptor->numero; + $url .= '&version=' . $moduleDescriptor->version; + $url .= '&dolversion=' . DOL_VERSION; + $url .= '&callv=' . self::CALL_VERSION; return $url; } /** - * @param $url - * @return false|object + * Get JSON data from a URL + * + * @param string $url URL to fetch JSON data from + * @return false|object JSON decoded object or false on failure */ - public function getJsonData($url){ + public function getJsonData($url) + { $this->data = false; $res = @file_get_contents($url); $this->http_response_header = $http_response_header; $this->TResponseHeader = self::parseHeaders($http_response_header); - if($res !== false){ + if ($res !== false) { $pos = strpos($res, '{'); - if($pos > 0){ + if ($pos > 0) { // cela signifie qu'il y a une erreur ou que la sortie n'est pas propre $res = substr($res, $pos); } @@ -170,24 +192,32 @@ public function getJsonData($url){ } /** - * @param $url - * @return false|string + * Get contents from a URL + * + * @param string $url URL to fetch contents from + * @return false|string Contents or false on failure */ - public function getContents($url){ + public function getContents($url) + { $this->data = false; $res = @file_get_contents($url); $this->http_response_header = $http_response_header; $this->TResponseHeader = self::parseHeaders($http_response_header); - if($res !== false){ + if ($res !== false) { $this->data = $res; } return $this->data; } - public static function http_response_code_msg($code = NULL) + /** + * Get HTTP response code message + * + * @param int|null $code HTTP response code + * @return string HTTP response message + */ + public static function httpResponseCodeMsg($code = null) { - if ($code !== NULL) { - + if ($code !== null) { switch ($code) { case 100: $text = 'Continue'; @@ -306,32 +336,34 @@ public static function http_response_code_msg($code = NULL) } return $text; - } else { return $text = 'Unknown http status code NULL'; } } - public static function parseHeaders( $headers ) + /** + * Parse HTTP response headers + * + * @param array $headers Array of HTTP headers + * @return array Parsed headers as associative array + */ + public static function parseHeaders($headers) { $head = array(); - if(!is_array($headers)){ + if (!is_array($headers)) { return $head; } - foreach( $headers as $k=>$v ) - { - $t = explode( ':', $v, 2 ); - if( isset( $t[1] ) ) - $head[ trim($t[0]) ] = trim( $t[1] ); - else - { + foreach ($headers as $k => $v) { + $t = explode(':', $v, 2); + if (isset($t[1])) + $head[trim($t[0])] = trim($t[1]); + else { $head[] = $v; - if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) ) + if (preg_match("#HTTP/[0-9\.]+\s+([0-9]+)#", $v, $out)) $head['reponse_code'] = intval($out[1]); } } return $head; } - } diff --git a/config.default.php b/config.default.php index e0b3ce6..7a73a2c 100644 --- a/config.default.php +++ b/config.default.php @@ -1,31 +1,42 @@ . + */ + if (is_file('../main.inc.php'))$dir = '../'; +elseif (is_file('../../../main.inc.php'))$dir = '../../../'; +else $dir = '../../'; - if(!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) { - include($dir."master.inc.php"); - } - elseif(!defined('INC_FROM_DOLIBARR')) { - include($dir."main.inc.php"); - } else { - global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_type; - } - if(!defined('DB_HOST')) { - define('DB_HOST',$dolibarr_main_db_host); - define('DB_NAME',$dolibarr_main_db_name); - define('DB_USER',$dolibarr_main_db_user); - define('DB_PASS',$dolibarr_main_db_pass); - define('DB_DRIVER',$dolibarr_main_db_type); - } +if (!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) { + include $dir."master.inc.php"; +} elseif (!defined('INC_FROM_DOLIBARR')) { + include $dir."main.inc.php"; +} else { + global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_type; +} - if(!dol_include_once('/abricot/inc.core.php')) { - print $langs->trans('AbricotNotFound'). ' : Abricot'; - exit; - } - - +if (!defined('DB_HOST')) { + define('DB_HOST', $dolibarr_main_db_host); + define('DB_NAME', $dolibarr_main_db_name); + define('DB_USER', $dolibarr_main_db_user); + define('DB_PASS', $dolibarr_main_db_pass); + define('DB_DRIVER', $dolibarr_main_db_type); +} +if (!dol_include_once('/abricot/inc.core.php')) { + print $langs->trans('AbricotNotFound'). ' : Abricot'; + exit; +} diff --git a/config.php b/config.php index 720094e..fe26e23 100644 --- a/config.php +++ b/config.php @@ -1,4 +1,18 @@ . + */ require __DIR__.'/config.default.php'; - diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 1d5fa5e..7a6ea7e 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -25,7 +25,7 @@ * \ingroup listincsv * \brief Description and activation file for module ListInCSV */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php'; /** @@ -38,11 +38,11 @@ class modListInCSV extends DolibarrModules * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { - global $langs,$conf; + global $langs, $conf; - $this->db = $db; + $this->db = $db; $this->editor_name = 'ATM Consulting'; $this->editor_url = 'https://www.atm-consulting.fr'; @@ -56,7 +56,7 @@ function __construct($db) // It is used to group modules in module setup page $this->family = 'ATM Consulting - CRM'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version @@ -67,13 +67,13 @@ function __construct($db) $this->url_last_version = \listincsv\TechATM::getLastModuleVersionUrl($this); // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto='modulelistincsv@listincsv'; + $this->picto = 'modulelistincsv@listincsv.png'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /listincsv/core/xxxxx) (0=disable, 1=enable) @@ -89,13 +89,13 @@ function __construct($db) // 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'css' => array('/listincsv/css/listincsv.css.php'), // Set this to relative path of css file if module has its own css file - // 'js' => array('/listincsv/js/listincsv.js'), // Set this to relative path of js file if module must load a js on all pages + // 'js' => array('/listincsv/js/listincsv.js'), // Set this to relative path of js file if module must load a js on all pages // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // 'dir' => array('output' => 'othermodulename'), // To force the default directories names // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@listincsv')) // Set here all workflow context managed by module // ); $this->module_parts = array( - 'hooks'=>array( + 'hooks' => array( 'main' ) ); @@ -112,8 +112,8 @@ function __construct($db) $this->depends = array(); // List of modules id that must be enabled if this module is enabled $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->conflictwith = array(); // List of modules id this module is in conflict with - $this->phpmin = array(5,0); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(3,9); // Minimum version of Dolibarr required by module + $this->phpmin = array(7, 4); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module $this->langfiles = array("listincsv@listincsv"); // Constants @@ -124,9 +124,9 @@ function __construct($db) $this->const = array(); // Array to add new pages in new tabs - // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@listincsv:$user->rights->listincsv->read:/listincsv/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 - // 'objecttype:+tabname2:Title2:mylangfile@listincsv:$user->rights->othermodule->read:/listincsv/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 - // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@listincsv:$user->hasRight('listincsv', 'read'):/listincsv/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 + // 'objecttype:+tabname2:Title2:mylangfile@listincsv:$user->hasRight('othermodule', 'read'):/listincsv/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 + // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'contact' to add a tab in contact view @@ -147,59 +147,58 @@ function __construct($db) // 'stock' to add a tab in stock view // 'thirdparty' to add a tab in third party view // 'user' to add a tab in user view - $this->tabs = array(); + $this->tabs = array(); - // Dictionaries - if (! isset($conf->listincsv->enabled)) - { - $conf->listincsv=new stdClass(); - $conf->listincsv->enabled=0; - } - $this->dictionaries=array(); - /* Example: - if (! isset($conf->listincsv->enabled)) $conf->listincsv->enabled=0; // This is to avoid warnings - $this->dictionaries=array( - 'langs'=>'mylangfile@listincsv', - 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor - 'tablib'=>array("Table1","Table2","Table3"), // Label of tables - 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields - 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order - 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) - 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) - 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) - 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->listincsv->enabled,$conf->listincsv->enabled,$conf->listincsv->enabled) // Condition to show each dictionary - ); - */ + // Dictionaries + if (!isset($conf->listincsv->enabled)) { + $conf->listincsv = new stdClass(); + $conf->listincsv->enabled = 0; + } + $this->dictionaries = array(); + /* Example: + if (! isset($conf->listincsv->enabled)) $conf->listincsv->enabled=0; // This is to avoid warnings + $this->dictionaries=array( + 'langs'=>'mylangfile@listincsv', + 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor + 'tablib'=>array("Table1","Table2","Table3"), // Label of tables + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields + 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order + 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) + 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) + 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) + 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond'=>array($conf->listincsv->enabled,$conf->listincsv->enabled,$conf->listincsv->enabled) // Condition to show each dictionary + ); + */ - // Boxes + // Boxes // Add here list of php file(s) stored in core/boxes that contains class to show a box. - $this->boxes = array(); // List of boxes + $this->boxes = array(); // List of boxes // Example: //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); // Permissions $this->rights = array(); // Permission array used by this module - $r=0; + $r = 0; // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: // $this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->hasRight('permkey', 'level1', 'level2')) + // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->hasRight('permkey', 'level1', 'level2')) // $r++; $this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used) $this->rights[$r][1] = $langs->trans('LISTINCSVExport'); // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'export'; // In php code, permission will be checked by test if ($user->rights->permkey->level1) + $this->rights[$r][4] = 'export'; // In php code, permission will be checked by test if ($user->hasRight('permkey', 'level1')) $r++; // Main menu entries $this->menu = array(); // List of menus to add - $r=0; + $r = 0; // Add here entries to declare new menus // @@ -213,7 +212,7 @@ function __construct($db) // 'langs'=>'mylangfile@listincsv', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'$conf->listincsv->enabled', // Define condition to show or hide menu entry. Use '$conf->listincsv->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->listincsv->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight('listincsv', 'level1', 'level2')' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -228,19 +227,19 @@ function __construct($db) // 'langs'=>'mylangfile@listincsv', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'$conf->listincsv->enabled', // Define condition to show or hide menu entry. Use '$conf->listincsv->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->listincsv->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight('listincsv', 'level1', 'level2')' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; // Exports - $r=1; + $r = 1; // Example: // $this->export_code[$r]=$this->rights_class.'_'.$r; // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. + // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. // $this->export_permission[$r]=array(array("facture","facture","export")); // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'); @@ -257,10 +256,10 @@ function __construct($db) * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * - * @param string $options Options when enabling module ('', 'noboxes') + * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - function init($options='') + public function init($options = '') { $sql = array(); @@ -271,7 +270,7 @@ function init($options='') dol_include_once('/listincsv/config.php'); dol_include_once('/listincsv/script/create-maj-base.php'); - $result=$this->_load_tables('/listincsv/sql/'); + $result = $this->_load_tables('/listincsv/sql/'); return $this->_init($sql, $options); } @@ -281,14 +280,13 @@ function init($options='') * Remove from database constants, boxes and permissions from Dolibarr database. * Data directories are not deleted * - * @param string $options Options when enabling module ('', 'noboxes') + * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - function remove($options='') + public function remove($options = '') { $sql = array(); return $this->_remove($sql, $options); } - } diff --git a/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php b/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php index 57d7081..4340fda 100644 --- a/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php +++ b/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php @@ -36,83 +36,83 @@ class InterfaceListInCSVtrigger { - private $db; + private $db; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - $this->name = preg_replace('/^Interface/i', '', get_class($this)); - $this->family = "demo"; - $this->description = "Triggers of this module are empty functions." - . "They have no effect." - . "They are provided for tutorial purpose only."; - // 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; - $this->picto = 'listincsv@listincsv'; - } + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "demo"; + $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; + $this->picto = 'listincsv@listincsv'; + } - /** - * Trigger name - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } + /** + * Trigger name + * + * @return string Name of trigger file + */ + public function getName() + { + return $this->name; + } - /** - * Trigger description - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } + /** + * Trigger description + * + * @return string Description of trigger file + */ + public function getDesc() + { + return $this->description; + } - /** - * Trigger version - * - * @return string Version of trigger file - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); + /** + * Trigger version + * + * @return string Version of trigger file + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); - if ($this->version == 'development') { - return $langs->trans("Development"); - } elseif ($this->version == 'experimental') + if ($this->version == 'development') { + return $langs->trans("Development"); + } elseif ($this->version == 'experimental') - return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else { - return $langs->trans("Unknown"); - } - } + return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') + return DOL_VERSION; + elseif ($this->version) + return $this->version; + else { + return $langs->trans("Unknown"); + } + } - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file - * is inside directory core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - public function run_trigger($action, $object, $user, $langs, $conf) - { - return 0; - } -} \ No newline at end of file + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file + * is inside directory core/triggers + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, $user, $langs, $conf) + { + return 0; + } +} diff --git a/js/listincsv.js.php b/js/listincsv.js.php index b28775e..9b203ef 100644 --- a/js/listincsv.js.php +++ b/js/listincsv.js.php @@ -26,16 +26,16 @@ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); -if (! defined('NOLOGIN')) define('NOLOGIN',1); -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (! defined('NOLOGIN')) define('NOLOGIN', 1); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -session_cache_limiter(FALSE); +session_cache_limiter(false); $res=0; if (! $res && file_exists("../../main.inc.php")) $res=@include_once '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory @@ -71,8 +71,8 @@ function exportTableToCSV($table, filename) { tmpRowDelim = String.fromCharCode(0), // null character // actual delimiter characters for CSV format - colDelim = '""', - rowDelim = '"\r\n"', + colDelim = '""', + rowDelim = '"\r\n"', // Grab text from table into CSV formatted string csv = '\ufeff"' + $rows.map(function(i, row) { diff --git a/langs/en_US/listincsv.lang b/langs/en_US/listincsv.lang index 5dc2988..259defb 100644 --- a/langs/en_US/listincsv.lang +++ b/langs/en_US/listincsv.lang @@ -9,4 +9,4 @@ ListInCSVAbout = About List in CSV NoSetupAvailable = No setup available. You can now dowload in CSV format any list from Dolibarr. An icon is available next to each list title. FileGenerationInProgress = CSV file generation in progress. -LISTINCSVExport=Allow user to export list in CSV \ No newline at end of file +LISTINCSVExport=Allow user to export list in CSV diff --git a/langs/it_IT/listincsv.lang b/langs/it_IT/listincsv.lang index 2b95126..a9be562 100644 --- a/langs/it_IT/listincsv.lang +++ b/langs/it_IT/listincsv.lang @@ -4,9 +4,9 @@ Module104856Desc = Aggiunge un icona per l'esportazione degli elenchi in formato ATMAbout = Questo modulo è stato sviluppato da ATM Consulting
Ulteriore documentazione disponibile nel wiki

Per domande e feedback contattateci a support@atm-consulting.fr

Per questioni commerciali contattateci acontact@atm-consulting.fr or at +33 9 77 19 50 70

Scoprite altri moduli sul Dolistore -ListInCSVSetup = Impostazioni modulo +ListInCSVSetup = Impostazioni modulo ListInCSVAbout = A proposito del modulo Elenco in CSV NoSetupAvailable = Nessuna impostazione disponibile. È possibile scaricare in formato CSV ogni elenco di Dolibarr. Un'icona è disponibile al fianco di ogni titolo degli elenchi -FileGenerationInProgress = Generazione file CSV in corso. \ No newline at end of file +FileGenerationInProgress = Generazione file CSV in corso. diff --git a/lib/listincsv.lib.php b/lib/listincsv.lib.php index be5c37e..eefbf3d 100644 --- a/lib/listincsv.lib.php +++ b/lib/listincsv.lib.php @@ -23,46 +23,56 @@ * Put some comments here */ +/** + * Prepare admin pages header + * + * @return array Array of tabs to show + */ function listincsvAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf; - $langs->load("listincsv@listincsv"); + $langs->load("listincsv@listincsv"); - $h = 0; - $head = array(); + $h = 0; + $head = array(); - $head[$h][0] = dol_buildpath("/listincsv/admin/listincsv_setup.php", 1); - $head[$h][1] = $langs->trans("Parameters"); - $head[$h][2] = 'settings'; - $h++; - $head[$h][0] = dol_buildpath("/listincsv/admin/listincsv_about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; + $head[$h][0] = dol_buildpath("/listincsv/admin/listincsv_setup.php", 1); + $head[$h][1] = $langs->trans("Parameters"); + $head[$h][2] = 'settings'; + $h++; + $head[$h][0] = dol_buildpath("/listincsv/admin/listincsv_about.php", 1); + $head[$h][1] = $langs->trans("About"); + $head[$h][2] = 'about'; + $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - //$this->tabs = array( - // 'entity:+tabname:Title:@listincsv:/listincsv/mypage.php?id=__ID__' - //); // to add new tab - //$this->tabs = array( - // 'entity:-tabname:Title:@listincsv:/listincsv/mypage.php?id=__ID__' - //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'listincsv'); + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@listincsv:/listincsv/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@listincsv:/listincsv/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'listincsv'); - return $head; + return $head; } -function getListInCSVDownloadLink() { +/** + * Get ListInCSV download link with icon + * + * @return string HTML link with icon for CSV download + */ +function getListInCSVDownloadLink() +{ - $pathtoimg = dol_buildpath('/listincsv/img/listincsv.png',1); + $pathtoimg = dol_buildpath('/listincsv/img/listincsv.png', 1); //$pathtoimg = dol_buildpath('/theme/eldy/img/upload.png',1); $link = ''; $endlink = ''; - $img = ' '; + $img = ' '; return $link . $img . $endlink; - } diff --git a/script/create-maj-base.php b/script/create-maj-base.php index 7f9e890..3c155a2 100644 --- a/script/create-maj-base.php +++ b/script/create-maj-base.php @@ -3,11 +3,10 @@ * Script créant et vérifiant que les champs requis s'ajoutent bien */ -if(!defined('INC_FROM_DOLIBARR')) { +if (!defined('INC_FROM_DOLIBARR')) { define('INC_FROM_CRON_SCRIPT', true); - require('../config.php'); - + require '../config.php'; } From 528ed3f7a13bb3cea360da555aab82df3de53407 Mon Sep 17 00:00:00 2001 From: atm-nicolasV Date: Tue, 2 Dec 2025 07:52:20 +0100 Subject: [PATCH 41/44] compatibility v23 --- class/techatm.class.php | 16 ++++++++++++++++ config.default.php | 5 ----- core/modules/modListInCSV.class.php | 2 +- ...ce_99_modListInCSV_ListInCSVtrigger.class.php | 2 +- script/create-maj-base.php | 16 ++++++++++++++++ 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/class/techatm.class.php b/class/techatm.class.php index 3db6775..67919bf 100644 --- a/class/techatm.class.php +++ b/class/techatm.class.php @@ -1,4 +1,20 @@ + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + /** * Class TechATM diff --git a/config.default.php b/config.default.php index 7a73a2c..50ce938 100644 --- a/config.default.php +++ b/config.default.php @@ -35,8 +35,3 @@ define('DB_PASS', $dolibarr_main_db_pass); define('DB_DRIVER', $dolibarr_main_db_type); } - -if (!dol_include_once('/abricot/inc.core.php')) { - print $langs->trans('AbricotNotFound'). ' : Abricot'; - exit; -} diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 7a6ea7e..db537d3 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -73,7 +73,7 @@ public function __construct($db) // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto = 'modulelistincsv@listincsv.png'; + $this->picto = 'modulelistincsv@listincsv'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /listincsv/core/xxxxx) (0=disable, 1=enable) diff --git a/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php b/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php index 4340fda..4c33eb3 100644 --- a/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php +++ b/core/triggers/interface_99_modListInCSV_ListInCSVtrigger.class.php @@ -48,7 +48,7 @@ public function __construct($db) $this->db = $db; $this->name = preg_replace('/^Interface/i', '', get_class($this)); - $this->family = "demo"; + $this->family = "ATM Consulting - CRM"; $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; // 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; diff --git a/script/create-maj-base.php b/script/create-maj-base.php index 3c155a2..b88beb6 100644 --- a/script/create-maj-base.php +++ b/script/create-maj-base.php @@ -1,4 +1,20 @@ + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + /* * Script créant et vérifiant que les champs requis s'ajoutent bien */ From 5de27f3c86ec6ac1fad9d69c46caebc20dbdf2ec Mon Sep 17 00:00:00 2001 From: atm-nicolasV Date: Tue, 2 Dec 2025 07:53:51 +0100 Subject: [PATCH 42/44] compatibility v23 --- ChangeLog.md | 2 +- core/modules/modListInCSV.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 231083e..d658b85 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,8 +3,8 @@ ## Unreleased - ## release 1.9 +- FIX : Compatibility Dolibarr 23 - *02/12/2025* - 1.9.5 - FIX : Warning Constant INC_FROM_DOLIBARR already defined - *18/08/2025* - 1.9.4 - FIX : définition d'une valeur par défaut si aucun titre trouvé pour éviter une erreur sur la fonction trim - *14/03/2025* - 1.9.3 - FIX : Add compatibility with conf MAIN_CHECKBOX_LEFT_COLUMN - *20/01/2024* - 1.9.2 diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index db537d3..22dfbde 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ public function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.4'; + $this->version = '1.9.5'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From 415c3399dbdee3554a50684d006ba5552e5a1c0b Mon Sep 17 00:00:00 2001 From: atm-nicolasV Date: Tue, 2 Dec 2025 08:02:33 +0100 Subject: [PATCH 43/44] compat v23 --- ChangeLog.md | 2 - class/actions_listincsv.class.php.orig | 72 +++++++++++++++----------- core/modules/modListInCSV.class.php | 2 +- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4b446d4..8e1fbac 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,8 +2,6 @@ ## Unreleased - - ## release 1.9 - FIX : Compatibility Dolibarr 23 - *02/12/2025* - 1.9.6 - FIX : COMPAT 22 - *02/10/2025* - 1.9.5 diff --git a/class/actions_listincsv.class.php.orig b/class/actions_listincsv.class.php.orig index 3323750..cc8d472 100644 --- a/class/actions_listincsv.class.php.orig +++ b/class/actions_listincsv.class.php.orig @@ -46,24 +46,28 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions /** * Constructor + * + * @return void */ - public function __construct() { + public function __construct() + { } /** * doActions * - * @param array() $parameters Hook metadatas (context, etc...) - * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string &$action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ - function doActions($parameters, &$object, &$action, $hookmanager) { + public function doActions($parameters, &$object, &$action, $hookmanager) + { global $db, $user; - if (GETPOSTISSET('exportlistincsv', 'bool') && is_object($object) && method_exists($object, 'call_trigger')) { + if (isset($object) && GETPOSTISSET('exportlistincsv', 'bool') && is_object($object) && method_exists($object, 'call_trigger')) { $object->call_trigger('LISTINCSV_EXPORT_FILE_' . strtoupper($object->element), $user); } } @@ -71,13 +75,14 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions /** * printCommonFooter * - * @param array() $parameters Hook metadatas (context, etc...) - * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string &$action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ - function printCommonFooter($parameters, &$object, &$action, $hookmanager) { + public function printCommonFooter($parameters, &$object, &$action, $hookmanager) + { $TContext = explode(':', $parameters['context']); $context_list = preg_grep('/(.*list$)/i', $TContext); @@ -111,12 +116,11 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (! empty($context_list)) { + if (!empty($context_list)) { global $langs, $user, $conf; $langs->load('listincsv@listincsv'); - if (! empty($user->hasRight('listincsv', 'export'))) { - + if (!empty($user->hasRight('listincsv', 'export'))) { require_once __DIR__ . './../lib/listincsv.lib.php'; $pathtojs = dol_buildpath('/listincsv/js/listincsv.js.php', 1); @@ -124,7 +128,8 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions $download = getListInCSVDownloadLink(); $socid = GETPOST('socid'); - if (empty($socid)) $socid = 0; + if (empty($socid)) + $socid = 0; $varsForJs = array( 'downloadButton' => $download, @@ -134,8 +139,8 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions 'FileGenerationInProgress' => $langs->trans('FileGenerationInProgress') ), 'conf' => array( - 'LISTINCSV_DONT_REMOVE_TOTAL' => ! empty(getDolGlobalInt('LISTINCSV_DONT_REMOVE_TOTAL')), - 'LISTINCSV_DELETESPACEFROMNUMBER' => ! empty(getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER')) + 'LISTINCSV_DONT_REMOVE_TOTAL' => !empty(getDolGlobalInt('LISTINCSV_DONT_REMOVE_TOTAL')), + 'LISTINCSV_DELETESPACEFROMNUMBER' => !empty(getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER')) ), ); // Inclusion d'un JS qui va permettre de télécharger la liste @@ -209,17 +214,34 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions $table.find('tr:has(td.liste_titre)').remove(); // < 6.0 <<<<<<< HEAD + // Suppression de la dernière colonne qui contient seulement les loupes des filtres + + $table.find('th:last-child, td:last-child').each(function (index) { +======= + let extraslectorfilter = ''; + + extraslectorfilter = ':not(.tdforbreak)'; + + // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child').each(function(index) { + $table.find('th:last-child, td:last-child'+extraslectorfilter).each(function(index) { +>>>>>>> 1478a5b805be344b7d452360294e6fd6851f5c1f $(this).find('dl').remove(); if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) { $(this).remove(); // Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la dernière colonne } }); - $table.find('th:first-child, td:first-child').each(function(index) { +<<<<<<< HEAD + $table.find('th:first-child, td:first-child').each(function (index) { +======= + $table.find('th:first-child, td:first-child'+extraslectorfilter).each(function(index) { +>>>>>>> 1478a5b805be344b7d452360294e6fd6851f5c1f $(this).find('dl').remove(); if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) { $(this).remove(); // Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la dernière colonne @@ -227,14 +249,7 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions }); - // Suppression de la ligne TOTAL en pied de tableau - $table.find('tr.liste_total').remove(); -======= - // Suppression de la dernière colonne qui contient seulement les loupes des filtres - $table.find('th:last-child, td:last-child').each(function (index) { - $(this).find('dl').remove(); - if ($(search).length > 0 && $(this).closest('table').hasClass('liste')) $(this).remove(); //Dans les listes ne contenant pas de recherche, il ne faut pas supprimer la derniere colonne - }); + // Suppression de la ligne TOTAL en pied de tableau if (varsFromPHP.conf['LISTINCSV_DONT_REMOVE_TOTAL']) { @@ -249,7 +264,6 @@ class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions if ($.isNumeric(commaToPoint)) $(this).html(nbWthtSpace); }); } ->>>>>>> e6a2264ca38fab7af0f059d9d794f2bbddb6633c // Remplacement des sous-table par leur valeur text(), notamment pour la ref dans les listes de propales, factures... $table.find('td > table').map(function (i, cell) { diff --git a/core/modules/modListInCSV.class.php b/core/modules/modListInCSV.class.php index 22dfbde..8174b7d 100644 --- a/core/modules/modListInCSV.class.php +++ b/core/modules/modListInCSV.class.php @@ -60,7 +60,7 @@ public function __construct($db) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ListInCSV permet d'exporter en CSV une liste Dolibarr telle qu'elle apparaît à l'écran."; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.9.5'; + $this->version = '1.9.6'; // Url to the file with your last numberversion of this module require_once __DIR__ . '/../../class/techatm.class.php'; From 0da8ae25969f349c9601d82a4090acc22bfa405e Mon Sep 17 00:00:00 2001 From: atm-nicolasV Date: Tue, 2 Dec 2025 08:08:08 +0100 Subject: [PATCH 44/44] compat v23 --- class/actions_listincsv.class.php.orig | 293 ------------------------- 1 file changed, 293 deletions(-) delete mode 100644 class/actions_listincsv.class.php.orig diff --git a/class/actions_listincsv.class.php.orig b/class/actions_listincsv.class.php.orig deleted file mode 100644 index cc8d472..0000000 --- a/class/actions_listincsv.class.php.orig +++ /dev/null @@ -1,293 +0,0 @@ - - * Copyright (C) 2015 ATM Consulting - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/actions_listincsv.class.php - * \ingroup listincsv - * \brief This file is an example hook overload class file - * Put some comments here - */ -require_once __DIR__ . '/../backport/v19/core/class/commonhookactions.class.php'; - -/** - * Class ActionsListInCSV - */ -class ActionsListInCSV extends \listincsv\RetroCompatCommonHookActions -{ - /** - * @var array Hook results. Propagated to $hookmanager->resArray for later reuse - */ - public $results = array(); - - /** - * @var string String displayed by executeHook() immediately after return - */ - public $resprints; - - /** - * @var array Errors - */ - public $errors = array(); - - /** - * Constructor - * - * @return void - */ - public function __construct() - { - } - - /** - * doActions - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function doActions($parameters, &$object, &$action, $hookmanager) - { - - global $db, $user; - - if (isset($object) && GETPOSTISSET('exportlistincsv', 'bool') && is_object($object) && method_exists($object, 'call_trigger')) { - $object->call_trigger('LISTINCSV_EXPORT_FILE_' . strtoupper($object->element), $user); - } - } - - /** - * printCommonFooter - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function printCommonFooter($parameters, &$object, &$action, $hookmanager) - { - $TContext = explode(':', $parameters['context']); - $context_list = preg_grep('/(.*list$)/i', $TContext); - - // Gestion des objets référents produits - if (empty($context_list)) { - $context_list = preg_grep('/(productstats.*)/i', $TContext); - } - - // Gestion des écrans objets référents tiers - if (empty($context_list)) { - $context_list = preg_grep('/(consumptionthirdparty)/i', $TContext); - } - - // Gestion des écrans objets référents tiers - if (empty($context_list)) { - $context_list = preg_grep('/(stockatdate)/i', $TContext); - } - - // Gestion des écrans objets référents tiers - if (empty($context_list)) { - $context_list = preg_grep('/(thirdpartycustomerprice)/i', $TContext); - } - if (empty($context_list)) { - $context_list = preg_grep('/(agefoddsessionsubscribers)/i', $TContext); - } - - // Permettre à d'autres modules externes d'utiliser listInCSV - $parameters['context_list'] = &$context_list; - $reshook = $hookmanager->executeHooks('listInCSVFooterContext', $parameters); - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - - if (!empty($context_list)) { - global $langs, $user, $conf; - $langs->load('listincsv@listincsv'); - - if (!empty($user->hasRight('listincsv', 'export'))) { - require_once __DIR__ . './../lib/listincsv.lib.php'; - - $pathtojs = dol_buildpath('/listincsv/js/listincsv.js.php', 1); - - $download = getListInCSVDownloadLink(); - - $socid = GETPOST('socid'); - if (empty($socid)) - $socid = 0; - - $varsForJs = array( - 'downloadButton' => $download, - 'TContexts' => explode(':', $parameters['context']), - 'socid' => $socid, - 'langs' => array( - 'FileGenerationInProgress' => $langs->trans('FileGenerationInProgress') - ), - 'conf' => array( - 'LISTINCSV_DONT_REMOVE_TOTAL' => !empty(getDolGlobalInt('LISTINCSV_DONT_REMOVE_TOTAL')), - 'LISTINCSV_DELETESPACEFROMNUMBER' => !empty(getDolGlobalInt('LISTINCSV_DELETESPACEFROMNUMBER')) - ), - ); - // Inclusion d'un JS qui va permettre de télécharger la liste - ?> - - -