From f45d9b3b4cae96e4d11ddb0612092ffe0abd6268 Mon Sep 17 00:00:00 2001 From: phf Date: Fri, 22 Jul 2016 15:12:03 +0200 Subject: [PATCH 01/47] REVERT THIS --- build/pad/DoliWamp.pml | 2 +- build/pad/Dolibarr.pml | 16 ++++++++-------- build/pad/pad_dolibarr.xml | 16 ++++++++-------- build/pad/pad_doliwamp.xml | 2 +- .../phpexcel/Classes/PHPExcel/locale/cs/config | 2 +- .../Classes/PHPExcel/locale/cs/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/da/config | 4 ++-- .../Classes/PHPExcel/locale/da/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/de/config | 4 ++-- .../Classes/PHPExcel/locale/de/functions | 2 +- .../Classes/PHPExcel/locale/en/uk/config | 2 +- .../phpexcel/Classes/PHPExcel/locale/es/config | 4 ++-- .../Classes/PHPExcel/locale/es/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/fi/config | 4 ++-- .../Classes/PHPExcel/locale/fi/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/fr/config | 4 ++-- .../Classes/PHPExcel/locale/fr/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/hu/config | 2 +- .../Classes/PHPExcel/locale/hu/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/it/config | 4 ++-- .../Classes/PHPExcel/locale/it/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/nl/config | 4 ++-- .../Classes/PHPExcel/locale/nl/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/no/config | 4 ++-- .../Classes/PHPExcel/locale/no/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/pl/config | 4 ++-- .../Classes/PHPExcel/locale/pl/functions | 2 +- .../Classes/PHPExcel/locale/pt/br/config | 4 ++-- .../phpexcel/Classes/PHPExcel/locale/pt/config | 4 ++-- .../phpexcel/Classes/PHPExcel/locale/ru/config | 4 ++-- .../Classes/PHPExcel/locale/ru/functions | 2 +- .../phpexcel/Classes/PHPExcel/locale/sv/config | 4 ++-- .../phpexcel/Classes/PHPExcel/locale/tr/config | 4 ++-- .../Classes/PHPExcel/locale/tr/functions | 2 +- 34 files changed, 62 insertions(+), 62 deletions(-) diff --git a/build/pad/DoliWamp.pml b/build/pad/DoliWamp.pml index e0f2b99bfec..fa2da1902aa 100644 --- a/build/pad/DoliWamp.pml +++ b/build/pad/DoliWamp.pml @@ -42,7 +42,7 @@ DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs. DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. - DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. + DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. diff --git a/build/pad/Dolibarr.pml b/build/pad/Dolibarr.pml index 250aed0d791..3ef5e16137c 100644 --- a/build/pad/Dolibarr.pml +++ b/build/pad/Dolibarr.pml @@ -42,10 +42,10 @@ Dolibarr ERP & CRM, the easy to use open source software to manage your activity Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to follow. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. - Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: -Simple to install -Simple to use -Simple to develop + Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: +Simple to install +Simple to use +Simple to develop Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian). @@ -62,10 +62,10 @@ Note that Dolibarr is also available with an auto-installer for Windows or Ubunt Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). - Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): -Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) -Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) -Simple pour le développement (pas de frameworks lourds). + Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): +Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) +Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) +Simple pour le développement (pas de frameworks lourds). Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index c8ad2c62cfb..0920a19311d 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -72,10 +72,10 @@ Dolibarr ERP & CRM, the easy to use open source software to manage your activity Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to manage. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. - Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: -Simple to install -Simple to use -Simple to develop + Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: +Simple to install +Simple to use +Simple to develop Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian). @@ -84,10 +84,10 @@ Note that Dolibarr is also available with an auto-installer for Windows or Ubunt Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). - Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): -Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) -Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) -Simple pour le développement (pas de frameworks lourds). + Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): +Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) +Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) +Simple pour le développement (pas de frameworks lourds). Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. diff --git a/build/pad/pad_doliwamp.xml b/build/pad/pad_doliwamp.xml index 3ee629c644b..8abf126d5f7 100644 --- a/build/pad/pad_doliwamp.xml +++ b/build/pad/pad_doliwamp.xml @@ -72,7 +72,7 @@ DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs. DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. - DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. + DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config index 500460e8ab5..8992916acaf 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions index b648e20c2b0..f9d69784ae2 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config index b959379b133..cef47e9502d 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -37,7 +37,7 @@ currencySymbol = kr ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NUL! DIV0 = #DIVISION/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions index 1599ccd1815..1db4d30bb1c 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config index 7e2ba9d2891..ff7e29899cc 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = € ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NULL! DIV0 = #DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions index 8214f384878..ce85641a3c9 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config index 00acff8bc34..f008e61cc90 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config index 8f7d9e084ec..fa16f5639df 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rath ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #¡NULO! DIV0 = #¡DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions index aa065969f3d..51ce48b3153 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config index 36bc3fc70b8..a481864a6fa 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = $ # Symbol not known, should it be a € (Euro)? ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #TYHJÄ! DIV0 = #JAKO/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions index c10b3b9f381..7bed722a641 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config index 80f7d5411a6..2240d6b9f8b 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = € ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NUL! DIV0 = #DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions index cce977b15bc..8d25f6ac193 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config index c6c315814c4..dec7cbde15d 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions index 941c1b740d0..4abce13b91b 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config index 97af8b9a570..f862a02d72d 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = € ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NULLO! DIV0 = #DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions index 862cf8302c8..b9219a6a4ce 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config index a14b476c945..7377a181df0 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = € ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #LEEG! DIV0 = #DEEL/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions index 79b7acd1ef9..b6b8296ef04 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config index e3e3cc4f786..15fcc128640 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = kr ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NULL! DIV0 = #DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions index 3cccce42a1d..57a80a7a406 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config index ea111797270..fb1e7b13d9d 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = zł ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #ZERO! DIV0 = #DZIEL/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions index 5607f8f672c..2e5697973c1 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config index d39c5c63438..e99aad6bea4 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = R$ ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NULO! DIV0 = #DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config index 5e486bb29ff..36df63cc012 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = € ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #NULO! DIV0 = #DIV/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config index 098c8075d29..205c342ada4 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = р ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #ПУСТО! DIV0 = #ДЕЛ/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions index 86bcd4f63a7..324c3df2a81 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config index c2094c06249..454e52ef52f 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = kr ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #Skärning! DIV0 = #Division/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config index cca084b2ba5..8a103d3c196 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ currencySymbol = YTL ## -## Excel Error Codes (For future use) +## Excel Error Codes (For future use) ## NULL = #BOŞ! DIV0 = #SAYI/0! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions index 3e7c225f402..79645214714 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or From 0f0db5a3fb7bc70cb10ee0d64e468a7c252ee420 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 10 Dec 2016 12:06:18 +0100 Subject: [PATCH 02/47] fix: uniformize --- htdocs/core/ajax/bankconciliate.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index 826e6fe9ba4..3a8a3e30687 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -51,8 +51,8 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ { // Increase date $al = new AccountLine($db); - $al->datev_next($_GET["rowid"]); - $al->fetch($_GET["rowid"]); + $al->datev_next(GETPOST('rowid','int')); + $al->fetch(GETPOST('rowid','int')); print ''.dol_print_date($db->jdate($al->datev),"day").''; @@ -63,8 +63,8 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ { // Decrease date $al =new AccountLine($db); - $al->datev_previous($_GET["rowid"]); - $al->fetch($_GET["rowid"]); + $al->datev_previous(GETPOST('rowid','int')); + $al->fetch(GETPOST('rowid','int')); print ''.dol_print_date($db->jdate($al->datev),"day").''; From 337509d40f7b08bd46aca6156b1275e7430077ee Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 13 Dec 2016 09:40:08 +0100 Subject: [PATCH 03/47] Fix: missing date locale and date rfc --- htdocs/core/class/commondocgenerator.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 6a6a32c15f9..75336e2a291 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -586,9 +586,10 @@ abstract class CommonDocGenerator { if (strlen($object->array_options['options_'.$key])>0) { - $object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language - $object->array_options['options_'.$key.'_locale'] = dol_print_date($object->array_options['options_'.$key],'day','tzserver',$outputlangs); // using output language format - $object->array_options['options_'.$key.'_rfc'] = dol_print_date($object->array_options['options_'.$key],'dayrfc'); // international format + $date = $object->array_options['options_'.$key]; + $object->array_options['options_'.$key] = dol_print_date($date,'day'); // using company output language + $object->array_options['options_'.$key.'_locale'] = dol_print_date($date,'day','tzserver',$outputlangs); // using output language format + $object->array_options['options_'.$key.'_rfc'] = dol_print_date($date,'dayrfc'); // international format } else { @@ -596,12 +597,17 @@ abstract class CommonDocGenerator $object->array_options['options_'.$key.'_locale'] = ''; $object->array_options['options_'.$key.'_rfc'] = ''; } + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } else if($extrafields->attribute_type[$key] == 'datetime') { - $object->array_options['options_'.$key] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language - $object->array_options['options_'.$key.'_locale'] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour','tzserver',$outputlangs):''); // using output language format - $object->array_options['options_'.$key.'_rfc'] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):''); // international format + $datetime = $object->array_options['options_'.$key]; + $object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language + $object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour','tzserver',$outputlangs):''); // using output language format + $object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):''); // international format + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key])); } From 4dd740fe2f4bb1f8da072180b3da731b0809dc62 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 13 Dec 2016 11:41:26 +0100 Subject: [PATCH 04/47] FIX : wrong test on dict.php --- htdocs/admin/dict.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index bef8c6951bf..cae081e55e3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1292,8 +1292,6 @@ if ($id) } else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) From 2cebeb72aa9707cb9873007af53b37a8d1658bdf Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 14 Dec 2016 15:04:07 +0100 Subject: [PATCH 05/47] FIX navigation field is always ref --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1afae6875ae..9d495db66ae 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1307,7 +1307,7 @@ abstract class CommonObject $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; - $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; + $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->$fieldid)."'"; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity @@ -1328,7 +1328,7 @@ abstract class CommonObject $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; - $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; + $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->$fieldid)."'"; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity From 1f1c75adfb627d6e48543959ee8804bd84241359 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 14 Dec 2016 15:50:50 +0100 Subject: [PATCH 06/47] FIX : HT and TTC price should always be displayed together --- htdocs/product/price.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 88c6c3e57b1..3be258f4243 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1269,14 +1269,14 @@ if ($result) } else { - print '' . ($objp->price_base_type != 'TTC' ? price($objp->price) : ''). ""; - print '' . ($objp->price_base_type == 'TTC' ? price($objp->price_ttc) : '') . ""; + print '' . price($objp->price). ""; + print '' . price($objp->price_ttc) . ""; if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled print ''; } } - print '' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . ''; - print '' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . ''; + print '' . price($objp->price_min) . ''; + print '' . price($objp->price_min_ttc) . ''; // User print '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . ''; From 2777c4d4a5ec16142c4ae0317f1d7227f4b4e31c Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 14 Dec 2016 18:35:59 +0100 Subject: [PATCH 07/47] FIX: Setting supplier as client when accept a supplier proposal --- .../class/supplier_proposal.class.php | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 09fa2dc69e9..d14591b6b9f 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -1631,24 +1632,11 @@ class SupplierProposal extends CommonObject $trigger_name='SUPPLIER_PROPOSAL_CLOSE_SIGNED'; $modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf; - // The connected company is classified as a client - $soc=new Societe($this->db); - $soc->id = $this->socid; - $result=$soc->set_as_client(); - - if ($result < 0) + if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists { - $this->error=$this->db->error(); - $this->db->rollback(); - return -2; + $result = $this->updateOrCreatePriceFournisseur($user); } - else - { - if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists - { - $result = $this->updateOrCreatePriceFournisseur($user); - } - } + } if ($statut == 4) { From c2dc140024dbec6bc38aca487b3822065dd0554b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 15 Dec 2016 11:09:03 +0100 Subject: [PATCH 08/47] Cleaning code --- htdocs/contact/note.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 17c718cfb42..6862ea0e4bf 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -74,11 +74,6 @@ if ($id > 0) $head = contact_prepare_head($object); dol_fiche_head($head, 'note', $title,0,'contact'); - - - print '
'; - print ''; - $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); @@ -88,11 +83,12 @@ if ($id > 0) //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; print '
'; - print '
'; - print ''; - $linkback = ''.$langs->trans("BackToList").''; + print ''; + print ''; + + print '
'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -154,7 +150,6 @@ if ($id > 0) include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); } From 21a648a052cc1d6b0e83a9957b115dc7a217e5c8 Mon Sep 17 00:00:00 2001 From: phf Date: Thu, 15 Dec 2016 12:01:46 +0100 Subject: [PATCH 09/47] Fix user right on margin module to write buyprice --- htdocs/comm/propal.php | 13 +++++++++++++ htdocs/commande/card.php | 14 ++++++++++++++ htdocs/compta/facture.php | 13 +++++++++++++ htdocs/core/class/commonobject.class.php | 13 ++++++++----- htdocs/core/tpl/objectline_create.tpl.php | 10 ++++++++-- htdocs/core/tpl/objectline_edit.tpl.php | 3 +++ htdocs/core/tpl/objectline_view.tpl.php | 3 +++ 7 files changed, 62 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 29b57839d56..637a88f7468 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -978,6 +978,19 @@ if (empty($reshook)) if (! $error) { $db->begin(); + if (empty($user->rights->margins->creer)) + { + foreach ($object->lines as &$line) + { + if ($line->id == GETPOST('lineid')) + { + $fournprice = $line->fk_fournprice; + $buyingprice = $line->pa_ht; + break; + } + } + } + $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"]); if ($result >= 0) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ee576ed48e5..9b10f17668c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -909,6 +909,20 @@ if (empty($reshook)) } if (! $error) { + + if (empty($user->rights->margins->creer)) + { + foreach ($object->lines as &$line) + { + if ($line->id == GETPOST('lineid')) + { + $fournprice = $line->fk_fournprice; + $buyingprice = $line->pa_ht; + break; + } + } + } + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units')); if ($result >= 0) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 34ed1383e14..f1d2b7b1123 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1612,6 +1612,19 @@ if (empty($reshook)) // Update line if (! $error) { + if (empty($user->rights->margins->creer)) + { + foreach ($object->lines as &$line) + { + if ($line->id == GETPOST('lineid')) + { + $fournprice = $line->fk_fournprice; + $buyingprice = $line->pa_ht; + break; + } + } + } + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'), diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3279d372a0e..093652ade1e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3090,11 +3090,14 @@ abstract class CommonObject if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) { - if ($conf->global->MARGIN_TYPE == "1") - print ''; - else - print ''; - + if (!empty($user->rights->margins->creer)) + { + if ($conf->global->MARGIN_TYPE == "1") + print ''; + else + print ''; + } + if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) print ''; if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 1c82b1501d5..6ed8c2b8a4f 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -81,9 +81,13 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','inv } if (! empty($usemargins)) { + if (!empty($user->rights->margins->creer)) { ?> rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) @@ -362,7 +368,7 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da if (! empty($usemargins)) { - $colspan++; // For the buying price + if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 83d596dbd61..8b621b1886a 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -45,6 +45,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; $colspan = 3; // Col total ht + col edit + col delete if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +if (empty($user->rights->margins->creer)) $colspan++; ?> @@ -169,6 +170,7 @@ $coldisplay=-1; // We remove first td if (! empty($usemargins)) { ?> + rights->margins->creer)) { ?> + rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 7162ac66cb9..1b51aa8ac1c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -178,7 +178,10 @@ if (empty($usemargins)) $usemargins=0; { $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?> + + rights->margins->creer)) { ?> + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> Date: Thu, 15 Dec 2016 09:54:45 -0300 Subject: [PATCH 10/47] Replace attributes var for public Improve code style. --- htdocs/core/class/menubase.class.php | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index c8b9cc50f01..93037117cb8 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -28,30 +28,30 @@ */ class Menubase { - var $db; // To store db handler - var $error; // To return error code (or message) - var $errors=array(); // To return several error codes (or messages) + public $db; // To store db handler + public $error; // To return error code (or message) + public $errors=array(); // To return several error codes (or messages) - var $id; + public $id; - var $menu_handler; - var $module; - var $type; - var $mainmenu; - var $fk_menu; - var $fk_mainmenu; - var $fk_leftmenu; - var $position; - var $url; - var $target; - var $titre; - var $langs; - var $level; - var $leftmenu; // Date: Thu, 15 Dec 2016 10:31:46 -0300 Subject: [PATCH 11/47] Replace var to public Improve code style --- htdocs/core/modules/import/modules_import.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 11b81ecb820..20ce6ddc34d 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -30,26 +30,26 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; */ class ModeleImports { - var $db; - var $datatoimport; + public $db; + public $datatoimport; - var $error=''; + public $error=''; - var $id; // Id of driver - var $label; // Label of driver - var $extension; // Extension of files imported by driver - var $version; // Version of driver + public $id; // Id of driver + public $label; // Label of driver + public $extension; // Extension of files imported by driver + public $version; // Version of driver - var $label_lib; // Label of external lib used by driver - var $version_lib; // Version of external lib used by driver + public $label_lib; // Label of external lib used by driver + public $version_lib; // Version of external lib used by driver // Array of all drivers - var $_driverlabel=array(); - var $_driverdesc=array(); - var $_driverversion=array(); + public $_driverlabel=array(); + public $_driverdesc=array(); + public $_driverversion=array(); - var $_liblabel=array(); - var $_libversion=array(); + public $_liblabel=array(); + public $_libversion=array(); /** From 6766c331105a752a3acbe4b467847c88b81eb74f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 15 Dec 2016 15:02:45 +0100 Subject: [PATCH 12/47] Update info.php --- htdocs/commande/info.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index ddf30b290be..58b445c8ce7 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -58,9 +58,6 @@ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES $object->fetch_thirdparty(); $object->info($object->id); -$soc = new Societe($db); -$soc->fetch($object->thirdparty->id); - $head = commande_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); @@ -68,13 +65,12 @@ dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); $linkback = '' . $langs->trans("BackToList") . ''; - $morehtmlref='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { From 8b4aa701d79fea0a8b3bf298a5b55d9ebca3781b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 15 Dec 2016 15:04:59 +0100 Subject: [PATCH 13/47] Update note.php --- htdocs/commande/note.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 9a4b58a26c6..4d53d8e8d50 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -71,11 +71,10 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { - $soc = new Societe($db); - $soc->fetch($object->socid); - + $object->fetch_thirdparty(); + $head = commande_prepare_head($object); - + dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), 0, 'order'); // Order card @@ -88,7 +87,7 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { From d8e394d3aa0ccd63fe2c0e58b79810e5ead69760 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Dec 2016 17:09:15 +0100 Subject: [PATCH 14/47] FIX Missing field --- htdocs/core/modules/modProjet.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 5c6616b948b..f29f7785894 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -214,17 +214,16 @@ class modProjet extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.label'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); $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', - 'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'cls.code'=>"project",'p.opp_percent'=>'project','p.description'=>"project"); + 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); $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', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.label'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); From a321ab5f315d29b39767bfd6c191d983a2fbc654 Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Sat, 17 Dec 2016 03:27:32 -0300 Subject: [PATCH 15/47] var to public Update deprecated code style --- htdocs/categories/class/categorie.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 6880dbd0aa3..da0f1c73d12 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -49,8 +49,8 @@ class Categorie extends CommonObject const TYPE_MEMBER = 3; // TODO Replace this value with 'member' const TYPE_CONTACT = 4; // TODO Replace this value with 'contact' const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user' - const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' - const TYPE_PROJECT = 6; + const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' + const TYPE_PROJECT = 6; /** * @var array ID mapping from type string @@ -131,17 +131,17 @@ class Categorie extends CommonObject public $element='category'; public $table_element='categories'; - var $fk_parent; - var $label; - var $description; + public $fk_parent; + public $label; + public $description; /** * @var string Color */ - var $color; + public $color; /** * @var ??? */ - var $socid; + public $socid; /** * @var int Category type * @@ -154,10 +154,10 @@ class Categorie extends CommonObject * @see Categorie::TYPE_ACCOUNT * @see Categorie::TYPE_PROJECT */ - var $type; + public $type; - var $cats=array(); // Categories table in memory - var $motherof=array(); + public $cats = array(); // Categories table in memory + public $motherof = array(); /** * Constructor From 7728576f19591a1e65ade5cacf8b2a02780c575b Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Sat, 17 Dec 2016 03:49:28 -0300 Subject: [PATCH 16/47] var to public Improve code style --- htdocs/core/class/discount.class.php | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9a59801f720..2295a301e03 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -29,22 +29,22 @@ */ class DiscountAbsolute { - var $db; - var $error; + public $db; + public $error; - var $id; // Id discount - var $fk_soc; - var $amount_ht; // - var $amount_tva; // - var $amount_ttc; // - var $tva_tx; // Vat rate - var $fk_user; // Id utilisateur qui accorde la remise - var $description; // Description libre - var $datec; // Date creation - var $fk_facture_line; // Id invoice line when a discount linked to invoice line (for absolute discounts) - var $fk_facture; // Id invoice when a discoutn linked to invoice (for credit note) - var $fk_facture_source; // Id facture avoir a l'origine de la remise - var $ref_facture_source; // Ref facture avoir a l'origine de la remise + public $id; // Id discount + public $fk_soc; + public $amount_ht; // + public $amount_tva; // + public $amount_ttc; // + public $tva_tx; // Vat rate + public $fk_user; // Id utilisateur qui accorde la remise + public $description; // Description libre + public $datec; // Date creation + public $fk_facture_line; // Id invoice line when a discount linked to invoice line (for absolute discounts) + public $fk_facture; // Id invoice when a discoutn linked to invoice (for credit note) + public $fk_facture_source; // Id facture avoir a l'origine de la remise + public $ref_facture_source; // Ref facture avoir a l'origine de la remise /** * Constructor From 99c73cf11a362284f1123601481e82002fe2424a Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Sat, 17 Dec 2016 04:48:41 -0300 Subject: [PATCH 17/47] HTML 5 doctype Improve install header to use html 5 doctype --- htdocs/install/inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index b9b4f46d05e..2558c72feca 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -384,11 +384,11 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') // We force the content charset header("Content-type: text/html; charset=".$conf->file->character_set_client); - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; From c5db333af8b6b59cb4943647f64cc47d2618ce1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Dec 2016 14:00:39 +0100 Subject: [PATCH 18/47] Fix translation of error message when sending email --- htdocs/core/class/CMailFile.class.php | 31 ++++++++++++++++++++++++--- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index db9bf8e1ad0..bd803ca3851 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -366,7 +366,7 @@ class CMailFile */ function sendfile() { - global $conf,$db; + global $conf,$db,$langs; $errorlevel=error_reporting(); error_reporting($errorlevel ^ E_WARNING); // Desactive warnings @@ -388,7 +388,31 @@ class CMailFile return $reshook; } - + + // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; + $tmparray = explode(',', $this->addr_to); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + $tmparray = explode(',', $this->addr_cc); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in cc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + $tmparray = explode(',', $this->addr_bcc); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { @@ -449,7 +473,8 @@ class CMailFile { $this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems } - $this->error.=".
Check your server logs and your firewalls setup"; + $this->error.=".
"; + $this->error.=$langs->trans("ErrorPhpMailDelivery"); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); } else diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index dc3502e027a..5727c0edb11 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -180,6 +180,7 @@ ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. +ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 73e666323065f642e8b8aabc2f5b1c4379b9881b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Dec 2016 14:47:06 +0100 Subject: [PATCH 19/47] Fix help/messages for emailing to warn users. --- htdocs/comm/mailing/card.php | 21 ++++++++++++++------- htdocs/langs/en_US/mails.lang | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 016caddbabf..7a3e1ab8057 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -761,11 +761,12 @@ else $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - // Note: MAILING_LIMIT_SENDBYWEB is always defined to something != 0 + // MAILING_NO_USING_PHPMAIL may be defined or not + // MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not. if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. - // You ensure that every user is using its own SMTP server. + // You ensure that every user is using its own SMTP server when using the mass emailing module. $linktoadminemailbefore=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); @@ -775,10 +776,13 @@ else } else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - // No limit was defined, so the feature is forbidden from GUI, we show just a message. - setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + + // The feature is forbidden from GUI, we show just message to use from command line. + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); - if ($conf->file->mailing_limit_sendbyweb != '-1') + if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it. { setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... } @@ -786,8 +790,11 @@ else } else { - $text=''; - if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + + $text=''; + if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { $text.=$langs->trans("MailingNeedCommand"); $text.='
'; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index e748b634785..f682df02406 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -116,7 +116,7 @@ SearchAMailing=Search mailing SendMailing=Send emailing SendMail=Send email SentBy=Sent by -MailingNeedCommand=For security reason, sending an emailing must be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: +MailingNeedCommand=Sending an emailing can be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other. ConfirmSendingEmailing=If you want to send emailing directly from this screen, please confirm you are sure you want to send emailing now from your browser ? LimitSendingEmailing=Note: Sending of emailings from web interface is done in several times for security and timeout reasons, %s recipients at a time for each sending session. From 321933f2671fbc26c09160144fefa07ea35f1649 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 02:10:26 +0100 Subject: [PATCH 20/47] Fix deletion of product --- htdocs/product/class/product.class.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6b53fea0347..7ebe18358c6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -876,10 +876,26 @@ class Product extends CommonObject // End call triggers } - // Delete all child tables + // Delete from product_batch on product delete if (! $error) { - $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_batch'); + $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch'; + $sql.= " WHERE fk_product_stock IN ("; + $sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock'; + $sql.= " WHERE fk_product = ".$id.")"; + dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $result = $this->db->query($sql); + if (! $result) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + + // Delete all child tables + if (! $error) + { + $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); // product_batch done before foreach($elements as $table) { if (! $error) From 3e15ae3da73a585a10a83a452eee55a61950328e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 18 Dec 2016 10:33:20 +0100 Subject: [PATCH 21/47] Fix: wrong name --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 8c6f7687263..ddcc6e50d5e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1164,7 +1164,7 @@ else print '
'; // Mobile phone - print ''; + print ''; // Skype if (! empty($conf->skype->enabled)) From 58a0cb5838592406685ff9b1b48f0447baf331ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 10:47:24 +0100 Subject: [PATCH 22/47] Fix css style --- htdocs/core/lib/company.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 5d8377368ae..40257d63880 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1179,18 +1179,18 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=''; if ($donetodo) { - $out.=''; + $out.=''; } - $out.=''; - $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; + $out.=''; - $out.=''; - $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; // Action column $out.=''; // Address / Phone - print ''; // Email - print ''; + print ''; // Status print ''; + print ''; } // Edit diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 3a00ca2c060..3f8006c286b 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -59,12 +59,12 @@ $userstatic=new User($db); if ($permission) { ?> -
trans("Nature"); ?>
-
trans("ThirdParty"); ?>
-
trans("Users").'/'.$langs->trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
 
-
 
+
trans("Nature"); ?>
+
trans("ThirdParty"); ?>
+
trans("Users").'/'.$langs->trans("Contacts"); ?>
+
trans("ContactType"); ?>
+
 
+
 
-
trans("Nature"); ?>
-
trans("ThirdParty"); ?>
-
trans("Users").'/'.$langs->trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
trans("Status"); ?>
-
 
+
trans("Nature"); ?>
+
trans("ThirdParty"); ?>
+
trans("Users").'/'.$langs->trans("Contacts"); ?>
+
trans("ContactType"); ?>
+
trans("Status"); ?>
+
 
From be3a6afb2a406db1f643759f061a6f1da693c5e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 11:38:31 +0100 Subject: [PATCH 24/47] Better change for #6190 --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e07ef156124..b6a5d904c34 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1003,10 +1003,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->css)) $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default - if (empty($conf->global->MAIN_ACTIVATE_HTML5)) { + if (! empty($conf->global->MAIN_ACTIVATE_HTML4)) { $doctype = ''; }else { - $doctype = ''; // Html5 - Developement - Only available on Eldy template + $doctype = ''; } print $doctype."\n"; if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; From 0e7da2cd22b25bd59dea4e0a01ad26d9c7cee18a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 11:55:30 +0100 Subject: [PATCH 25/47] FIX Label of project is in field title not label. --- htdocs/core/modules/modProjet.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index f29f7785894..c21390c3ece 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -214,7 +214,7 @@ class modProjet extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.label'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); @@ -223,7 +223,7 @@ class modProjet extends DolibarrModules $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', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.label'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); From 54aa8696ad29d27d7c5445d2c0532b8db1578a7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 13:01:26 +0100 Subject: [PATCH 26/47] Fix regression --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d8a63c0a8ef..5e83f59ea36 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1307,7 +1307,7 @@ abstract class CommonObject $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; - $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->$fieldid)."'"; + $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity @@ -1328,7 +1328,7 @@ abstract class CommonObject $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; - $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->$fieldid)."'"; + $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity From e50bbb05fa797d76c96a8c91b52695e793507e6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 13:04:24 +0100 Subject: [PATCH 27/47] Fix security bugs --- htdocs/comm/mailing/card.php | 8 +-- htdocs/comm/remise.php | 8 +-- htdocs/don/class/paymentdonation.class.php | 59 ++++++++++++++++------ htdocs/don/payment/card.php | 47 +++++++++-------- 4 files changed, 77 insertions(+), 45 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 506a4523b7a..7c34498e6b4 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -681,9 +681,9 @@ if ($action == 'create') dol_fiche_head(); print '
'.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('MarginRate').' global->MARGIN_TYPE == "1") echo $langs->trans('BuyingPrice'); else @@ -256,6 +260,7 @@ else { } if (! empty($usemargins)) { + if (!empty($user->rights->margins->creer)) { ?> @@ -266,8 +271,9 @@ else { "> product->enabled) || ! empty($conf->service->enabled)) { ?> @@ -177,6 +179,7 @@ $coldisplay=-1; // We remove first td pa_ht); ?> pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>
'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">
'; + $out.=''; $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1); $out.=''; $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); From f762c98a373b07356d92cb7fcc89bc90504b8aec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 11:27:22 +0100 Subject: [PATCH 23/47] Fix html not balanced --- htdocs/contact/note.php | 12 +++++------- htdocs/core/lib/company.lib.php | 6 +++--- htdocs/core/tpl/contacts.tpl.php | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 6862ea0e4bf..b205603225b 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -85,9 +85,6 @@ if ($id > 0) print '
'; print '
'; - print ''; - print ''; - print ''; // Company @@ -144,12 +141,13 @@ if ($id > 0) print "
"; - //print '
'; + print '
'; - //print '
'; - - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + print '
'; + dol_fiche_end(); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 40257d63880..bbb6cdcbe0e 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -713,12 +713,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print '
'; + print ''; //print ''; print '  '; @@ -729,7 +729,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; - print '  
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; // Other attributes $parameters=array(); @@ -697,7 +697,7 @@ if ($action == 'create') print '

'; print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print ''; + print ''; print ''; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 4ea377a4487..82269434638 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -116,7 +116,7 @@ if ($socid > 0) print '
'; print '
'.$langs->trans("MailTopic").'
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print '
'; - // Remise + // Discount print '"; @@ -127,13 +127,13 @@ if ($socid > 0) print '
'; print $langs->trans("CustomerRelativeDiscount").''.price2num($object->remise_percent)."%
'; - // Nouvelle valeur + // New value print ''; + print $langs->trans("NewValue").''; // Motif/Note print ''; + print $langs->trans("NoteReason").''; print "
'; - print $langs->trans("NewValue").'%
%
'; - print $langs->trans("NoteReason").'
"; diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 9655f454ed5..9d478c4d7f5 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -24,33 +24,34 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -/** \class PaymentDonation - * \brief Class to manage payments of donations +/** + * Class to manage payments of donations */ class PaymentDonation extends CommonObject { public $element='payment_donation'; //!< Id that identify managed objects public $table_element='payment_donation'; //!< Name of table without prefix where object is stored + public $picto = 'payment'; + + public $rowid; - var $rowid; - - var $fk_donation; - var $datec=''; - var $tms=''; - var $datep=''; - var $amount; // Total amount of payment - var $amounts=array(); // Array of amounts - var $typepayment; - var $num_payment; - var $fk_bank; - var $fk_user_creat; - var $fk_user_modif; + public $fk_donation; + public $datec=''; + public $tms=''; + public $datep=''; + public $amount; // Total amount of payment + public $amounts=array(); // Array of amounts + public $typepayment; + public $num_payment; + public $fk_bank; + public $fk_user_creat; + public $fk_user_modif; /** * @deprecated * @see amount, amounts */ - var $total; + public $total; /** * Constructor @@ -432,6 +433,32 @@ class PaymentDonation extends CommonObject } + /** + * Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @return string Libelle + */ + function getLibStatut($mode=0) + { + return ''; + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Libelle du statut + */ + function LibStatut($statut,$mode=0) + { + global $langs; + + return ''; + } + + /** * Initialise an instance with random values. * Used to build previews or test instances. diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index fc0b4ae0c78..d3a9e7eb198 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -40,10 +40,10 @@ if ($user->societe_id) $socid=$user->societe_id; // TODO Add rule to restrict access payment //$result = restrictedArea($user, 'facture', $id,''); -$payment = new PaymentDonation($db); +$object = new PaymentDonation($db); if ($id > 0) { - $result=$payment->fetch($id); + $result=$object->fetch($id); if (! $result) dol_print_error($db,'Failed to get payment id '.$id); } @@ -57,7 +57,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp { $db->begin(); - $result = $payment->delete($user); + $result = $object->delete($user); if ($result > 0) { $db->commit(); @@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp } else { - setEventMessages($payment->error, $payment->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -76,7 +76,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree { $db->begin(); - $result=$payment->valide(); + $result=$object->valide(); if ($result > 0) { @@ -99,12 +99,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree } } - header('Location: card.php?id='.$payment->id); + header('Location: card.php?id='.$object->id); exit; } else { - setEventMessages($payment->error, $payment->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -133,7 +133,7 @@ dol_fiche_head($head, $hselected, $langs->trans("DonationPayment"), 0, 'payment' */ if ($action == 'delete') { - print $form->formconfirm('card.php?id='.$payment->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); + print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); } @@ -142,46 +142,51 @@ if ($action == 'delete') */ if ($action == 'valide') { - $facid = $_GET['facid']; - print $form->formconfirm('card.php?id='.$payment->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); + $facid = GETPOST('facid','int'); + print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); } +dol_banner_tab($object,'id','',1,'rowid','id'); + +print '
'; + print ''; // Ref -print ''; +/*print ''; +*/ // Date -print ''; +print ''; // Mode -print ''; +print ''; // Number -print ''; +print ''; // Amount -print ''; +print ''; // Note -print ''; +print ''; // Bank account if (! empty($conf->banque->enabled)) { - if ($payment->bank_account) + if ($object->bank_account) { $bankline=new AccountLine($db); - $bankline->fetch($payment->bank_line); + $bankline->fetch($object->bank_line); print ''; print ''; - print ''; print ''; @@ -269,7 +274,7 @@ print '
'; /* if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $payment->statut == 0 && $_GET['action'] == '') + if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '') { if ($user->rights->facture->paiement) { From ac44aa6d814eac53220f9351225d3fdf27c91fb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 13:21:09 +0100 Subject: [PATCH 28/47] FIX security bugs --- htdocs/accountancy/bookkeeping/balancebymonth.php | 4 +++- htdocs/accountancy/customer/index.php | 4 ++-- htdocs/accountancy/report/result.php | 4 +++- htdocs/accountancy/supplier/index.php | 4 ++-- htdocs/asterisk/wrapper.php | 8 ++++---- htdocs/categories/traduction.php | 2 +- htdocs/install/step4.php | 2 +- htdocs/loan/calc.php | 12 ++++++------ htdocs/loan/payment/card.php | 4 ++-- .../canvas/product/actions_card_product.class.php | 5 ++--- .../canvas/service/actions_card_service.class.php | 4 ++-- htdocs/product/traduction.php | 2 +- 12 files changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index 9202371e5a5..83908f72172 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -38,7 +38,7 @@ $langs->load("other"); $langs->load("accountancy"); // Filter -$year = $_GET["year"]; +$year = GETPOST("year",'int'); if ($year == 0) { $year_current = strftime("%Y", time()); $year_start = $year_current; @@ -47,9 +47,11 @@ if ($year == 0) { $year_start = $year; } + /* * View */ + llxHeader('', $langs->trans("Bookkeeping")); $textprevyear = '' . img_previous() . ''; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index fea8281935f..ef5c512179a 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -47,7 +47,7 @@ if (! $user->rights->accounting->bind->write) accessforbidden(); // Filter -$year = $_GET["year"]; +$year = GETPOST("year",'int'); if ($year == 0) { $year_current = strftime("%Y", time()); $year_start = $year_current; @@ -57,7 +57,7 @@ if ($year == 0) { } // Validate History -$action = GETPOST('action'); +$action = GETPOST('action','alpha'); diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index e31e1c92f17..317b7193ff3 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -43,7 +43,7 @@ $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel'); // Filter -$year = $_GET["year"]; +$year = GETPOST('year','int'); if ($year == 0) { $year_current = strftime("%Y", time()); $year_start = $year_current; @@ -64,9 +64,11 @@ if (! $user->rights->accounting->comptarapport->lire) $AccCat = new AccountancyCategory($db); + /* * View */ + llxheader('', $langs->trans('ReportInOut')); $formaccounting = new FormAccounting($db); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 82c7cebe087..ef7d470bb07 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -45,7 +45,7 @@ if (! $user->rights->accounting->bind->write) accessforbidden(); // Filter -$year = $_GET["year"]; +$year = GETPOST("year",'int'); if ($year == 0) { $year_current = strftime("%Y", time()); $year_start = $year_current; @@ -55,7 +55,7 @@ if ($year == 0) { } // Validate History -$action = GETPOST('action'); +$action = GETPOST('action', 'alpha'); /* diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index e5c9a6b2093..381750546ce 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -85,10 +85,10 @@ if (! isset($conf->global->ASTERISK_PRIORITY)) $conf->global->ASTERISK_PRIORITY if (! isset($conf->global->ASTERISK_MAX_RETRY)) $conf->global->ASTERISK_MAX_RETRY="2"; -$login = $_GET['login']; -$password = $_GET['password']; -$caller = $_GET['caller']; -$called = $_GET['called']; +$login = GETPOST('login'); +$password = GETPOST('password'); +$caller = GETPOST('caller'); +$called = GETPOST('called'); // IP address of Asterisk server $strHost = $conf->global->ASTERISK_HOST; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 00741f81390..1967727b32f 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -277,7 +277,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print '
'; print ''; print ''; - print ''; + print ''; print '
'.$langs->trans('Ref').'
'; -print $form->showrefnav($payment,'id','',1,'rowid','id'); +print $form->showrefnav($object,'id','',1,'rowid','id'); print '
'.$langs->trans('Date').''.dol_print_date($payment->datep,'day').'
'.$langs->trans('Date').''.dol_print_date($object->datep,'day').'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$payment->type_code).'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Number').''.$payment->num_payment.'
'.$langs->trans('Number').''.$object->num_payment.'
'.$langs->trans('Amount').''.price($payment->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($payment->note).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('BankTransactionLine').''; + print ''; print $bankline->getNomUrl(1,0,'showall'); print '
'; print ''; + print ''; print ''; print ''; // Graphs if ($mode == 'standard') { - $prevyear=$year;$nextyear=$year; + $prevyear=$year; $nextyear=$year; $prevmonth=$month-1;$nextmonth=$month+1; if ($prevmonth < 1) { $prevmonth=12; $prevyear--; } if ($nextmonth > 12) { $nextmonth=1; $nextyear++; } diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index db9d4e623ca..6a3052a938d 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -97,35 +97,36 @@ $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (dol_strlen($stcomm)) { - $sql.= " AND s.fk_stcomm=$stcomm"; + $sql.= " AND s.fk_stcomm=".$stcomm; } if ($socname) { - $sql.= " AND s.nom LIKE '%".$db->escape($socname)."%'"; + $sql.= natural_search("s.nom", $socname); $sortfield = "s.nom"; $sortorder = "ASC"; } if ($_GET["search_nom"]) { - $sql.= " AND s.nom LIKE '%".$db->escape($_GET["search_nom"])."%'"; + $sql.= natural_search("s.nom", GETPOST("search_nom")); } if ($_GET["search_compta"]) { - $sql.= " AND s.code_compta LIKE '%".$db->escape($_GET["search_compta"])."%'"; + $sql.= natural_search("s.code_compta", GETPOST("search_compta")); } if ($_GET["search_code_client"]) { - $sql.= " AND s.code_client LIKE '%".$db->escape($_GET["search_code_client"])."%'"; + $sql.= natural_search("s.code_client", GETPOST("search_code_client")); } if (dol_strlen($begin)) { - $sql.= " AND s.nom LIKE '".$db->escape($begin)."'"; + $sql.= natural_search("s.nom", $begin); } if ($socid) { $sql.= " AND s.rowid = ".$socid; } -$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= " ORDER BY $sortfield $sortorder "; +$sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; $resql = $db->query($sql); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 8fbc028a589..1772b6861dd 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -66,12 +66,12 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); $datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); - $localtax->accountid=$_POST["accountid"]; - $localtax->paymenttype=$_POST["paiementtype"]; + $localtax->accountid=GETPOST("accountid"); + $localtax->paymenttype=GETPOST("paiementtype"); $localtax->datev=$datev; $localtax->datep=$datep; - $localtax->amount=$_POST["amount"]; - $localtax->label=$_POST["label"]; + $localtax->amount=price2num(GETPOST("amount")); + $localtax->label=GETPOST("label"); $localtax->ltt=$lttype; $ret=$localtax->addPayment($user); @@ -178,10 +178,10 @@ if ($action == 'create') print ''; // Label - print ''; + print ''; // Amount - print ''; + print ''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 82749f4949f..9980ea396de 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -251,9 +251,9 @@ if (empty($reshook)) $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Array with all payments dispatching $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching - $paiement->paiementid = dol_getIdFromCode($db,$_POST['paiementcode'],'c_paiement'); - $paiement->num_paiement = $_POST['num_paiement']; - $paiement->note = $_POST['comment']; + $paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement'); + $paiement->num_paiement = GETPOST('num_paiement'); + $paiement->note = GETPOST('comment'); if (! $error) { @@ -513,7 +513,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Comments print ''; print ''; + print ''; print '
'.$langs->trans('Translation').''; diff --git a/htdocs/install/step4.php b/htdocs/install/step4.php index ce16596bdbf..740a45a9063 100644 --- a/htdocs/install/step4.php +++ b/htdocs/install/step4.php @@ -79,7 +79,7 @@ $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db- if ($db->ok) { print '
'.$langs->trans("DolibarrAdminLogin").' :'; - print '
'.$langs->trans("Password").' :'; print '
'.$langs->trans("PasswordAgain").' :'; diff --git a/htdocs/loan/calc.php b/htdocs/loan/calc.php index b6e649962fa..76b4c989aa7 100644 --- a/htdocs/loan/calc.php +++ b/htdocs/loan/calc.php @@ -49,12 +49,12 @@ $error = false; * Set the USER INPUT values * --------------------------------------------------- */ if (isset($_REQUEST['form_complete'])) { - $sale_price = $_REQUEST['sale_price']; - $annual_interest_percent = $_REQUEST['annual_interest_percent']; - $year_term = $_REQUEST['year_term']; - $down_percent = $_REQUEST['down_percent']; - $show_progress = (isset($_REQUEST['show_progress'])) ? $_REQUEST['show_progress'] : false; - $form_complete = $_REQUEST['form_complete']; + $sale_price = GETPOST('sale_price'); + $annual_interest_percent = GETPOST('annual_interest_percent'); + $year_term = GETPOST('year_term'); + $down_percent = GETPOST('down_percent'); + $show_progress = (isset($_REQUEST['show_progress'])) ? GETPOST('show_progress') : false; + $form_complete = GETPOST('form_complete'); } // This function does the actual mortgage calculations diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 41f332e5dd0..c76b0565a3f 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -32,7 +32,7 @@ $langs->load('companies'); $langs->load('loan'); // Security check -$id=GETPOST("id"); +$id=GETPOST("id",'int'); $action=GETPOST("action"); $confirm=GETPOST('confirm'); if ($user->societe_id) $socid=$user->societe_id; @@ -120,7 +120,7 @@ $form = new Form($db); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/loan/payment/card.php?id='.$_GET["id"]; +$head[$h][0] = DOL_URL_ROOT.'/loan/payment/card.php?id='.$id; $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index e32d31122dc..06803e8239d 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -325,16 +325,15 @@ class ActionsCardProduct $this->list_datas = array(); - //$_GET["sall"] = 'LL'; // Clean parameters - $sall=trim(isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]); + $sall=trim(GETPOST("sall")); foreach($this->field_list as $field) { if ($field['enabled']) { $fieldname = "s".$field['alias']; - $$fieldname = trim(isset($_GET[$fieldname])?$_GET[$fieldname]:$_POST[$fieldname]); + $$fieldname = trim(GETPOST($fieldname)); } } diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 7bc04ecb42a..af6fbccc320 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -308,9 +308,9 @@ class ActionsCardService $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; - if ($_GET["fourn_id"] > 0) + if (GETPOST("fourn_id",'int') > 0) { - $fourn_id = $_GET["fourn_id"]; + $fourn_id = GETPOST("fourn_id",'int'); $sql.= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; } $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 1f6ae678a81..f616004db42 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -305,7 +305,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; // Tags-Categories if ($conf->categorie->enabled) @@ -836,11 +836,11 @@ else // Ref print ''; - print ''; + print ''; // Label print ''; - print ''; + print ''; // Type print ''; @@ -902,14 +902,14 @@ else // Balance print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Web print ''; - print ''; // Tags-Categories @@ -970,7 +970,7 @@ else if (! empty($conf->accounting->enabled)) { print ''; - print ''; + print ''; } print '
'.$langs->trans('Language').''; From fc401a9c68a36c4e79720e679b44c19dea32a1f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 13:27:14 +0100 Subject: [PATCH 29/47] Fix more security fixes --- htdocs/accountancy/expensereport/index.php | 2 +- htdocs/compta/bank/bankentries.php | 2 +- htdocs/compta/bank/card.php | 30 ++++---- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/bank/graph.php | 14 ++-- htdocs/compta/clients.php | 15 ++-- htdocs/compta/localtax/card.php | 12 ++-- htdocs/compta/paiement.php | 14 ++-- htdocs/compta/paiement/rapport.php | 2 +- htdocs/compta/payment_sc/card.php | 6 +- htdocs/compta/salaries/card.php | 4 +- htdocs/compta/stats/index.php | 2 +- htdocs/compta/tva/card.php | 4 +- htdocs/compta/tva/quadri.php | 2 +- htdocs/contact/card.php | 79 +++++++++++----------- htdocs/theme/eldy/style.css.php | 6 +- 16 files changed, 100 insertions(+), 96 deletions(-) diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 7ead3a9940e..fea9cff6020 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -45,7 +45,7 @@ if (! $user->rights->accounting->bind->write) accessforbidden(); // Filter -$year = $_GET["year"]; +$year = GETPOST('year', 'int'); if ($year == 0) { $year_current = strftime("%Y", time()); $year_start = $year_current; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index ce70e7ac938..47405d0e748 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -576,7 +576,7 @@ if ($resql) print ''; print ''; print ''; - if (! empty($_REQUEST['bid'])) print ''; + if (GETPOST('bid')) print ''; // Form to reconcile if ($user->rights->banque->consolidate && $action == 'reconcile') diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index d2b3c167872..baf2f3e26b1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -50,7 +50,7 @@ $cancel = GETPOST('cancel', 'alpha'); // Security check if (isset($_GET["id"]) || isset($_GET["ref"])) { - $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:''); + $id = isset($_GET["id"])?GETPOST("id"):(isset($_GET["ref"])?GETPOST("ref"):''); } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; @@ -93,7 +93,7 @@ if ($action == 'add') $object->iban = trim($_POST["iban"]); $object->domiciliation = trim($_POST["domiciliation"]); - $object->proprio = trim($_POST["proprio"]); + $object->proprio = trim($_POST["proprio"]); $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number','alpha'); @@ -105,12 +105,12 @@ if ($action == 'add') $object->currency_code = trim($_POST["account_currency_code"]); - $object->state_id = $_POST["account_state_id"]; + $object->state_id = $_POST["account_state_id"]; $object->country_id = $_POST["account_country_id"]; $object->min_allowed = GETPOST("account_min_allowed",'int'); $object->min_desired = GETPOST("account_min_desired",'int'); - $object->comment = trim($_POST["account_comment"]); + $object->comment = trim(GETPOST("account_comment")); $object->fk_user_author = $user->id; @@ -172,7 +172,7 @@ if ($action == 'update') // Update account $object = new Account($db); - $object->fetch($_POST["id"]); + $object->fetch(GETPOST("id")); $object->ref = dol_string_nospecial(trim($_POST["ref"])); $object->label = trim($_POST["label"]); @@ -190,7 +190,7 @@ if ($action == 'update') $object->iban = trim($_POST["iban"]); $object->domiciliation = trim($_POST["domiciliation"]); - $object->proprio = trim($_POST["proprio"]); + $object->proprio = trim($_POST["proprio"]); $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number', 'int'); @@ -204,7 +204,7 @@ if ($action == 'update') $object->min_allowed = GETPOST("account_min_allowed",'int'); $object->min_desired = GETPOST("account_min_desired",'int'); - $object->comment = trim($_POST["account_comment"]); + $object->comment = trim(GETPOST("account_comment")); if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { @@ -251,7 +251,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user- { // Delete $object = new Account($db); - $object->fetch($_GET["id"]); + $object->fetch(GETPOST("id","int")); $object->delete(); header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); @@ -367,7 +367,7 @@ if ($action == 'create') // Web print '
'.$langs->trans("Web").'
'.$langs->trans("Ref").'ref).'">
ref).'">
'.$langs->trans("Label").'label).'">
label).'">
'.$langs->trans("AccountType").'
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
min_desired).'">
'.$langs->trans("Web").'url).'">'; + print 'url).'">'; print '
'.$langs->trans("AccountancyJournal").'accountancy_journal).'">
accountancy_journal).'">
'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 139f578c5d6..73dd2d4f199 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -833,7 +833,7 @@ class Account extends CommonObject * @param string $ref Ref of bank account to get * @return int <0 if KO, >0 if OK */ - function fetch($id,$ref='') + function fetch($id, $ref='') { global $conf; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index bf69fe98a3b..31a4087815c 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -43,9 +43,9 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); -$account=$_GET["account"]; +$account=GETPOST("account"); $mode='standard'; -if (isset($_GET["mode"]) && $_GET["mode"] == 'showalltime') $mode='showalltime'; +if (GETPOST("mode") == 'showalltime') $mode='showalltime'; $error=0; @@ -63,18 +63,18 @@ $datetime = dol_now(); $year = dol_print_date($datetime, "%Y"); $month = dol_print_date($datetime, "%m"); $day = dol_print_date($datetime, "%d"); -if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]); -if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]); +if (GETPOST("year")) $year=sprintf("%04d",GETPOST("year")); +if (GETPOST("month")) $month=sprintf("%02d",GETPOST("month")); $object = new Account($db); if ($_GET["account"] && ! preg_match('/,/',$_GET["account"])) // if for a particular account and not a list { - $result=$object->fetch($_GET["account"]); + $result=$object->fetch(GETPOST("account", "int")); } if ($_GET["ref"]) { - $result=$object->fetch(0,$_GET["ref"]); + $result=$object->fetch(0, GETPOST("ref")); $account=$object->id; } @@ -823,7 +823,7 @@ print '

'.$langs->trans("Label").'transcountry(($lttype==2?"LT2Payment":"LT1Payment"),$mysoc->country_code)).'">
'.$langs->trans("Label").'transcountry(($lttype==2?"LT2Payment":"LT1Payment"),$mysoc->country_code)).'">
'.$langs->trans("Amount").'
'.$langs->trans("Amount").'
'.$langs->trans('Comments').''; - print '
'; @@ -683,12 +683,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->use_javascript_ajax)) print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; - print ''; + print ''; } else { - print ''; - print ''; + print ''; + print ''; } print ""; diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 8f23036f6af..b8bcf030729 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -43,7 +43,7 @@ if ($user->societe_id > 0) $dir = $conf->facture->dir_output.'/payments'; if (! $user->rights->societe->client->voir || $socid) $dir.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user -$year = $_GET["year"]; +$year = GETPOST('year', 'int'); if (! $year) { $year=date("Y"); } diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 0ea48d9075c..b64d92d873f 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -37,7 +37,7 @@ $langs->load('banks'); $langs->load('companies'); // Security check -$id=GETPOST("id"); +$id=GETPOST("id",'int'); $action=GETPOST("action"); $confirm=GETPOST('confirm'); if ($user->societe_id) $socid=$user->societe_id; @@ -126,12 +126,12 @@ $form = new Form($db); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$_GET["id"]; +$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$id; $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; -/*$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$_GET["id"]; +/*$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$id; $head[$h][1] = $langs->trans("Info"); $h++; */ diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index a7921e53859..df83f5b9958 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -257,7 +257,7 @@ if ($action == 'create') // Label print ''; print fieldLabel('Label','label',1).''; - print 'trans("SalaryPayment")).'">'; + print 'trans("SalaryPayment")).'">'; print ''; // Date start period @@ -275,7 +275,7 @@ if ($action == 'create') // Amount print ''; print fieldLabel('Amount','amount',1).''; - print ''; + print ''; print ''; // Bank diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index a32a67bb9fe..8d1aceeaa77 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -39,7 +39,7 @@ $userid=GETPOST('userid','int'); $socid = GETPOST('socid','int'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') $modecompta = $conf->global->ACCOUNTING_MODE; -if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; +if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha'); // Security check if ($user->societe_id > 0) $socid = $user->societe_id; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 99bb676a321..cb80f49e790 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -258,10 +258,10 @@ if ($action == 'create') } else { $label = $langs->trans("VATPayment"); } - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; // Amount - print ''.$langs->trans("Amount").''; + print ''.$langs->trans("Amount").''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 0e4a66146aa..73cc0bc96ba 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -$year=$_GET["year"]; +$year = GETPOST('year', 'int'); if ($year == 0 ) { $year_current = strftime("%Y",time()); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e7896d9b9ac..2cbcb94c5d4 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -477,10 +477,10 @@ else */ $object->canvas=$canvas; - $object->state_id = $_POST["state_id"]; + $object->state_id = GETPOST("state_id"); // We set country_id, country_code and label for the selected country - $object->country_id=$_POST["country_id"]?$_POST["country_id"]:(empty($objsoc->country_id)?$mysoc->country_id:$objsoc->country_id); + $object->country_id=$_POST["country_id"]?GETPOST("country_id"):(empty($objsoc->country_id)?$mysoc->country_id:$objsoc->country_id); if ($object->country_id) { $tmparray=getCountry($object->country_id,'all'); @@ -530,9 +530,9 @@ else // Name print ''; - print 'lastname).'" autofocus="autofocus">'; + print 'lastname).'" autofocus="autofocus">'; print ''; - print 'firstname).'">'; + print 'firstname).'">'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -559,7 +559,7 @@ else print ''; print ''; - print 'poste).'">'; + print 'poste).'">'; $colspan=3; if ($conf->use_javascript_ajax && $socid > 0) $colspan=2; @@ -612,20 +612,20 @@ else // Phone / Fax if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party print ''; - print 'phone_pro).'">'; + print 'phone_pro).'">'; print ''; - print 'phone_perso).'">'; + print 'phone_perso).'">'; if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party print ''; - print 'phone_mobile).'">'; + print 'phone_mobile).'">'; print ''; - print 'fax).'">'; + print 'fax).'">'; // EMail if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party print ''; - print 'email).'">'; + print 'email).'">'; if (! empty($conf->mailing->enabled)) { print ''; @@ -639,13 +639,13 @@ else // Instant message and no email print ''; - print 'jabberid).'">'; + print 'jabberid).'">'; // Skype if (! empty($conf->skype->enabled)) { print ''; - print 'skype).'">'; + print 'skype).'">'; } // Visibility @@ -784,9 +784,13 @@ else // Lastname print ''; - print 'lastname).'" autofocus="autofocus">'; + print 'lastname).'" autofocus="autofocus">'; + print ''; + print ''; + // Firstname print ''; - print 'firstname).'">'; + print 'firstname).'">'; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -800,57 +804,56 @@ else // Civility print ''; - print $formcompany->select_civility(isset($_POST["civility_id"])?$_POST["civility_id"]:$object->civility_id); + print $formcompany->select_civility(isset($_POST["civility_id"])?GETPOST("civility_id"):$object->civility_id); print ''; print ''; - print 'poste).'">'; + print 'poste).'">'; // Address print ''; - print ''; - - $rowspan=3; - if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; - - print ''; - if ($conf->use_javascript_ajax) print ''.$langs->trans('CopyAddressFromSoc').''; - print ''; + print ''; + print '
'; + print ''; + print '
'; + if ($conf->use_javascript_ajax) print ''.$langs->trans('CopyAddressFromSoc').'
'; + print '
'; + print ''; // Zip / Town - print ' / '; - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); + print ' / '; + print $formcompany->select_ziptown((isset($_POST["zipcode"])?GETPOST("zipcode"):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; + print $formcompany->select_ziptown((isset($_POST["town"])?GETPOST("town"):$object->town),'town',array('zipcode','selectcountry_id','state_id')); print ''; // Country - print ''; - print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); + print ''; + print $form->select_country(isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; - print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'state_id'); + print ''; + print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id,'state_id'); print ''; } // Phone print ''; - print 'phone_pro).'">'; + print 'phone_pro).'">'; print ''; - print 'phone_perso).'">'; + print 'phone_perso).'">'; print ''; - print 'phone_mobile).'">'; + print 'phone_mobile).'">'; print ''; - print 'fax).'">'; + print 'fax).'">'; // EMail print ''; - print 'email).'">'; + print 'email).'">'; if (! empty($conf->mailing->enabled)) { $langs->load("mails"); @@ -865,7 +868,7 @@ else // Jabberid print ''; - print 'jabberid).'">'; + print 'jabberid).'">'; if (! empty($conf->mailing->enabled)) { print ''; @@ -881,7 +884,7 @@ else if (! empty($conf->skype->enabled)) { print ''; - print 'skype).'">'; + print 'skype).'">'; } // Visibility diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 73015308521..c5d9dd13189 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -867,12 +867,12 @@ div.fichecenterbis { div.fichethirdleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> browser->layout != 'phone') { print "width: 50%;\n"; } ?> - browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> + browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> } div.fichetwothirdright { browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> browser->layout != 'phone') { print "width: 50%;\n"; } ?> - browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> + browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> } div.fichehalfleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> @@ -4451,7 +4451,7 @@ border-top-right-radius: 6px; color: #fff; text-decoration: none; padding-top: 18px; - padding-left: 54px; + : 54px; font-size: 14px; height: 38px; } From dbf96b8f5977fa44b2f268d0827fa8383fb7a96e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 23:32:31 +0100 Subject: [PATCH 30/47] Log at wrong place --- htdocs/core/class/CMailFile.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index bd803ca3851..ba4eb1ad017 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -441,8 +441,6 @@ class CMailFile } else { - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG); - $bounce = ''; // By default if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { @@ -455,7 +453,8 @@ class CMailFile { $bounce .= ($bounce?' ':'').'-ba'; } - + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); + $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); From 74e00c4d803a4da3e21c345445aac3b95db19243 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 01:04:17 +0100 Subject: [PATCH 31/47] More comment and hidden option to solve problems when sending emails. --- htdocs/core/class/CMailFile.class.php | 7 +++++-- htdocs/core/class/smtps.class.php | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ba4eb1ad017..a7c9b0a0e56 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -143,6 +143,8 @@ class CMailFile $this->msgishtml = $msgishtml; } + if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html. + // Detect images if ($this->msgishtml) { @@ -822,8 +824,9 @@ class CMailFile $strContent = preg_replace("/\r\n/si", "\n", $strContent); } - //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged - $strContent = rtrim(wordwrap($strContent)); + // Make RFC2045 Compliant, split lines + //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content + $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 6731b46fe0f..91efd218de1 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1188,7 +1188,9 @@ class SMTPs // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?_msgContent[$strType] = array(); From 876722733aa721d03d9ce369cbdaaa67cf046e77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 02:33:54 +0100 Subject: [PATCH 32/47] Better fix to get localtax --- htdocs/core/lib/functions.lib.php | 17 +++++++---------- htdocs/product/price.php | 11 +++++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8c810b76b97..bd184469e49 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3330,7 +3330,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party - * @param Societe $thirdparty_seller Object of selling third party + * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not * @return mixed 0 if not found, localtax rate if found * @see get_default_tva @@ -3389,18 +3389,15 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; } - //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); - // Do not enabled this. We want localtax that match the vat rate. - // If we forced a vat, we must also force local tax - /* - if (is_object($thirdparty_buyer)) + // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on. + if (in_array($mysoc->country_code, array('ES'))) { - if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; - }*/ - + $conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1; + } + // Search local taxes - if ($mysoc->country_code == 'ES' || ! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) + if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) { if ($local==1) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3be258f4243..625b6c29631 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -246,10 +246,17 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); $npr = $obj->recuperableonly; - $localtax1 = get_localtax($tva_tx,1); - $localtax2 = get_localtax($tva_tx,2); + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; $localtax1_type = $obj->localtax1_type; $localtax2_type = $obj->localtax2_type; + + // If spain, we don't use the localtax found into tax record in database with same code, but using the get_localtax rule + if (in_array($mysoc->country_code, array('ES'))) + { + $localtax1 = get_localtax($tva_tx,1); + $localtax2 = get_localtax($tva_tx,2); + } } } $pricestoupdate[0] = array( From 1fdbcf4c0f8a0a0f3fb9969d3a480513284f1178 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 16:22:41 +0100 Subject: [PATCH 33/47] Fix missing page to match new reorg of agenda events (done for thirdparty but not complete for contact) --- htdocs/contact/agenda.php | 285 ++++++++++++++++++++++++++++++++ htdocs/contact/card.php | 4 +- htdocs/core/lib/company.lib.php | 9 +- htdocs/core/lib/contact.lib.php | 16 +- htdocs/societe/agenda.php | 20 ++- 5 files changed, 325 insertions(+), 9 deletions(-) create mode 100644 htdocs/contact/agenda.php diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php new file mode 100644 index 00000000000..f87854fbab6 --- /dev/null +++ b/htdocs/contact/agenda.php @@ -0,0 +1,285 @@ + + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * + * 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/contact/card.php + * \ingroup societe + * \brief Card of a contact + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +$langs->load("companies"); +$langs->load("users"); +$langs->load("other"); +$langs->load("commercial"); + +$mesg=''; $error=0; $errors=array(); + +$action = (GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view'); +$confirm = GETPOST('confirm','alpha'); +$backtopage = GETPOST('backtopage','alpha'); +$id = GETPOST('id','int'); +$socid = GETPOST('socid','int'); + +$object = new Contact($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$object->getCanvas($id); +$objcanvas=null; +$canvas = (! empty($object->canvas)?$object->canvas:GETPOST("canvas")); +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db, $action); + $objcanvas->getCanvas('contact', 'contactcard', $canvas); +} + +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); +} +$search_agenda_label=GETPOST('search_agenda_label'); + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission + +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='a.datep, a.id'; +if (! $sortorder) $sortorder='DESC'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('contactcard','globalcard')); + + +/* + * Actions + */ + +$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Cancel + if (GETPOST("cancel") && ! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + { + $actioncode=''; + $search_agenda_label=''; + } +} + + +/* + * View + */ + + +$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname; +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +$form = new Form($db); +$formcompany = new FormCompany($db); + +$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; + +if ($socid > 0) +{ + $objsoc = new Societe($db); + $objsoc->fetch($socid); +} + +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) +{ + // ----------------------------------------- + // When used with CANVAS + // ----------------------------------------- + if (empty($object->error) && $id) + { + $object = new Contact($db); + $result=$object->fetch($id); + if ($result <= 0) dol_print_error('',$object->error); + } + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template +} +else +{ + // ----------------------------------------- + // When used in standard mode + // ----------------------------------------- + + // Confirm deleting contact + if ($user->rights->societe->contact->supprimer) + { + if ($action == 'delete') + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage?'&backtopage='.$backtopage:''),$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); + } + } + + /* + * Onglets + */ + $head=array(); + if ($id > 0) + { + // Si edition contact deja existant + $object = new Contact($db); + $res=$object->fetch($id, $user); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($object->id,$extralabels); + + // Show tabs + $head = contact_prepare_head($object); + + $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); + } + + if (! empty($id) && $action != 'edit' && $action != 'create') + { + $objsoc = new Societe($db); + + /* + * Fiche en mode visualisation + */ + + dol_htmloutput_errors($error,$errors); + + dol_fiche_head($head, 'agenda', $title, 0, 'contact'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + + print '
'; + + print '
'; + + $object->info($id); + print dol_print_object_info($object, 1); + + print '
'; + + print dol_fiche_end(); + + + // Actions buttons + + $objcon=$object; + $object->fetch_thirdparty(); + $objthirdparty=$object->thirdparty; + + $out=''; + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; + } + + + print '
'; + + if (! empty($conf->agenda->enabled)) + { + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } + + print '
'; + + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + $param='&id='.$id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + + print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'',''); + + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + + show_actions_done($conf,$langs,$db,$objthirdparty,$object,0,$actioncode, '', $filters, $sortfield, $sortorder); + } + } +} + + +llxFooter(); + +$db->close(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 2cbcb94c5d4..15b8a5e4462 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1236,8 +1236,9 @@ else } print "
"; - print "
"; + //print "
"; + /* if (! empty($conf->agenda->enabled)) { $objthirdparty=$objsoc; @@ -1261,6 +1262,7 @@ else print show_actions_done($conf,$langs,$db,$objsoc,$object,0,'',''); } + */ } } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index bbb6cdcbe0e..ff6459413a4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1148,7 +1148,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $facturestatic=new Facture($db); $out.=''; - $out.=''; + if ($objcon && get_class($objcon) == 'Contact' && get_class($filterobj) == 'Societe') + { + $out.=''; + } + else + { + $out.=''; + } if (get_class($filterobj) == 'Societe') $out.=''; $out.="\n"; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 2cbf7b23bc2..c507e2e66ee 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -84,11 +84,23 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'documents'; $tab++; - // Info + // Agenda / Events + $head[$tab][0] = DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id; + $head[$tab][1].= $langs->trans("Events"); + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + $head[$tab][1].= '/'; + $head[$tab][1].= $langs->trans("Agenda"); + } + $head[$tab][2] = 'agenda'; + $tab++; + + // Log + /* $head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id; $head[$tab][1] = $langs->trans("Info"); $head[$tab][2] = 'info'; - $tab++; + $tab++;*/ complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact','remove'); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index f4c8f5c6dbc..25eb78cfe24 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -73,11 +73,21 @@ $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -// Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (empty($reshook)) { - $actioncode=''; - $search_agenda_label=''; + // Cancel + if (GETPOST("cancel") && ! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + { + $actioncode=''; + $search_agenda_label=''; + } } @@ -90,7 +100,7 @@ $contactstatic = new Contact($db); $form = new Form($db); -if ($socid) +if ($socid > 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; From 8fb9a55d8adb721336b8a291eba0e58bdb5115ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 16:35:40 +0100 Subject: [PATCH 34/47] Complete work on dol_banner --- htdocs/contact/agenda.php | 14 +++++++++++++- htdocs/contact/card.php | 31 ++++++++++++------------------- htdocs/contact/document.php | 17 +++++++++++++++-- htdocs/contact/note.php | 15 ++++++++++++++- htdocs/contact/perso.php | 18 ++++++++++++++++-- 5 files changed, 70 insertions(+), 25 deletions(-) diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index f87854fbab6..3882d2ebca3 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -212,7 +212,19 @@ else $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 15b8a5e4462..e6429fdc6d7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1049,7 +1049,18 @@ else $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; @@ -1058,24 +1069,6 @@ else print '
'; print ''; - // Company - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - print ''; - } - - print ''; - // Civility print '
'.$langs->trans("ThirdParty").''; - if ($object->socid > 0) - { - $objsoc->fetch($object->socid); - print $objsoc->getNomUrl(1); - } - else - { - print $langs->trans("ContactNotLinkedToCompany"); - } - print '
'.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 825c1e8dab5..8d003e14cf5 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -109,7 +109,19 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; @@ -117,6 +129,7 @@ if ($object->id) print ''; // Company + /* if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { if ($object->socid > 0) @@ -133,7 +146,7 @@ if ($object->id) print $langs->trans("ContactNotLinkedToCompany"); print ''; } - } + }*/ // Civility print '
'.$langs->trans("UserTitle").''; diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index b205603225b..eed044cdadf 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -76,7 +76,20 @@ if ($id > 0) dol_fiche_head($head, 'note', $title,0,'contact'); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); $cssclass='titlefield'; //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 03e62523922..bc4443dd8bf 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -233,7 +233,20 @@ else $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; @@ -242,6 +255,7 @@ else print ''; // Company + /* if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { if ($object->socid > 0) @@ -258,7 +272,7 @@ else print $langs->trans("ContactNotLinkedToCompany"); print ''; } - } + }*/ // Civility print '\n"; @@ -510,7 +520,7 @@ class FormMail extends Form if (! empty($this->withto) && is_array($this->withto)) { if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." "; - $out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1); + $out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } if (isset($this->withtosocid) && $this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { @@ -522,7 +532,7 @@ class FormMail extends Form $liste[$key]=$value; } if ($this->withtofree) $out.= " ".$langs->trans("or")." "; - $out.= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1); + $out.= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } } $out.= "\n"; @@ -544,7 +554,7 @@ class FormMail extends Form if (! empty($this->withtocc) && is_array($this->withtocc)) { $out.= " ".$langs->trans("or")." "; - $out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1); + $out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } } $out.= "\n"; From 4d624fd875773e18204817b1676aac1bf6b083a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Dec 2016 11:23:44 +0100 Subject: [PATCH 36/47] Debug feature to choose email "from" --- htdocs/admin/mails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 01f2736d718..d05518374c1 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -404,7 +404,7 @@ if ($action == 'edit') $var=!$var; $liste = array(); $liste['user'] = $langs->trans('UserEmail'); - $liste['company'] = $langs->trans('CompanyEmail'); + $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')'; print ''."\n"; print ''."\n"; print ''."\n"; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 16b63c16601..0b5e9ebb358 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -127,7 +127,7 @@ class FormActions print ''; if ($key == '50' && $onlyselect == 2) { - print ''; + print ''; } } print ''; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 47e6fb43d5c..a0c2a6e9de4 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -82,7 +82,7 @@ class modAgenda extends DolibarrModules { while ($obj = $this->db->fetch_object($sqlreadactions)) { - if (preg_match('/_CREATE$/',$obj->code) && ($obj->code != 'COMPANY_CREATE')) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty creation because there is no validation). + if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty or product creation because there is no validation). if (preg_match('/^PROJECT_/',$obj->code)) continue; // We don't track such events by default. if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1"); diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index b35d08036b3..2111a6c265c 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -33,6 +33,7 @@ -- List of all managed triggered events (used for trigger agenda automatic events and for notification) -- delete from llx_c_action_trigger; +-- actions enabled by default (constant created for that) when we enable module agenda insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); @@ -76,6 +77,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19); +-- actions not enabled by default (no constant created for that) when we enable module agenda insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142); From 0ef963604f227fb81ee45716da3b496bc1361cbd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Dec 2016 12:38:24 +0100 Subject: [PATCH 38/47] Fix option moreinheader not correctly supported with smtps --- htdocs/core/class/CMailFile.class.php | 15 ++++++---- htdocs/core/class/smtps.class.php | 41 +++++++++++++++++++++------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 51730bf128e..027bedebb6e 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -54,6 +54,7 @@ class CMailFile var $deliveryreceipt; var $eol; + var $eol2; var $atleastonefile=0; var $error=''; @@ -103,7 +104,7 @@ class CMailFile * @param string $errors_to Email for errors-to * @param string $css Css option * @param string $trackid Tracking string - * @param string $moreinheader More in header (for phpmail only for the moment) + * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment) */ function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='') { @@ -117,6 +118,7 @@ class CMailFile { $this->eol="\n"; $this->eol2="\n"; + $moreinheader = str_replace("\r\n","\n",$moreinheader); } // On defini mixed_boundary @@ -209,7 +211,7 @@ class CMailFile $this->deliveryreceipt = $deliveryreceipt; $this->trackid = $trackid; $smtp_headers = $this->write_smtpheaders(); - if (! empty($moreinheader)) $smtp_headers.=$moreinheader; + if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n // Define mime_headers $mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list); @@ -270,7 +272,8 @@ class CMailFile $smtps->setFrom($this->getValidAddress($from,0,1)); $smtps->setTrackId($trackid); $smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From - + if (! empty($moreinheader)) $smtps->setMoreInHeader($moreinheader); + if (! empty($this->html)) { if (!empty($css)) @@ -324,7 +327,8 @@ class CMailFile $this->phpmailer->SetFrom($this->getValidAddress($from,0,1)); $this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From // TODO Add trackid into smtp header - + // TODO if (! empty($moreinheader)) ... + if (! empty($this->html)) { if (!empty($css)) @@ -377,7 +381,8 @@ class CMailFile $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); - + // TODO if (! empty($moreinheader)) ... + // Give the message a subject $this->message->setSubject($this->encodetorfc2822($subject)); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 6ad73d10ac5..083bec812fa 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -225,7 +225,8 @@ class SMTPs var $log = ''; var $_errorsTo = ''; var $_deliveryReceipt = 0; - var $_trackId = ''; + var $_trackId = ''; + var $_moreInHeader = ''; /** @@ -261,15 +262,36 @@ class SMTPs } /** + * Set moreInHeader + * + * @param string $_val Value + * @return void + */ + function setMoreInHeader($_val = '') + { + $this->_moreinheader = $_val; + } + + /** * get trackid * - * @return string Delivery receipt + * @return string Track id */ function getTrackId() { return $this->_trackId; } + /** + * get moreInHeader + * + * @return string moreInHeader + */ + function getMoreInHeader() + { + return $this->_moreinheader; + } + /** * Set errors to * @@ -1213,7 +1235,9 @@ class SMTPs { $_header .= 'Message-ID: <' . time() . '.SMTPs@' . $host . ">\r\n"; } - + if ( $this->getMoreInHeader() ) + $_header .= $this->getMoreInHeader(); // Value must include the "\r\n"; + //$_header .= // 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n" // 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"; @@ -1227,15 +1251,16 @@ class SMTPs // DOL_CHANGE LDR if ( $this->getDeliveryReceipt() ) - $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n"; + $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n"; if ( $this->getErrorsTo() ) - $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n"; + $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n"; if ( $this->getReplyTo() ) - $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n"; + $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n"; - $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n" - . 'Mime-Version: 1.0' . "\r\n"; + $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"; + $_header .= 'Mime-Version: 1.0' . "\r\n"; + return $_header; } From d08857d2c6d5a276cfe8a473c78e59bdcb3a0377 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Dec 2016 19:35:47 +0100 Subject: [PATCH 39/47] Fix photo resize --- htdocs/core/photos_resize.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index ae73347edfa..778c37f686a 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -197,7 +197,7 @@ llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/p print load_fiche_titre($langs->trans("ImageEditor")); -$infoarray=dol_getImageSize($dir."/".urldecode($_GET["file"])); +$infoarray=dol_getImageSize($dir."/".GETPOST("file")); $height=$infoarray['height']; $width=$infoarray['width']; print $langs->trans("CurrentInformationOnImage").': '; @@ -218,7 +218,7 @@ print ''.$langs->trans("Resize").''; print $langs->trans("ResizeDesc").'
'; print $langs->trans("NewLength").': px   '.$langs->trans("or").'   '; print $langs->trans("NewHeight").': px  
'; -print ''; +print ''; print ''; print ''; print ''; @@ -240,7 +240,7 @@ print '
'."\n"; if (! empty($conf->use_javascript_ajax)) { - $infoarray=dol_getImageSize($dir."/".urldecode($_GET["file"])); + $infoarray=dol_getImageSize($dir."/".GETPOST("file")); $height=$infoarray['height']; $width=$infoarray['width']; $widthforcrop=$width; $refsizeforcrop='orig'; $ratioforcrop=1; @@ -260,7 +260,7 @@ if (! empty($conf->use_javascript_ajax)) print ''; print ''; print '
'; - print ' + print '
'.$langs->trans("NewSizeAfterCropping").': @@ -271,13 +271,13 @@ if (! empty($conf->use_javascript_ajax))
- + - + - - + +
  From 77c320a092c7a263ab706f97f653cca00ba2578f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 15:33:43 +0100 Subject: [PATCH 40/47] Fix warning for expense report late --- htdocs/admin/delais.php | 7 ++++++- htdocs/core/class/conf.class.php | 2 ++ htdocs/core/modules/modExpenseReport.class.php | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 41b2f489904..597327c04ba 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -112,7 +112,12 @@ $modules=array( array( 'code' => 'MAIN_DELAY_EXPENSEREPORTS', 'img' => 'trip' - ) + ), + /* TODO Enable this + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', + 'img' => 'trip' + )*/ ), ); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index abe672dee68..189d5327666 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -553,6 +553,8 @@ class Conf $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; } if (isset($this->expensereport)) { + $this->expensereport->approve = new stdClass(); + $this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60; $this->expensereport->payment = new stdClass(); $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; } diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index ad82cb21a89..1507d236698 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -86,6 +86,20 @@ class modExpenseReport extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "MAIN_DELAY_EXPENSEREPORTS"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "15"; + $this->const[$r][3] = 'Tolerance delay (in days) before alert for expense reports to approve'; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "MAIN_DELAY_EXPENSEREPORTS_TO_PAY"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "15"; + $this->const[$r][3] = 'Tolerance delay (in days) before alert for expense reports to pay'; + $this->const[$r][4] = 0; + $r++; + // Array to add new pages in new tabs $this->tabs = array(); From 574f84bb84755d522e40e604d0e97e8f31d8f71c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 15:49:06 +0100 Subject: [PATCH 41/47] Fix warning for approval delay. --- htdocs/core/class/conf.class.php | 3 +++ htdocs/expensereport/card.php | 6 +++--- htdocs/expensereport/class/expensereport.class.php | 10 +++++----- htdocs/expensereport/list.php | 8 ++++---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4002f437ede..5dba9afda4b 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -543,10 +543,13 @@ class Conf $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; } if (isset($this->expensereport)) { + $this->expensereport->approve = new stdClass(); + $this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60; $this->expensereport->payment = new stdClass(); $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; } + // For modules that want to disable top or left menu if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU; if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3f827de3540..a42a8ae5890 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1515,17 +1515,17 @@ else // Validation date print '
'; print ''; - print ''; print ''; - // User to inform + // User to inform for approval if ($object->fk_statut < 3) // informed { print ''; - print ''; + print ''; // approver print '"; From 4875509b5679bc5fc86d6ed13af884c1a0eae8b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 15:57:19 +0100 Subject: [PATCH 42/47] Fix sort criterias --- htdocs/expensereport/list.php | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 81eb08f2885..cad23176b4a 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -49,16 +49,19 @@ $result = restrictedArea($user, 'expensereport','',''); $diroutputmassaction=$conf->expensereport->dir_output . '/temp/massgeneration/'.$user->id; + +// Load variable for pagination $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield='c.ref'; -if (! $sortorder) $sortorder='DESC'; +if (!$sortorder) $sortorder="DESC"; +if (!$sortfield) $sortfield="d.date_debut"; + $sall = GETPOST('sall'); $search_ref = GETPOST('search_ref'); @@ -176,20 +179,6 @@ llxHeader('', $langs->trans("ListOfTrips")); $max_year = 5; $min_year = 5; -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); -$page = GETPOST("page"); -if (!$sortorder) $sortorder="DESC"; -if (!$sortfield) $sortfield="d.date_debut"; -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; - -if ($page == -1) { - $page = 0 ; -} - -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,"; $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; From 1307b93d55051526f47473b1ef0651bc1765d23f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 16:09:12 +0100 Subject: [PATCH 43/47] Normalize code --- htdocs/holiday/define_holiday.php | 34 +++++++++++++++++++++++-------- htdocs/holiday/view_log.php | 31 +++++++++++++++++++--------- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 51f3a70a409..cd0c3fc1598 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -175,25 +175,41 @@ else print '
'; print '
'.$langs->trans("UserTitle").''; From be19a999f5a4f3de3e05bceea556a794672f689c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 18:11:53 +0100 Subject: [PATCH 35/47] Fix regression losing warning on not defined emails --- htdocs/core/class/html.form.class.php | 26 ++++++++++++++++++----- htdocs/core/class/html.formmail.class.php | 20 ++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c9e57eeaa4d..8abe3f271f7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4857,12 +4857,13 @@ class Form * @param int $disabled Html select box is disabled * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order * @param string $morecss Add more class to css styles - * @param int $addjscombo Add js combo + * @param int $addjscombo Add js combo * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set. - * @return string HTML select string. + * @param int $disablebademail Check if an email is found into value and if not disable and colorize entry. + * @return string HTML select string. * @see multiselectarray */ - static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='') + static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='',$disablebademail=0) { global $conf, $langs; @@ -4907,7 +4908,10 @@ class Form // Translate if ($translate) { - foreach($array as $key => $value) $array[$key]=$langs->trans($value); + foreach($array as $key => $value) + { + $array[$key]=$langs->trans($value); + } } // Sort @@ -4916,8 +4920,19 @@ class Form foreach($array as $key => $value) { + $disabled=''; $style=''; + if (! empty($disablebademail)) + { + if (! preg_match('/<.+@.+>/', $value)) + { + //$value=preg_replace('/'.preg_quote($a,'/').'/', $b, $value); + $disabled=' disabled'; + $style=' class="warning"'; + } + } $out.='
'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE',$liste,$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE,0); From 3c79f3acb5ceac15575e99f61a728cb6bc47a461 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Dec 2016 12:06:26 +0100 Subject: [PATCH 37/47] Minor fixes or code comment --- htdocs/admin/agenda_other.php | 2 +- htdocs/core/class/html.formactions.class.php | 2 +- htdocs/core/modules/modAgenda.class.php | 2 +- htdocs/install/mysql/data/llx_c_action_trigger.sql | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index e6bb4a2914f..9406f8ecc5d 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -375,7 +375,7 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' '."\n"; - $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", '', 0, 1); + $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print '
'.$langs->trans("DATE_SAVE").''.dol_print_date($object->date_create,'dayhour'); + print ''.dol_print_date($object->date_valid,'dayhour'); if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late")); if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late")); print '
'.$langs->trans("VALIDATOR").''.$langs->trans("VALIDATOR").''; if ($object->fk_user_validator > 0) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9349e0e72e0..3ec9705d247 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -907,7 +907,6 @@ class ExpenseReport extends CommonObject } } } - if ($this->fk_statut != 2) { $now = dol_now(); @@ -918,7 +917,7 @@ class ExpenseReport extends CommonObject $sql.= ", ref_number_int = ".$ref_number_int; } $sql.= ' WHERE rowid = '.$this->id; - + $resql=$this->db->query($sql); if ($resql) { @@ -1635,11 +1634,12 @@ class ExpenseReport extends CommonObject if ($option == 'topay' && $this->status != 5) return false; $now = dol_now(); - if ($option == 'toapprove') - return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay); + { + return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->approve->warning_delay); + } else - return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay); + return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 476ef2224f5..ead495bc1a0 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -141,7 +141,7 @@ if (!empty($sall)) } // Ref if(!empty($search_ref)){ - $sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'"; + $sql.= natural_search("d.ref", $search_ref); } // Date Start if ($month_start > 0) @@ -325,9 +325,9 @@ if ($resql) $expensereportstatic->id=$objp->rowid; $expensereportstatic->ref=$objp->ref; $expensereportstatic->status=$objp->status; - $expensereportstatic->valid=$objp->date_valid; - $expensereportstatic->date_debut=$objp->date_debut; - $expensereportstatic->date_fin=$objp->date_fin; + $expensereportstatic->date_valid=$db->jdate($objp->date_valid); + $expensereportstatic->date_debut=$db->jdate($objp->date_debut); + $expensereportstatic->date_fin=$db->jdate($objp->date_fin); $var=!$var; print "
'."\n"; - print ""; - print ''; + print ''; + print_liste_field_titre($langs->trans('Employee'), $_SERVER["PHP_SELF"]); if (count($typeleaves)) { foreach($typeleaves as $key => $val) { - print ''; + print ''; } } else { - print ''; + print ''; } - print ''; + print ''; + print_liste_field_titre(''); print ''; - + print ''; + print ''; + if (count($typeleaves)) + { + foreach($typeleaves as $key => $val) + { + print ''; + } + } + else + { + print ''; + } + print ''; + print ''; + print ''; + foreach($listUsers as $users) { $var=!$var; @@ -204,7 +220,7 @@ else if (($users['rowid'] != $user->id) && (! in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. } - print ''; + print ''; print '
'.$langs->trans('Employee').'
'.$val['label'].''.$val['label'].''.$langs->trans("NoLeaveWithCounterDefined").''.$langs->trans("NoLeaveWithCounterDefined").''; + print ''; if ($canedit) print $langs->trans('Note'); - print ''; - print '
'; $userstatic->id=$users['rowid']; $userstatic->lastname=$users['lastname']; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index a04ef05c69b..51d3e2d0be3 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -78,17 +78,28 @@ print ''; print ''; - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - +print_liste_field_titre($langs->trans('ID')); +print_liste_field_titre($langs->trans('Date'), $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); +print_liste_field_titre($langs->trans('ActionByCP')); +print_liste_field_titre($langs->trans('UserUpdateCP')); +print_liste_field_titre($langs->trans('Description')); +print_liste_field_titre($langs->trans('Type')); +print_liste_field_titre($langs->trans('PrevSoldeCP'), $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); +print_liste_field_titre($langs->trans('NewSoldeCP'), $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + + $var=true; foreach($cp->logs as $logs_CP) From b2776a62d885995a9f551c9fb29d4f0c830d00d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 16:23:38 +0100 Subject: [PATCH 44/47] Fix bad link --- htdocs/expensereport/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 675d800145b..b92405424c6 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -196,7 +196,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/compta/expensereport/stats/index.php'; +$head[$h][0] = DOL_URL_ROOT . '/expensereport/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; From 081d3f081432ae53a04251c33fd6c83a2f930041 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 16:52:03 +0100 Subject: [PATCH 45/47] Quick hack by adding hidden constant to solve a locking feature (how to add project if likned to another third on project view) --- htdocs/core/class/html.formprojet.class.php | 8 ++++++-- htdocs/projet/element.php | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 1112d34d13f..6c2b5600917 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -446,7 +446,7 @@ class FormProjets * Build a HTML select list of element of same thirdparty to suggest to link them to project * * @param string $table_element Table of the element to update - * @param int $socid If of thirdparty to use as filter + * @param string $socid If of thirdparty to use as filter or 'id1,id2,...' * @param string $morecss More CSS * @param int $limitonstatus Add filters to limit length of list to opened status (for example to avoid ERR_RESPONSE_HEADERS_TOO_BIG on project/element.php page). TODO To implement * @return int|string The HTML select list of element or '' if nothing or -1 if KO @@ -502,7 +502,11 @@ class FormProjets $sql.= " FROM ".MAIN_DB_PREFIX.$table_element." as t"; if ($linkedtothirdparty) $sql.=", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE ".$projectkey." is null"; - if (! empty($socid) && $linkedtothirdparty) $sql.= " AND t.fk_soc=".$socid; + if (! empty($socid) && $linkedtothirdparty) + { + if (is_numeric($socid)) $sql.= " AND t.fk_soc=".$socid; + else $sql.= " AND t.fk_soc IN (".$socid.")"; + } if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND t.entity IN ('.getEntity('project',1).')'; if ($linkedtothirdparty) $sql.=" AND s.rowid = t.fk_soc"; if ($sqlfilter) $sql.= " AND ".$sqlfilter; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2da7a6e5227..710807dcdec 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -640,9 +640,14 @@ foreach ($listofreferent as $key => $value) $addform=''; $idtofilterthirdparty=0; - if (! in_array($tablename, array('facture_fourn', 'commande_fournisseur'))) $idtofilterthirdparty=$object->thirdparty->id; + $array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur'); + if (! in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) + { + $idtofilterthirdparty=$object->thirdparty->id; + if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS; + } - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300'); if (! $selectList || ($selectList<0)) From bdead24e2e2fb0045a3f9bd361e13bb3e6cff190 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 17:27:58 +0100 Subject: [PATCH 46/47] Fix bad var get --- htdocs/expensereport/list.php | 51 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index cad23176b4a..ce682273b6e 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -106,6 +106,8 @@ $arrayfields=array( 'user'=>array('label'=>$langs->trans("User"), 'checked'=>1), 'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1), 'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), + 'd.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), + 'd.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1), 'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'd.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), 'd.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), @@ -344,13 +346,15 @@ if ($resql) print '
'; print '
'.$langs->trans('ID').''.$langs->trans('Date').''.$langs->trans('ActionByCP').''.$langs->trans('UserUpdateCP').''.$langs->trans('Description').''.$langs->trans('Type').''.$langs->trans('PrevSoldeCP').''.$langs->trans('NewSoldeCP').'
'."\n"; print ""; - if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.date_debut']['checked'])) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['d.date_fin']['checked'])) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['d.total_ht']['checked'])) print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['d.total_vat']['checked'])) print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['d.total_ttc']['checked'])) print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($arrayfields['user']['label'],$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_debut']['checked'])) print_liste_field_titre($arrayfields['d.date_debut']['label'],$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_fin']['checked'])) print_liste_field_titre($arrayfields['d.date_fin']['label'],$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_valid']['checked'])) print_liste_field_titre($arrayfields['d.date_valid']['label'],$_SERVER["PHP_SELF"],"d.date_valid","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_approve']['checked'])) print_liste_field_titre($arrayfields['d.date_approve']['label'],$_SERVER["PHP_SELF"],"d.date_approve","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_ht']['checked'])) print_liste_field_titre($arrayfields['d.total_ht']['label'],$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_vat']['checked'])) print_liste_field_titre($arrayfields['d.total_vat']['label'],$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_ttc']['checked'])) print_liste_field_titre($arrayfields['d.total_ttc']['label'],$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -409,7 +413,23 @@ if ($resql) $formother->select_year($year_end,'year_end',1, $min_year, $max_year); print ''; } - // Amount with no tax + // Date valid + if (! empty($arrayfields['d.date_valid']['checked'])) + { + print ''; + } + // Date approve + if (! empty($arrayfields['d.date_approve']['checked'])) + { + print ''; + } + // Amount with no tax if (! empty($arrayfields['d.total_ht']['checked'])) { print ''; @@ -498,13 +518,12 @@ if ($resql) $expensereportstatic->id=$obj->rowid; $expensereportstatic->ref=$obj->ref; $expensereportstatic->status=$obj->status; - $expensereportstatic->valid=$obj->date_valid; $expensereportstatic->date_debut=$db->jdate($obj->date_debut); $expensereportstatic->date_fin=$db->jdate($obj->date_fin); $expensereportstatic->date_create=$db->jdate($obj->date_create); $expensereportstatic->date_modif=$db->jdate($obj->date_modif); - $expensereportstatic->date_valid=$db->jdate($objp->date_valid); - $expensereportstatic->date_approve=$db->jdate($objp->date_approve); + $expensereportstatic->date_valid=$db->jdate($obj->date_valid); + $expensereportstatic->date_approve=$db->jdate($obj->date_approve); $var=!$var; print ""; @@ -536,7 +555,15 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Amount HT + if (! empty($arrayfields['d.date_valid']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['d.date_approve']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount HT if (! empty($arrayfields['d.total_ht']['checked'])) { print '\n"; From b4ed0a1e12d02759f5b33bf3e95a55159f2103e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2016 15:49:06 +0100 Subject: [PATCH 47/47] Fix nb of lat approvals wrong --- htdocs/core/class/conf.class.php | 3 +++ htdocs/expensereport/card.php | 6 +++--- htdocs/expensereport/class/expensereport.class.php | 14 +++++++------- htdocs/expensereport/list.php | 8 ++++---- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4002f437ede..5dba9afda4b 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -543,10 +543,13 @@ class Conf $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; } if (isset($this->expensereport)) { + $this->expensereport->approve = new stdClass(); + $this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60; $this->expensereport->payment = new stdClass(); $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; } + // For modules that want to disable top or left menu if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU; if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3f827de3540..a42a8ae5890 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1515,17 +1515,17 @@ else // Validation date print ''; print ''; - print ''; print ''; - // User to inform + // User to inform for approval if ($object->fk_statut < 3) // informed { print ''; - print ''; + print ''; // approver print '";
'; + //print ''; + //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + print ''; + //print ''; + //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + print '
'.($obj->date_fin > 0 ? dol_print_date($obj->date_fin, 'day') : '').''.($obj->date_valid > 0 ? dol_print_date($obj->date_valid, 'day') : '').''.($obj->date_approve > 0 ? dol_print_date($obj->date_approve, 'day') : '').''.price($obj->total_ht)."
'.$langs->trans("DATE_SAVE").''.dol_print_date($object->date_create,'dayhour'); + print ''.dol_print_date($object->date_valid,'dayhour'); if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late")); if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late")); print '
'.$langs->trans("VALIDATOR").''.$langs->trans("VALIDATOR").''; if ($object->fk_user_validator > 0) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9349e0e72e0..ccdddfedfea 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -907,7 +907,6 @@ class ExpenseReport extends CommonObject } } } - if ($this->fk_statut != 2) { $now = dol_now(); @@ -918,7 +917,7 @@ class ExpenseReport extends CommonObject $sql.= ", ref_number_int = ".$ref_number_int; } $sql.= ' WHERE rowid = '.$this->id; - + $resql=$this->db->query($sql); if ($resql) { @@ -1598,13 +1597,13 @@ class ExpenseReport extends CommonObject if ($option == 'toapprove') { - if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->approve->warning_delay)) { + if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->approve->warning_delay)) { $response->nbtodolate++; } } else { - if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) { + if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->payment->warning_delay)) { $response->nbtodolate++; } } @@ -1635,11 +1634,12 @@ class ExpenseReport extends CommonObject if ($option == 'topay' && $this->status != 5) return false; $now = dol_now(); - if ($option == 'toapprove') - return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay); + { + return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->approve->warning_delay); + } else - return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay); + return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 476ef2224f5..ead495bc1a0 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -141,7 +141,7 @@ if (!empty($sall)) } // Ref if(!empty($search_ref)){ - $sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'"; + $sql.= natural_search("d.ref", $search_ref); } // Date Start if ($month_start > 0) @@ -325,9 +325,9 @@ if ($resql) $expensereportstatic->id=$objp->rowid; $expensereportstatic->ref=$objp->ref; $expensereportstatic->status=$objp->status; - $expensereportstatic->valid=$objp->date_valid; - $expensereportstatic->date_debut=$objp->date_debut; - $expensereportstatic->date_fin=$objp->date_fin; + $expensereportstatic->date_valid=$db->jdate($objp->date_valid); + $expensereportstatic->date_debut=$db->jdate($objp->date_debut); + $expensereportstatic->date_fin=$db->jdate($objp->date_fin); $var=!$var; print "