From 88fb094a78e42f721e1494e5cbe098910b58a87a Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Fri, 8 Nov 2019 22:02:30 +0100 Subject: [PATCH 01/88] Fix problem of display photo in the model Fix a problem with photo in the model : Before : Check in the current entity the product's repertory to find a photo Now : Check all entities product's repertories to find a photo --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 14f4dfe8f9f..7fb456fc4d6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -8,6 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2018 Ferran Marcet * Copyright (C) 2018 Frédéric France + * Copyright (C) 2019 Pierre Ardoin * * 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 @@ -257,7 +258,13 @@ class pdf_azur extends ModelePDFPropales { if (! $arephoto) { - $dir = $conf->product->dir_output.'/'.$midir; + if ($conf->product->entity != $objphoto->entity) { + + $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities + }else{ + + $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product + } foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { From 4846885eea9606fc3d8049b4df63066937970eba Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Mon, 2 Dec 2019 16:54:05 +0100 Subject: [PATCH 02/88] NEW 9.0: enable user to use the mysqldump '--quick' option (useful if the server has low RAM or large tables) --- htdocs/admin/tools/dolibarr_export.php | 9 ++++++++- htdocs/core/class/utils.class.php | 1 + htdocs/langs/en_US/admin.lang | 2 ++ htdocs/langs/fr_FR/admin.lang | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 231699dc636..d04840e2d71 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -211,7 +211,6 @@ print '';
-
global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> @@ -234,6 +233,14 @@ print '';
+ + +
diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 6b6d2d42c67..8ce4cca7ca6 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -262,6 +262,7 @@ class Utils if (GETPOST("disable_fk", "alpha") || $usedefault) $param.=" -K"; if (GETPOST("sql_compat", "alpha") && GETPOST("sql_compat", "alpha") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat", "alpha")); if (GETPOST("drop_database", "alpha")) $param.=" --add-drop-database"; + if (GETPOST("use_mysql_quick_param", "alpha"))$param.=" --quick"; if (GETPOST("sql_structure", "alpha") || $usedefault) { if (GETPOST("drop", "alpha") || $usedefault) $param.=" --add-drop-table=TRUE"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d70bfe959e9..b477298f88a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -174,6 +174,8 @@ Compression=Compression CommandsToDisableForeignKeysForImport=Command to disable foreign keys on import CommandsToDisableForeignKeysForImportWarning=Mandatory if you want to be able to restore your sql dump later ExportCompatibility=Compatibility of generated export file +ExportUseMySQLQuickParameter=Use the --quick parameter +ExportUseMySQLQuickParameterHelp=The '--quick' parameter helps limit RAM consumption for large tables. MySqlExportParameters=MySQL export parameters PostgreSqlExportParameters= PostgreSQL export parameters UseTransactionnalMode=Use transactional mode diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4b7cb82e4d4..8abb4dd8d29 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -174,6 +174,8 @@ Compression=Compression CommandsToDisableForeignKeysForImport=Commande pour désactiver les clés étrangères à l'importation CommandsToDisableForeignKeysForImportWarning=Requis si vous voulez être en mesure de restaurer votre « dump » SQL plus tard ExportCompatibility=Compatibilité du fichier d'exportation généré +ExportUseMySQLQuickParameter=Utiliser le paramètre --quick +ExportUseMySQLQuickParameterHelp=permet de limiter la consommation de mémoire vive (utile en cas de tables volumineuses) MySqlExportParameters=Paramètres de l'exportation MySQL PostgreSqlExportParameters= Paramètres de l'exportation PostgreSQL UseTransactionnalMode=Utiliser le mode transactionnel From cec54d6ce0e9b47db1e988c2a21a183fd64331b8 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 3 Dec 2019 16:40:35 +0100 Subject: [PATCH 03/88] FIX : when we need to bill several orders, order lines unit is not on bill lines --- htdocs/core/actions_massactions.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2f5f03ee5a8..62d8e2466b0 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -701,7 +701,10 @@ if ($massaction == 'confirm_createbills') $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $lines[$i]->label, - $array_options + $array_options, + 100, + 0, + $lines[$i]->fk_unit ); if ($result > 0) { From 558e0cb5f6a4bb71d01b2ea17f43e397ea32cd59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 22:34:49 +0100 Subject: [PATCH 04/88] Fix regression --- htdocs/core/lib/pdf.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ac407bd42a1..bb689d52519 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1263,8 +1263,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } - elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { - $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + if ($object->type == $object::TYPE_DEPOSIT) { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } } // Description short of product line From 60d3bd0fe9379feca12dd3e9c6b87a64ba048953 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 22:36:26 +0100 Subject: [PATCH 05/88] Fix regression --- htdocs/core/lib/pdf.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6c2fb96e76c..af1da161dc7 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1256,8 +1256,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } - elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { - $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + if ($object->type == $object::TYPE_DEPOSIT) { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } } // Description short of product line From a75915a7a85823724ff77d34047d29a17ac517e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 22:37:58 +0100 Subject: [PATCH 06/88] Fix regression --- htdocs/core/lib/pdf.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 8fa12241643..3d22733ee7f 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1238,8 +1238,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } - elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { - $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + if ($object->type == $object::TYPE_DEPOSIT) { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } } // Description short of product line From 23a4eaf68910e3c3b9e0114c1ba4d98cfeec56aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 4 Dec 2019 08:26:40 +0100 Subject: [PATCH 07/88] clean markdown --- README-FR.md | 54 +++++++++------------- htdocs/modulebuilder/README.md | 4 +- htdocs/modulebuilder/template/ChangeLog.md | 4 +- htdocs/modulebuilder/template/README.md | 23 ++++----- 4 files changed, 34 insertions(+), 51 deletions(-) diff --git a/README-FR.md b/README-FR.md index 4feb27893e0..0d610c29e3b 100644 --- a/README-FR.md +++ b/README-FR.md @@ -1,18 +1,14 @@ # DOLIBARR ERP & CRM -Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans). +Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans). Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...). - + ![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png) - - ## LICENCE Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure. - - ## INSTALLER DOLIBARR ### Configuration simple @@ -34,7 +30,7 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg   git clone https://github.com/dolibarr/dolibarr -b x.y (où x.y est la version principale comme 3.6, 9.0, ...) - Configurez votre serveur Web pour qu'il utilise "*dolibarr/htdocs*" en tant que racine si votre serveur Web ne possède pas déjà de répertoire défini vers lequel pointer. -  + - Créez un fichier `htdocs/conf/conf.php` vide et définissez les autorisations d'*écrire* pour l'utilisateur de votre serveur Web (l'autorisation *écrire* sera supprimée une fois l'installation terminée) - Depuis votre navigateur, allez à la page "install/" de dolibarr @@ -53,28 +49,25 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg     - Suivez les instructions de l'installateur - ## METTRE A JOUR DOLIBARR Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: + - Ecrasez les vieux fichiers dans le vieux répertoire 'dolibarr' par les fichiers fournis dans ce nouveau package. - + - Au prochain accès, Dolibarr proposera la page de "mise à jour" des données (si nécessaire). - Si un fichier install.lock existe pour verrouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transférés sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents") - + Si un fichier install.lock existe pour verrouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transférés sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents") + *Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/* - ## CE QUI EST NOUVEAU Voir fichier ChangeLog. - - ## CE QUE DOLIBARR PEUT FAIRE -### Modules principaux (tous optionnels): +### Modules principaux (tous optionnels) - Annuaires des prospects et/ou client et/ou fournisseurs - Gestion de catalogue de produits et services @@ -83,7 +76,7 @@ Voir fichier ChangeLog. - Gestion des factures clients/fournisseurs et paiements - Gestion des virements bancaires SEPA - Gestion des comptes bancaires -- Calendrier/Agenda partagé (avec export ical, vcal) +- Calendrier/Agenda partagé (avec export ical, vcal) - Suivi des opportunités et/ou projets (suivi de rentabilité incluant les factures, notes de frais, temps consommé valorisé, ...) - Gestion de contrats de services - Gestion de stock @@ -96,7 +89,7 @@ Voir fichier ChangeLog. - Point de vente/Caisse enregistreuse - … -### Autres modules: +### Autres modules - Gestion de marque-pages - Gestion des promesses de dons @@ -111,7 +104,7 @@ Voir fichier ChangeLog. - Intégration de système de paiements (Paypal, Stripe, Paybox...) - … -### Divers: +### Divers - Multi-langue. - Multi-utilisateurs avec différents niveaux de permissions par module. @@ -119,41 +112,39 @@ Voir fichier ChangeLog. - Peux être multi-société par ajout du module externe multi-société. - Plusieurs thèmes visuels. - Application simple à utiliser. -- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur https://wiki.dolibarr.org/index.php/Prérequis). +- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur https://wiki.dolibarr.org/index.php/Prérequis). - Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP. - APIs. - Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...) - Code simple et facilement personnalisable (pas de framework lourd; mécanisme de hook et triggers). - Support natif de nombreuses fonctions spécifiques aux pays comme: - - La tax espagnole TE et ISPF - - Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM) - - La loi française Finance 2016 et logiciels de caisse - - La double taxe canadienne - - Le timbre fiscal tunisien - - Numérotation de facture de l'argentines (avec type A,B,C...) - - Compatible avec vos processus RGPD - - ... + - La tax espagnole TE et ISPF + - Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM) + - La loi française Finance 2016 et logiciels de caisse + - La double taxe canadienne + - Le timbre fiscal tunisien + - Numérotation de facture de l'argentines (avec type A,B,C...) + - Compatible avec vos processus RGPD + - ... - … ### Extension Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com). - ## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE Voici un liste de fonctionnalités pas encore gérées par Dolibarr: + - Dolibarr ne contient pas de module de Gestion de la paie. - Les tâches du module de gestion de projets n'ont pas de dépendances entre elle. - Dolibarr n'embarque pas de Webmail intégré nativement. -- Dolibarr ne fait pas le café (pas encore). - +- Dolibarr ne fait pas le café (pas encore). ## DOCUMENTATION La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org). - ## CONTRIBUER Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]. @@ -166,7 +157,6 @@ Dolibarr est le résultat du travail de nombreux contributeurs depuis des année Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) - ## ACTUALITES ET RESEAUX SOCIAUX Suivez le projet Dolibarr project sur les réseaux francophones diff --git a/htdocs/modulebuilder/README.md b/htdocs/modulebuilder/README.md index e5d9e63d7a3..7bafab32ae3 100644 --- a/htdocs/modulebuilder/README.md +++ b/htdocs/modulebuilder/README.md @@ -7,9 +7,7 @@ has to offer for module development. If you don't need to develop your own module/application, you just don't need this. - -After enabling this module, you should find features to generate or edit modules/application from menu *Home - Admin tools - Module builder* - +After enabling this module, you should find features to generate or edit modules/application from menu *Home - Admin tools - Module builder* Documentation ------------- diff --git a/htdocs/modulebuilder/template/ChangeLog.md b/htdocs/modulebuilder/template/ChangeLog.md index 99f4f673c0c..6ac54265da4 100644 --- a/htdocs/modulebuilder/template/ChangeLog.md +++ b/htdocs/modulebuilder/template/ChangeLog.md @@ -1,5 +1,5 @@ -# CHANGELOG MYMODULE FOR DOLIBARR ERP CRM +# CHANGELOG MYMODULE FOR [DOLIBARR ERP CRM] ## 1.0 -Initial version +Initial version diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 0fcd76f178e..29aba550022 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -1,29 +1,27 @@ -# MYMODULE FOR DOLIBARR ERP CRM +# MYMODULE FOR [DOLIBARR ERP CRM] ## Features + Description... -Other modules are available on Dolistore.com. - - +Other modules are available on [Dolistore.com]. ## Translations -Translations can be define manually by editing files into directories *langs*. +Translations can be define manually by editing files into directories *langs*. - - ## Licenses -**Main code** +### Main code GPLv3 or (at your option) any later version. See file COPYING for more information. -**Documentation** +### Documentation All texts and readmes are licensed under GFDL. From c0b35ded15c8435984ba896abf54f1376f34fa85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 4 Dec 2019 21:39:56 +0100 Subject: [PATCH 08/88] Update cronjob.class.php fk_user_author and fk_user_mod are int --- htdocs/cron/class/cronjob.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index dbf35be905b..245026ab2fb 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -821,8 +821,8 @@ class Cronjob extends CommonObject $this->frequency=''; $this->status=0; $this->processing=0; - $this->fk_user_author=''; - $this->fk_user_mod=''; + $this->fk_user_author=0; + $this->fk_user_mod=0; $this->note=''; $this->nbrun=''; $this->maxrun=100; From 327cf29b41f93ef5651ae055662656d24552d2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 4 Dec 2019 21:42:24 +0100 Subject: [PATCH 09/88] Update images.lib.php --- htdocs/core/lib/images.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index fa68301a298..da1abe47268 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -325,7 +325,6 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) if (function_exists('exif_read_data') ) { $exif = exif_read_data($fileSource); if ($exif && isset($exif['Orientation'])) { - $infoImg = getimagesize($fileSource); // Get image infos $orientation = $exif['Orientation']; @@ -357,7 +356,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) } } // then rewrite the rotated image back to the disk as $fileDest - if($fileDest === false){ + if ($fileDest === false){ return $img; } else From 6cb3e19b7d7c8b6b68e26c65ce3f4640fd991fc9 Mon Sep 17 00:00:00 2001 From: Laurent Paumier Date: Wed, 4 Dec 2019 22:10:59 +0100 Subject: [PATCH 10/88] fix pgsql replacement pattern for bigint auto increment --- htdocs/core/db/pgsql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 28821f31725..455ae851a54 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -200,7 +200,7 @@ class DoliDBPgsql extends DoliDB } if (preg_match('/[\s\t\(]*(\w*)[\s\t]+bigint.*auto_increment/i', $line, $reg)) { - $newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+int.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line); + $newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+bigint.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line); //$line = "-- ".$line." replaced by --\n".$newline; $line=$newline; } From 255b9f82a8a022e2c023c731cd6a2f93163ebf93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 20:57:43 +0100 Subject: [PATCH 11/88] clean markdown --- htdocs/modulebuilder/template/ChangeLog.md | 2 +- htdocs/modulebuilder/template/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/ChangeLog.md b/htdocs/modulebuilder/template/ChangeLog.md index 6ac54265da4..effcde148d2 100644 --- a/htdocs/modulebuilder/template/ChangeLog.md +++ b/htdocs/modulebuilder/template/ChangeLog.md @@ -1,4 +1,4 @@ -# CHANGELOG MYMODULE FOR [DOLIBARR ERP CRM] +# CHANGELOG MYMODULE FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) ## 1.0 diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 29aba550022..1472929c043 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -1,4 +1,4 @@ -# MYMODULE FOR [DOLIBARR ERP CRM] +# MYMODULE FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) ## Features @@ -8,7 +8,7 @@ Description... ![Screenshot mymodule](img/screenshot_mymodule.png?raw=true "MyModule"){imgmd} --> -Other modules are available on [Dolistore.com]. +Other modules are available on [Dolistore.com](https://www.dolistore.com>). ## Translations From 48d7e514ec84a2558c2709805e7f3c2201e2f547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 21:06:18 +0100 Subject: [PATCH 12/88] clean markdown --- README-FR.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/README-FR.md b/README-FR.md index 0d610c29e3b..382f2a670ac 100644 --- a/README-FR.md +++ b/README-FR.md @@ -19,7 +19,7 @@ Si vous avez peu de compétences techniques et que vous souhaitez installer Doli - DoliDeb pour Debian ou Ubuntu - DoliRpm pour Redhat, Fedora, OpenSuse, Mandriva ou Mageia -Les packages peuvent être téléchargés à partir de [site web officiel] (https://www.dolibarr.org/). +Les packages peuvent être téléchargés à partir de [site web officiel](https://www.dolibarr.org/). ### Configuration avancée @@ -27,7 +27,7 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg - Décompressez l'archive .zip téléchargée pour copier le répertoire "dolibarr/htdocs" et tous ses fichiers à la racine du serveur Web ou récupérez-les directement à partir de GitHub (recommandé si vous connaissez git): -  git clone https://github.com/dolibarr/dolibarr -b x.y (où x.y est la version principale comme 3.6, 9.0, ...) +  `git clone https://github.com/dolibarr/dolibarr -b x.y` (où x.y est la version principale comme 3.6, 9.0, ...) - Configurez votre serveur Web pour qu'il utilise "*dolibarr/htdocs*" en tant que racine si votre serveur Web ne possède pas déjà de répertoire défini vers lequel pointer. @@ -35,18 +35,18 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg - Depuis votre navigateur, allez à la page "install/" de dolibarr -    L’URL dépendra de la façon dont votre configuration Web a été configurée pour pointer vers votre installation de dolibarr. Cela peut ressembler à: + L’URL dépendra de la façon dont votre configuration Web a été configurée pour pointer vers votre installation de dolibarr. Cela peut ressembler à: + + `http://localhost/dolibarr/htdocs/install/` + + ou + + `http://localhost/dolibarr/install/` + + ou + + `http://yourdolibarrvirtualhost/install/` -        http://localhost/dolibarr/htdocs/install/ -         -    ou -     -        http://localhost/dolibarr/install/ -         -    ou -     -    http://yourdolibarrvirtualhost/install/ -    - Suivez les instructions de l'installateur ## METTRE A JOUR DOLIBARR @@ -150,7 +150,6 @@ La documentation utilisateur, développeur et traducteur est disponible sous for Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]. - ## CREDITS Dolibarr est le résultat du travail de nombreux contributeurs depuis des années et utilise des librairies d'autres contributeurs. @@ -161,9 +160,9 @@ Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/CO Suivez le projet Dolibarr project sur les réseaux francophones -- Facebook: -- Google+: -- Twitter: +- [Facebook](https://www.facebook.com/dolibarr.fr) +- [Google+](https://plus.google.com/+DolibarrFrance) +- [Twitter](https://www.twitter.com/dolibarr_france) ou sur les réseaux anglophones From 37784a247ab27edd1c70df432c29e37afd04a4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 21:11:05 +0100 Subject: [PATCH 13/88] clean markdown --- README.md | 61 ++++++++++++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 0ae6d1b9de5..b6410cfed0b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ You can use it as a standalone application or as a web application to be able to ![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png) - ## LICENSE Dolibarr is released 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 (GPL-3+). @@ -25,7 +24,6 @@ See the [COPYING](https://github.com/Dolibarr/dolibarr/blob/develop/COPYING) fil Other licenses apply for some included dependencies. See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) for a full list. - ## INSTALLING ### Simple setup @@ -42,51 +40,47 @@ Releases can be downloaded from [official website](https://www.dolibarr.org/). You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version. -- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git): +- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git): git clone https://github.com/dolibarr/dolibarr -b x.y (where x.y is main version like 3.6, 9.0, ...) -- Set up your web server to use "*dolibarr/htdocs*" as root if your web server does not have an already defined directory to point to. - +- Set up your web server to use "*dolibarr/htdocs*" as root if your web server does not have an already defined directory to point to. + - Create an empty `htdocs/conf/conf.php` file and set *write* permissions for your web server user (*write* permission will be removed once install is finished) - From your browser, go to the dolibarr "install/" page - The URL will depends on how you web setup was setup to point to your dolibarr installation. It may looks like: + The URL will depends on how you web setup was setup to point to your dolibarr installation. It may looks like: + + `http://localhost/dolibarr/htdocs/install/` + + or + + `http://localhost/dolibarr/install/` + + or + + `http://yourdolibarrvirtualhost/install/` - http://localhost/dolibarr/htdocs/install/ - - or - - http://localhost/dolibarr/install/ - - or - - http://yourdolibarrvirtualhost/install/ - - Follow the installer instructions ### Saas/Cloud setup If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free. - - ## UPGRADING -- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr +- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). *Note: migration process can be safely done multiple times by calling the `/install/index.php` page* - ## WHAT'S NEW See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. - ## FEATURES ### Main application/modules (all optional) @@ -113,7 +107,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Foundations members management - Mass emailing - Surveys -- Point of Sale (POS) +- Point of Sale (POS) - … ### Other application/modules @@ -144,14 +138,14 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - APIs - An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture) - Support a lot of country specific features: - - Spanish Tax RE and ISPF - - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) - - Canadian double taxes (federal/province) and other countries using cumulative VAT - - Tunisian tax stamp - - Argentina invoice numbering using A,B,C... - - Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) - - Compatible with European GDPR rules - - ... + - Spanish Tax RE and ISPF + - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) + - Canadian double taxes (federal/province) and other countries using cumulative VAT + - Tunisian tax stamp + - Argentina invoice numbering using A,B,C... + - Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) + - Compatible with European GDPR rules + - ... - PDF or ODT generation for invoice, proposals, orders... - … @@ -160,12 +154,10 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)) - Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites. - ### Extending Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com). - ## WHAT DOLIBARR CAN'T DO YET These are features that Dolibarr does **not** yet fully support: @@ -175,25 +167,21 @@ These are features that Dolibarr does **not** yet fully support: - No native embedded Webmail - Dolibarr can't do coffee (yet) - ## DOCUMENTATION Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](https://wiki.dolibarr.org). - ## CONTRIBUTING This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]. - ## CREDITS Dolibarr is the work of many contributors over the years and uses some fine libraries. See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file. - ## NEWS AND SOCIAL NETWORKS Follow Dolibarr project on: @@ -205,7 +193,6 @@ Follow Dolibarr project on: - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [GitHub](https://github.com/Dolibarr/dolibarr) - ### Sponsors Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)] From 449f4bb4a4a0d3e752ecc1460d0f40f9176c298e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 21:16:09 +0100 Subject: [PATCH 14/88] clean markdown --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6410cfed0b..eb1b7955b67 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) - Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git): - git clone https://github.com/dolibarr/dolibarr -b x.y (where x.y is main version like 3.6, 9.0, ...) + `git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is main version like 3.6, 9.0, ...) - Set up your web server to use "*dolibarr/htdocs*" as root if your web server does not have an already defined directory to point to. From f101e919c899041e677f07b396a2f460e0dbff67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 21:30:47 +0100 Subject: [PATCH 15/88] The variable $out does not seem to be defined for all execution paths --- htdocs/core/class/html.form.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 23d7e88b45b..b2dd53aff58 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7663,7 +7663,8 @@ class Form { global $db, $conf, $langs, $user; - $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1'; + $out = ''; + $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1'; $sql .= ' AND entity IN (0,'.getEntity('exp_tax_cat').')'; if (!empty($excludeid)) $sql .= ' AND rowid NOT IN ('.implode(',', $excludeid).')'; $sql .= ' ORDER BY label'; @@ -7752,6 +7753,7 @@ class Form { global $db, $conf, $langs; + $out = ''; $sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range'; $sql .= ' WHERE entity = '.$conf->entity.' AND active = 1'; @@ -7789,6 +7791,7 @@ class Form { global $db, $langs; + $out = ''; $sql = 'SELECT id, code, label FROM '.MAIN_DB_PREFIX.'c_type_fees'; $sql .= ' WHERE active = 1'; From 40fa2291b104edee1ad288e187d0b6b7e2546a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 21:58:35 +0100 Subject: [PATCH 16/88] clean markdown --- htdocs/custom/README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/custom/README.md b/htdocs/custom/README.md index 3a486e5a4a8..cd44682154d 100644 --- a/htdocs/custom/README.md +++ b/htdocs/custom/README.md @@ -1,22 +1,23 @@ -# DOLIBARR ERP & CRM custom directory for external modules. +# DOLIBARR ERP & CRM custom directory for external modules This directory is dedicated to store external modules. To use it, just copy here the directory of the module into this directory. -Note: On linux or MAC systems, it is better to unzip/store the external module directory into +Note: On linux or MAC systems, it is better to unzip/store the external module directory into a different place than this directory and just adding a symbolic link here to the htdocs directory of the module. -For example on Linux OS: Get the module from the command -mkdir ~/git; cd ~/git -git clone https://git.framasoft.org/p/newmodule/newmodule.git +For example on Linux OS: Get the module from the command +`mkdir ~/git; cd ~/git` +`git clone https://git.framasoft.org/p/newmodule/newmodule.git` Then create the symbolic link -ln -fs ~/git/newmodule/htdocs /path_to_dolibarr/htdocs/custom/newmodule +`ln -fs ~/git/newmodule/htdocs /path_to_dolibarr/htdocs/custom/newmodule` WARNING !!! -Check also that the /custom directory is active by adding into dolibarr conf/conf.php file the following +Check also that the /custom directory is active by adding into dolibarr `conf/conf.php` file the following two lines, so dolibarr will also scan /custom directory to find external external modules: +```php $dolibarr_main_url_root_alt='/custom'; $dolibarr_main_document_root_alt='/path_to_dolibarr/htdocs/custom/'; - +``` From 0565e0a84fcd37cf957d31b222e1e7f4db8ac0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 5 Dec 2019 22:00:05 +0100 Subject: [PATCH 17/88] clean markdown --- htdocs/custom/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/custom/README.md b/htdocs/custom/README.md index cd44682154d..2fc3067f204 100644 --- a/htdocs/custom/README.md +++ b/htdocs/custom/README.md @@ -8,9 +8,13 @@ a different place than this directory and just adding a symbolic link here to th of the module. For example on Linux OS: Get the module from the command + `mkdir ~/git; cd ~/git` + `git clone https://git.framasoft.org/p/newmodule/newmodule.git` + Then create the symbolic link + `ln -fs ~/git/newmodule/htdocs /path_to_dolibarr/htdocs/custom/newmodule` WARNING !!! From f74e1f8fa357f85f08f1fb2cbeb32104f8c244f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 08:11:23 +0100 Subject: [PATCH 18/88] # WARNING: head commit changed in the meantime Restore file for travis --- htdocs/core/lib/images.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index c40e0c1e406..93174a7c390 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -325,7 +325,6 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) if (function_exists('exif_read_data')) { $exif = exif_read_data($fileSource); if ($exif && isset($exif['Orientation'])) { - $infoImg = getimagesize($fileSource); // Get image infos $orientation = $exif['Orientation']; @@ -531,12 +530,13 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $extImg = '.bmp'; break; } + if (! is_resource($img)) { dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); return 0; } - + $exifAngle = false; if ($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)) { switch($ort) From 93d66d821356cfd93dced73928b55033f19aad3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 08:50:26 +0100 Subject: [PATCH 19/88] Debug v11 --- htdocs/adherents/card.php | 8 +------- htdocs/comm/propal/card.php | 7 ++++--- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture/card.php | 13 ++++++------- htdocs/langs/en_US/projects.lang | 2 ++ htdocs/projet/card.php | 22 ++++++++++++++++++---- 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 455c6181552..0689672ba7c 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1072,16 +1072,10 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - //Hooks here - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit', $parameters); - } print ''; print "\n"; + dol_fiche_end(); print '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e6b1b47d0b6..cc69ecd0c6c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1475,9 +1475,10 @@ if ($action == 'create') { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; + $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { - $element = $regs [1]; - $subelement = $regs [2]; + $element = $regs[1]; + $subelement = $regs[2]; } if ($element == 'project') { @@ -1675,7 +1676,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("Project").''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">'; + print ' id).'">'; print ''; print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 8d43c54cc7c..97668dcba69 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1642,7 +1642,7 @@ if ($action == 'create' && $usercancreate) }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '; print ''; } print ''."\n"; @@ -1734,7 +1734,7 @@ if ($action == 'create' && $usercancreate) print ''; print ''.$langs->trans("Project").''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0); - print '   id).'">'.$langs->trans("AddProject").''; + print ' id).'">'; print ''; print ''; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 14a4f4bae9b..9751f667b46 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2801,7 +2801,7 @@ if ($action == 'create') }); '; } - if (!GETPOST('fac_rec', 'int')) print ' '.$langs->trans("AddThirdParty").''; + if (!GETPOST('fac_rec', 'int')) print ' '; print ''; print ''."\n"; } @@ -3008,7 +3008,7 @@ if ($action == 'create') print '
'; $tmp = ' '; $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -3016,7 +3016,7 @@ if ($action == 'create') print '
'; $tmp = ' '; $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -3025,7 +3025,7 @@ if ($action == 'create') print '
'; $tmp = ' '; $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -3114,7 +3114,7 @@ if ($action == 'create') if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = ' '; else $tmp = ' '; $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; print '
'."\n"; @@ -3211,7 +3211,6 @@ if ($action == 'create') $rwStyle = ''; } - $retained_warranty = GETPOST('retained_warranty', 'int'); $retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; print ''.$langs->trans('RetainedWarranty').''; @@ -3260,7 +3259,7 @@ if ($action == 'create') $langs->load('projects'); print ''.$langs->trans('Project').''; $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'.$langs->trans("AddProject").''; + print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; print ''; } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 39cbe6ce6a9..79b152e0bdc 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -250,6 +250,8 @@ OneLinePerUser=One line per user ServiceToUseOnLines=Service to use on lines InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project ProjectBillTimeDescription=Check if you enter timesheet on tasks of project AND you plan to generate invoice(s) from the timesheet to bill the customer of the project (do not check if you plan to create invoice that is not based on entered timesheets). +ProjectFollowOpportunity=Follow opportunity +ProjectFollowTasks=Follow tasks UsageOpportunity=Usage: Opportunity UsageTasks=Usage: Tasks UsageBillTimeShort=Usage: Bill time \ No newline at end of file diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 455a5742a68..19bedc123ff 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -554,21 +554,21 @@ if ($action == 'create' && $user->rights->projet->creer) print ''; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ' '; + print ' '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } if (empty($conf->global->PROJECT_HIDE_TASKS)) { - print ' '; + print ' '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print ' '; + print ' '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); print '
'; @@ -597,7 +597,7 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1); } else print $text; - if (!GETPOSTISSET('backtopage')) print ' '.$langs->trans("AddThirdParty").''; + if (!GETPOSTISSET('backtopage')) print ' '; print ''; } @@ -712,6 +712,20 @@ if ($action == 'create' && $user->rights->projet->creer) jQuery("#opp_status").change(function() { change_percent(); }); + + jQuery("#usage_task").change(function() { + console.log("We click on usage task "+jQuery("#usage_task").is(":checked")); + if (! jQuery("#usage_task").is(":checked")) { + jQuery("#usage_bill_time").prop("checked", false); + } + }); + + jQuery("#usage_bill_time").change(function() { + console.log("We click on usage to bill time"); + if (jQuery("#usage_bill_time").is(":checked")) { + jQuery("#usage_task").prop("checked", true); + } + }); }); '; } From cb497cb08e8acc4cf1eb190fc1958af115d1921e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 08:58:16 +0100 Subject: [PATCH 20/88] Translation --- htdocs/adherents/card.php | 2 +- htdocs/core/lib/payments.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0689672ba7c..f012ce3a571 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1763,7 +1763,7 @@ else /* - * Hotbar + * Action bar */ print '
'; diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 66b39809b29..e7a9bd51034 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -134,7 +134,7 @@ function showOnlinePaymentUrl($type, $ref) global $langs; // Load translation files required by the page - $langs->loadLangs(array('payment', 'paybox')); + $langs->loadLangs(array('payment', 'stripe')); $servicename = $langs->transnoentitiesnoconv('Online'); From a4272ab947b03145b3d9298c606d4ebba23682ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 09:20:45 +0100 Subject: [PATCH 21/88] Debug v11 --- htdocs/adherents/subscription.php | 45 ++++++++++++++++++++----------- htdocs/comm/action/card.php | 2 +- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 2e26e3709ed..3d1885799c3 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -71,7 +71,6 @@ $adht = new AdherentType($db); $extrafields->fetch_name_optionals_label($object->table_element); $errmsg = ''; -$errmsgs = array(); $defaultdelay = 1; $defaultdelayunit = 'y'; @@ -687,20 +686,19 @@ if ($rowid > 0) $subscriptionstatic = new Subscription($db); $num = $db->num_rows($result); - $i = 0; print ''."\n"; print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder); - print ''; - print ''; - print ''; - print ''; - print ''; + print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); if (!empty($conf->banque->enabled)) { - print ''; + print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); } print "\n"; @@ -708,6 +706,7 @@ if ($rowid > 0) $adh = new Adherent($db); $adht = new AdherentType($db); + $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); @@ -766,6 +765,13 @@ if ($rowid > 0) print ""; $i++; } + + if (empty($num)) { + $colspan = 6; + if (!empty($conf->banque->enabled)) $colspan++; + print ''; + } + print "
'.$langs->trans("DateCreation").''.$langs->trans("Type").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("Amount").''.$langs->trans("Account").'
'.$langs->trans("None").'
"; } else @@ -1002,7 +1008,7 @@ if ($rowid > 0) print $langs->trans("CreateDolibarrThirdParty"); print ')'; } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0); + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { $prodtmp = new Product($db); @@ -1027,7 +1033,7 @@ if ($rowid > 0) print $langs->trans("CreateDolibarrThirdParty"); print ')'; } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0); + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { $prodtmp = new Product($db); @@ -1070,9 +1076,9 @@ if ($rowid > 0) } } - print ' '; + print ''; - print ''.$langs->trans("SendAcknowledgementByMail").''; + print ''.$langs->trans("SendAcknowledgementByMail").''; print ''; if (!$object->email) { @@ -1117,11 +1123,20 @@ if ($rowid > 0) $helpcontent .= ''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; $helpcontent .= ''.$langs->trans("MailTopic").':
'."\n"; - $helpcontent .= $subjecttosend."\n"; + if ($subjecttosend) { + $helpcontent .= $subjecttosend."\n"; + } else { + $langs->load("errors"); + $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; + } $helpcontent .= "
"; $helpcontent .= ''.$langs->trans("MailText").':
'; - $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; - + if ($texttosend) { + $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; + } else { + $langs->load("errors"); + $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; + } print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); } print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 92144f50934..765502075c2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1052,7 +1052,7 @@ if ($action == 'create') $numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   '.$langs->trans("AddProject").''; + print ' '; $urloption = '?action=create'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; From 4debd71281f5e3b8df2d160b20092a94353a515d Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Fri, 6 Dec 2019 08:26:49 +0000 Subject: [PATCH 22/88] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/compta/bank/card.php | 6 +- htdocs/core/class/doleditor.class.php | 156 ++++++++++---------- htdocs/core/class/html.formticket.class.php | 18 +-- htdocs/core/lib/images.lib.php | 140 +++++++++--------- htdocs/document.php | 88 +++++------ htdocs/product/list.php | 6 +- 6 files changed, 207 insertions(+), 207 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 2ba96a2cf8d..2897eb6e5c3 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -492,11 +492,11 @@ if ($action == 'create') $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { $name = 'number'; - $sizecss = 'minwidth200'; + $sizecss = 'minwidth200'; $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { $name = 'cle_rib'; - $sizecss = 'minwidth50'; + $sizecss = 'minwidth50'; $content = $object->cle_rib; } @@ -923,7 +923,7 @@ else $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT); if (is_array($cats)) { - foreach($cats as $cat) { + foreach ($cats as $cat) { $arrayselected[] = $cat->id; } } diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index d449e7a8424..29bb1c24dce 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -28,7 +28,7 @@ */ class DolEditor { - public $tool; // Store the selected tool + public $tool; // Store the selected tool // If using fckeditor public $editor; @@ -66,55 +66,55 @@ class DolEditor */ public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0) { - global $conf,$langs; + global $conf, $langs; dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname); - if (! $rows) $rows=round($height/20); - if (! $cols) $cols=($width?round($width/6):80); - $shorttoolbarname=preg_replace('/_encoded$/', '', $toolbarname); + if (!$rows) $rows = round($height / 20); + if (!$cols) $cols = ($width ?round($width / 6) : 80); + $shorttoolbarname = preg_replace('/_encoded$/', '', $toolbarname); // Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor') - $defaulteditor='ckeditor'; - $this->tool=empty($conf->global->FCKEDITOR_EDITORNAME)?$defaulteditor:$conf->global->FCKEDITOR_EDITORNAME; - $this->uselocalbrowser=$uselocalbrowser; - $this->readonly=$readonly; + $defaulteditor = 'ckeditor'; + $this->tool = empty($conf->global->FCKEDITOR_EDITORNAME) ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME; + $this->uselocalbrowser = $uselocalbrowser; + $this->readonly = $readonly; // Check if extended editor is ok. If not we force textarea if ((empty($conf->fckeditor->enabled) && $okforextendededitor != 'ace') || empty($okforextendededitor)) $this->tool = 'textarea'; - if ($okforextendededitor === 'ace') $this->tool='ace'; + if ($okforextendededitor === 'ace') $this->tool = 'ace'; //if ($conf->dol_use_jmobile) $this->tool = 'textarea'; // ckeditor and ace seems ok with mobile // Define content and some properties if ($this->tool == 'ckeditor') { - $content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. + $content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. } if ($this->tool == 'fckeditor') { require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php'; - $content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. + $content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. $this->editor = new FCKeditor($htmlname); - $this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ; - $this->editor->Value = $content; + $this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/'; + $this->editor->Value = $content; $this->editor->Height = $height; - if (! empty($width)) $this->editor->Width = $width; - $this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js - $this->editor->Config['AutoDetectLanguage'] = 'true'; // Language of user (browser) + if (!empty($width)) $this->editor->Width = $width; + $this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js + $this->editor->Config['AutoDetectLanguage'] = 'true'; // Language of user (browser) $this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In'; $this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded; // Rem: Le forcage de ces 2 parametres ne semble pas fonctionner. // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart. // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ? - $modulepart='fckeditor'; + $modulepart = 'fckeditor'; $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='; - $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ; + $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/'; - $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false'); - $this->editor->Config['ImageBrowser']=($uselocalbrowser?'true':'false'); + $this->editor->Config['LinkBrowser'] = ($uselocalbrowser ? 'true' : 'false'); + $this->editor->Config['ImageBrowser'] = ($uselocalbrowser ? 'true' : 'false'); if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js')) { @@ -124,15 +124,15 @@ class DolEditor } // Define some properties - if (in_array($this->tool, array('textarea','ckeditor','ace'))) + if (in_array($this->tool, array('textarea', 'ckeditor', 'ace'))) { - $this->content = $content; + $this->content = $content; $this->htmlname = $htmlname; - $this->toolbarname = $shorttoolbarname; + $this->toolbarname = $shorttoolbarname; $this->toolbarstartexpanded = $toolbarstartexpanded; $this->rows = max(ROWS_3, $rows); - $this->cols = (preg_match('/%/', $cols)?$cols:max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max - $this->height = $height; + $this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max + $this->height = $height; $this->width = $width; } } @@ -152,45 +152,45 @@ class DolEditor public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '') { // phpcs:enable - global $conf,$langs; + global $conf, $langs; - $fullpage=false; + $fullpage = false; if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)) { - $disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all + $disallowAnyContent = empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all } - $found=0; - $out=''; + $found = 0; + $out = ''; if ($this->tool == 'fckeditor') // not used anymore { - $found=1; + $found = 1; $this->editor->Create(); } - if (in_array($this->tool, array('textarea','ckeditor'))) + if (in_array($this->tool, array('textarea', 'ckeditor'))) { - $found=1; + $found = 1; //$out.= ''; + $out .= ''; - if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled)) + if ($this->tool == 'ckeditor' && !empty($conf->use_javascript_ajax) && !empty($conf->fckeditor->enabled)) { - if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR', '1'); + if (!defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR', '1'); - if (! empty($conf->global->FCKEDITOR_SKIN)) { + if (!empty($conf->global->FCKEDITOR_SKIN)) { $skin = $conf->global->FCKEDITOR_SKIN; } else { $skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa } - $htmlencode_force=preg_match('/_encoded$/', $this->toolbarname)?'true':'false'; + $htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false'; - $out.= ''."\n"; - $out.= ''."\n"; + $out .= ' })'.$morejs; + $out .= '});'."\n"; + $out .= ''."\n"; } } @@ -259,19 +259,19 @@ class DolEditor // Warning: ace.js and ext-statusbar.js must be loaded by the parent page. if (preg_match('/^ace/', $this->tool)) { - $found=1; - $format=$option; + $found = 1; + $format = $option; - $out.= "\n".''."\n"; + $out .= "\n".''."\n"; if ($titlecontent) { - $out.= '
'.$titlecontent; - $out.= '   -   '.dol_escape_htmltag($langs->trans("ShowMoreLines")).'     '; - $out.= '
'; - $out.= ''."\n"; + $out .= ''."\n"; } - $out.= '
htmlname.'aceeditorid" style="'.($this->width ? 'width: '.$this->width.'px; ' : '');
+            $out .= ($this->height ? ' height: '.$this->height.'px; ' : '');
             //$out.=" min-height: 100px;";
-            $out.= '">';
-        	$out.= htmlspecialchars($this->content);
-        	$out.= '
'; - $out.= ''; + $out .= '">'; + $out .= htmlspecialchars($this->content); + $out .= ''; + $out .= ''; - $out.= ''."\n"; + $out .= ''."\n"; } if (empty($found)) { - $out.= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.'; + $out .= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.'; } if ($noprint) return $out; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index cdea1c17e01..117af9e8f19 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -376,33 +376,33 @@ class FormTicket } $out = ''; - $out .= '' . $langs->trans("MailFile") . ''; + $out .= ''.$langs->trans("MailFile").''; $out .= ''; // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript - $out .= '' . "\n"; + $out .= ''."\n"; $out .= '' . "\n"; + $out .= ''."\n"; if (count($listofpaths)) { foreach ($listofpaths as $key => $val) { - $out .= '
'; - $out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key]; + $out .= '
'; + $out .= img_mime($listofnames[$key]).' '.$listofnames[$key]; if (!$this->withfilereadonly) { - $out .= ' '; + $out .= ' '; } $out .= '
'; } } else { - $out .= $langs->trans("NoAttachedFiles") . '
'; + $out .= $langs->trans("NoAttachedFiles").'
'; } if ($this->withfile == 2) { // Can add other files - $out .= ''; + $out .= ''; $out .= ' '; - $out .= ''; + $out .= ''; } $out .= "\n"; diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 93174a7c390..69b907036c1 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -23,8 +23,8 @@ */ // Define size of logo small and mini -$maxwidthsmall=270;$maxheightsmall=150; -$maxwidthmini=128;$maxheightmini=72; +$maxwidthsmall = 270; $maxheightsmall = 150; +$maxwidthmini = 128; $maxheightmini = 72; $quality = 80; @@ -37,14 +37,14 @@ $quality = 80; */ function image_format_supported($file) { - $regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php + $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php // Case filename is not a format image $reg = array(); - if (! preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1; + if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1; // Case filename is a format image but not supported by this PHP - $imgfonction=''; + $imgfonction = ''; if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif'; if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng'; if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg'; @@ -52,10 +52,10 @@ function image_format_supported($file) if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp'; if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm'; if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm'; - if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available + if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available if ($imgfonction) { - if (! function_exists($imgfonction)) + if (!function_exists($imgfonction)) { // Fonctions de conversion non presente dans ce PHP return 0; @@ -76,21 +76,21 @@ function image_format_supported($file) */ function dol_getImageSize($file, $url = false) { - $ret=array(); + $ret = array(); if (image_format_supported($file) < 0) return $ret; $filetoread = $file; if (!$url) { - $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image + $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image } if ($filetoread) { $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image - $ret['width']=$infoImg[0]; // Largeur de l'image - $ret['height']=$infoImg[1]; // Hauteur de l'image + $ret['width'] = $infoImg[0]; // Largeur de l'image + $ret['height'] = $infoImg[1]; // Hauteur de l'image } return $ret; @@ -112,29 +112,29 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - global $conf,$langs; + global $conf, $langs; dol_syslog("dol_imageResizeOrCrop file=".$file." mode=".$mode." newWidth=".$newWidth." newHeight=".$newHeight." src_x=".$src_x." src_y=".$src_y); // Clean parameters - $file=trim($file); + $file = trim($file); // Check parameters - if (! $file) + if (!$file) { // Si le fichier n'a pas ete indique return 'Bad parameter file'; } - elseif (! file_exists($file)) + elseif (!file_exists($file)) { // Si le fichier passe en parametre n'existe pas return $langs->trans("ErrorFileNotFound", $file); } - elseif(image_format_supported($file) < 0) + elseif (image_format_supported($file) < 0) { return 'This filename '.$file.' does not seem to be an image filename.'; } - elseif(!is_numeric($newWidth) && !is_numeric($newHeight)) + elseif (!is_numeric($newWidth) && !is_numeric($newHeight)) { return 'Wrong value for parameter newWidth or newHeight'; } @@ -147,7 +147,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, return 'Both newHeight or newWidth must be defined for croping'; } - $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image + $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image $imgWidth = $infoImg[0]; // Largeur de l'image @@ -155,18 +155,18 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, if ($mode == 0) // If resize, we check parameters { - if ($newWidth <= 0) + if ($newWidth <= 0) { - $newWidth=intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio + $newWidth = intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio } if ($newHeight <= 0) { - $newHeight=intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio + $newHeight = intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio } } - $imgfonction=''; - switch($infoImg[2]) + $imgfonction = ''; + switch ($infoImg[2]) { case 1: // IMG_GIF $imgfonction = 'imagecreatefromgif'; @@ -183,7 +183,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } if ($imgfonction) { - if (! function_exists($imgfonction)) + if (!function_exists($imgfonction)) { // Fonctions de conversion non presente dans ce PHP return 'Resize not possible. This PHP does not support GD functions '.$imgfonction; @@ -191,27 +191,27 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } // Initialisation des variables selon l'extension de l'image - switch($infoImg[2]) + switch ($infoImg[2]) { case 1: // Gif $img = imagecreatefromgif($filetoread); - $extImg = '.gif'; // File name extension of image - $newquality='NU'; // Quality is not used for this format + $extImg = '.gif'; // File name extension of image + $newquality = 'NU'; // Quality is not used for this format break; case 2: // Jpg $img = imagecreatefromjpeg($filetoread); $extImg = '.jpg'; - $newquality=100; // % quality maximum + $newquality = 100; // % quality maximum break; case 3: // Png $img = imagecreatefrompng($filetoread); $extImg = '.png'; - $newquality=0; // No compression (0-9) + $newquality = 0; // No compression (0-9) break; case 4: // Bmp $img = imagecreatefromwbmp($filetoread); $extImg = '.bmp'; - $newquality='NU'; // Quality is not used for this format + $newquality = 'NU'; // Quality is not used for this format break; } @@ -239,7 +239,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } // Initialisation des variables selon l'extension de l'image - switch($infoImg[2]) + switch ($infoImg[2]) { case 1: // Gif $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF @@ -250,7 +250,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, break; case 3: // Png imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel + $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel break; case 4: // Bmp $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); @@ -260,7 +260,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg, newquality=$newquality"); //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee - imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode==0?$imgWidth:$newWidth), ($mode==0?$imgHeight:$newHeight)); // Insere l'image de base redimensionnee + imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode == 0 ? $imgWidth : $newWidth), ($mode == 0 ? $imgHeight : $newHeight)); // Insere l'image de base redimensionnee $imgThumbName = $file; @@ -269,7 +269,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, //fclose($fp); // Create image on disk - switch($infoImg[2]) + switch ($infoImg[2]) { case 1: // Gif imagegif($imgThumb, $imgThumbName); @@ -286,13 +286,13 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } // Set permissions on file - if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); + if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); // Free memory. This does not delete image. imagedestroy($img); imagedestroy($imgThumb); - clearstatcache(); // File was replaced by a modified one, so we clear file caches. + clearstatcache(); // File was replaced by a modified one, so we clear file caches. return $imgThumbName; } @@ -343,7 +343,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) break; } if ($deg) { - if($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case + if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case { imagealphablending($img, false); imagesavealpha($img, true); @@ -351,12 +351,12 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) imagealphablending($img, false); imagesavealpha($img, true); } - else{ + else { $img = imagerotate($img, $deg, 0); } } // then rewrite the rotated image back to the disk as $fileDest - if($fileDest === false){ + if ($fileDest === false) { return $img; } else @@ -365,7 +365,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) // Create image on disk $image = false; - switch($infoImg[2]) + switch ($infoImg[2]) { case IMAGETYPE_GIF: // 1 $image = imagegif($img, $fileDest); @@ -473,8 +473,8 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', //return 'Le fichier '.$file.' ne necessite pas de creation de vignette'; } - $imgfonction=''; - switch($infoImg[2]) + $imgfonction = ''; + switch ($infoImg[2]) { case IMAGETYPE_GIF: // 1 $imgfonction = 'imagecreatefromgif'; @@ -494,7 +494,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } if ($imgfonction) { - if (! function_exists($imgfonction)) + if (!function_exists($imgfonction)) { // Fonctions de conversion non presente dans ce PHP return 'Error: Creation of thumbs not possible. This PHP does not support GD function '.$imgfonction; @@ -502,12 +502,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // On cree le repertoire contenant les vignettes - $dirthumb = dirname($file).($outdir?'/'.$outdir:''); // Chemin du dossier contenant les vignettes + $dirthumb = dirname($file).($outdir ? '/'.$outdir : ''); // Chemin du dossier contenant les vignettes dol_mkdir($dirthumb); // Initialisation des variables selon l'extension de l'image - $img=null; - switch($infoImg[2]) + $img = null; + switch ($infoImg[2]) { case IMAGETYPE_GIF: // 1 $img = imagecreatefromgif($filetoread); @@ -515,7 +515,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', break; case IMAGETYPE_JPEG: // 2 $img = imagecreatefromjpeg($filetoread); - $extImg = (preg_match('/\.jpeg$/', $file)?'.jpeg':'.jpg'); // Extension de l'image + $extImg = (preg_match('/\.jpeg$/', $file) ? '.jpeg' : '.jpg'); // Extension de l'image break; case IMAGETYPE_PNG: // 3 $img = imagecreatefrompng($filetoread); @@ -571,12 +571,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', imagealphablending($rotated, false); imagesavealpha($rotated, true); } - else{ + else { $rotated = imagerotate($img, $exifAngle, 0); } // replace image with good orientation - if(!empty($rotated)){ + if (!empty($rotated)) { $img = $rotated; $imgWidth = $trueImgWidth; $imgHeight = $trueImgHeight; @@ -584,14 +584,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // Initialisation des dimensions de la vignette si elles sont superieures a l'original - if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; } - if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; } + if ($maxWidth > $imgWidth) { $maxWidth = $imgWidth; } + if ($maxHeight > $imgHeight) { $maxHeight = $imgHeight; } - $whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette - $imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original + $whFact = $maxWidth / $maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette + $imgWhFact = $imgWidth / $imgHeight; // Facteur largeur/hauteur de l'original // Fixe les dimensions de la vignette - if($whFact < $imgWhFact) + if ($whFact < $imgWhFact) { // Si largeur determinante $thumbWidth = $maxWidth; @@ -603,11 +603,11 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $thumbHeight = $maxHeight; $thumbWidth = $thumbHeight * $imgWhFact; } - $thumbHeight=round($thumbHeight); - $thumbWidth=round($thumbWidth); + $thumbHeight = round($thumbHeight); + $thumbWidth = round($thumbWidth); // Define target format - if (empty($targetformat)) $targetformat=$infoImg[2]; + if (empty($targetformat)) $targetformat = $infoImg[2]; // Create empty image if ($targetformat == IMAGETYPE_GIF) @@ -634,35 +634,35 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', // Initialisation des variables selon l'extension de l'image // $targetformat is 0 by default, in such case, we keep original extension - switch($targetformat) + switch ($targetformat) { case IMAGETYPE_GIF: // 1 $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF imagecolortransparent($imgThumb, $trans_colour); $extImgTarget = '.gif'; - $newquality='NU'; + $newquality = 'NU'; break; case IMAGETYPE_JPEG: // 2 $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); - $extImgTarget = (preg_match('/\.jpeg$/i', $file)?'.jpeg':'.jpg'); - $newquality=$quality; + $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg'); + $newquality = $quality; break; case IMAGETYPE_PNG: // 3 imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel + $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel $extImgTarget = '.png'; - $newquality=$quality-100; - $newquality=round(abs($quality-100)*9/100); + $newquality = $quality - 100; + $newquality = round(abs($quality - 100) * 9 / 100); break; case IMAGETYPE_BMP: // 6 // Not supported by PHP GD $extImgTarget = '.bmp'; - $newquality='NU'; + $newquality = 'NU'; break; case IMAGETYPE_WBMP: // 15 $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); $extImgTarget = '.bmp'; - $newquality='NU'; + $newquality = 'NU'; break; } if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour); @@ -671,10 +671,10 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee - $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse + $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse $fileName = basename($fileName); //$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file - $imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file + $imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file // Check if permission are ok @@ -682,7 +682,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', //fclose($fp); // Create image on disk - switch($targetformat) + switch ($targetformat) { case IMAGETYPE_GIF: // 1 imagegif($imgThumb, $imgThumbName); @@ -702,7 +702,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // Set permissions on file - if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); + if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); // Free memory. This does not delete image. imagedestroy($img); diff --git a/htdocs/document.php b/htdocs/document.php index f196cb9eda9..c1ed149649e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -32,24 +32,24 @@ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // For direct external download link, we don't need to load/check we are into a login session -if (isset($_GET["hashp"]) && ! defined("NOLOGIN")) +if (isset($_GET["hashp"]) && !defined("NOLOGIN")) { - if (! defined("NOLOGIN")) define("NOLOGIN", 1); - if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. - if (! defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip + if (!defined("NOLOGIN")) define("NOLOGIN", 1); + if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. + if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip } // Some value of modulepart can be used to get resources that are public so no login are required. if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) { - if (! defined("NOLOGIN")) define("NOLOGIN", 1); - if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. - if (! defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip + if (!defined("NOLOGIN")) define("NOLOGIN", 1); + if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. + if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip } /** @@ -71,30 +71,30 @@ function llxFooter() { } -require 'main.inc.php'; // Load $user and permissions +require 'main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $encoding = ''; -$action=GETPOST('action', 'alpha'); -$original_file=GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP). -$hashp=GETPOST('hashp', 'aZ09'); -$modulepart=GETPOST('modulepart', 'alpha'); -$urlsource=GETPOST('urlsource', 'alpha'); -$entity=GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; +$action = GETPOST('action', 'alpha'); +$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP). +$hashp = GETPOST('hashp', 'aZ09'); +$modulepart = GETPOST('modulepart', 'alpha'); +$urlsource = GETPOST('urlsource', 'alpha'); +$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; // Security check if (empty($modulepart) && empty($hashp)) accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1); if (empty($original_file) && empty($hashp)) accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 0, 0, 1); -if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility +if ($modulepart == 'fckeditor') $modulepart = 'medias'; // For backward compatibility -$socid=0; +$socid = 0; if ($user->socid > 0) $socid = $user->socid; // For some module part, dir may be privates -if (in_array($modulepart, array('facture_paiement','unpaid'))) +if (in_array($modulepart, array('facture_paiement', 'unpaid'))) { - if (! $user->rights->societe->client->voir || $socid) $original_file='private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user + if (!$user->rights->societe->client->voir || $socid) $original_file = 'private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user } @@ -111,27 +111,27 @@ if (in_array($modulepart, array('facture_paiement','unpaid'))) */ // If we have a hash public (hashp), we guess the original_file. -if (! empty($hashp)) +if (!empty($hashp)) { include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $ecmfile=new EcmFiles($db); + $ecmfile = new EcmFiles($db); $result = $ecmfile->fetch(0, '', '', '', $hashp); if ($result > 0) { - $tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory + $tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory // filepath can be 'users/X' or 'X/propale/PR11111' if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part. { $tmp = explode('/', $tmp[1], 2); } - $moduleparttocheck = $tmp[0]; // moduleparttocheck is first part of path + $moduleparttocheck = $tmp[0]; // moduleparttocheck is first part of path if ($modulepart) // Not required, so often not defined, for link using public hashp parameter. { if ($moduleparttocheck == $modulepart) { // We remove first level of directory - $original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir + $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir //var_dump($original_file); exit; } else @@ -142,7 +142,7 @@ if (! empty($hashp)) else { $modulepart = $moduleparttocheck; - $original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir + $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir } } else @@ -155,13 +155,13 @@ if (! empty($hashp)) // Define attachment (attachment=true to force choice popup 'open'/'save as') $attachment = true; if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; -if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha')?true:false; -if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; +if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?true:false; +if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false; // Define mime type $type = 'application/octet-stream'; -if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha'); -else $type=dol_mimetype($original_file); +if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha'); +else $type = dol_mimetype($original_file); // Security: Force to octet-stream if file is a dangerous file if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream'; @@ -169,7 +169,7 @@ if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream $original_file = str_replace("../", "/", $original_file); // Find the subdirectory name as the reference -$refname=basename(dirname($original_file)."/"); +$refname = basename(dirname($original_file)."/"); // Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); @@ -178,11 +178,11 @@ if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; -$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name +$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name -if (! empty($hashp)) +if (!empty($hashp)) { - $accessallowed = 1; // When using hashp, link is public so we force $accessallowed + $accessallowed = 1; // When using hashp, link is public so we force $accessallowed $sqlprotectagainstexternals = ''; } else @@ -195,14 +195,14 @@ else $resql = $db->query($sqlprotectagainstexternals); if ($resql) { - $num=$db->num_rows($resql); - $i=0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); if ($user->socid != $obj->fk_soc) { - $accessallowed=0; + $accessallowed = 0; break; } $i++; @@ -214,7 +214,7 @@ else // Security: // Limit access if permissions are wrong -if (! $accessallowed) +if (!$accessallowed) { accessforbidden(); } @@ -236,10 +236,10 @@ $filename = preg_replace('/\.noexe$/i', '', $filename); // Output file on browser dol_syslog("document.php download $fullpath_original_file filename=$filename content-type=$type"); -$fullpath_original_file_osencoded=dol_osencode($fullpath_original_file); // New file name encoded in OS encoding charset +$fullpath_original_file_osencoded = dol_osencode($fullpath_original_file); // New file name encoded in OS encoding charset // This test if file exists should be useless. We keep it to find bug more easily -if (! file_exists($fullpath_original_file_osencoded)) +if (!file_exists($fullpath_original_file_osencoded)) { dol_syslog("ErrorFileDoesNotExists: ".$fullpath_original_file); print "ErrorFileDoesNotExists: ".$original_file; @@ -264,8 +264,8 @@ if (!$attachment && !empty($conf->global->MAIN_USE_EXIF_ROTATION) && image_forma $readfile = !$imgres; } -if($readfile){ - header('Content-Length: ' . dol_filesize($fullpath_original_file)); +if ($readfile) { + header('Content-Length: '.dol_filesize($fullpath_original_file)); readfile($fullpath_original_file_osencoded); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 05cc5752777..9a17a754dc1 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -488,7 +488,7 @@ if ($resql) { $oldtype = $type; $params = array(); - if ($type === "") $params['forcenohideoftext']=1; + if ($type === "") $params['forcenohideoftext'] = 1; if ($type === "") { $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', 1, $params); $type = Product::TYPE_SERVICE; @@ -853,7 +853,7 @@ if ($resql) $product_static->id = $obj->rowid; $product_static->ref = $obj->ref; - $product_static->ref_fourn = $obj->ref_supplier; // deprecated + $product_static->ref_fourn = $obj->ref_supplier; // deprecated $product_static->ref_supplier = $obj->ref_supplier; $product_static->label = $obj->label; $product_static->type = $obj->fk_product_type; @@ -886,7 +886,7 @@ if ($resql) { $option = 'nobatch'; if (empty($arrayfields['stock_virtual']['checked'])) $option .= ',novirtual'; - $product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock() + $product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock() } } From 69990d96a6afafd9b40444c9e4b0be049aa1c1bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 09:53:42 +0100 Subject: [PATCH 23/88] CSS --- htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 372c4aaba90..e59d8e3f81a 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -67,7 +67,7 @@ $colorbacklinepairhover = '230,237,244'; // line hover $colorbacklinepairchecked = '230,237,244'; // line checked $colorbacklinebreak = '233,228,230'; // line break $colorbackbody = '255,255,255'; -$colortexttitlenotab = '140,80,10'; // 140,80,10 or 10,140,80 +$colortexttitlenotab = '0,103,111'; // 140,80,10 or 10,140,80 $colortexttitle = '0,0,0'; $colortext = '0,0,0'; $colortextlink = '10, 20, 100'; @@ -108,7 +108,7 @@ $badgeStatus0 = '#cbd3d3'; $badgeStatus1 = '#bc9526'; $badgeStatus2 = '#e6f0f0'; $badgeStatus3 = '#bca52b'; -$badgeStatus4 = '#277d1e'; +$badgeStatus4 = '#759580'; $badgeStatus5 = '#cad2d2'; $badgeStatus6 = '#cad2d2'; $badgeStatus7 = '#baa32b'; From 02e2b721909ddb5fb037ae07ec20539fcbbe1e05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 10:46:14 +0100 Subject: [PATCH 24/88] Use , as separator instead of / for type of third party. This reduce space used. --- htdocs/societe/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ba01b901f9f..828cb4c703b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1030,7 +1030,7 @@ while ($i < min($num, $limit)) print ' 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant + $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"'; } print '>'; @@ -1220,14 +1220,14 @@ while ($i < min($num, $limit)) } if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - if ($s) $s .= " / "; + if ($s) $s .= ", "; $companystatic->name = $langs->trans("Prospect"); $companystatic->name_alias = ''; $s .= $companystatic->getNomUrl(0, 'prospect', 0, 1); } if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) && $obj->fournisseur) { - if ($s) $s .= " / "; + if ($s) $s .= ", "; $companystatic->name = $langs->trans("Supplier"); $companystatic->name_alias = ''; $s .= $companystatic->getNomUrl(0, 'supplier', 0, 1); From eae021cd6bd26faf3530b66d768dbe0085b1f775 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 12:42:05 +0100 Subject: [PATCH 25/88] CSS --- htdocs/theme/eldy/global.inc.php | 5 +++++ htdocs/theme/md/style.css.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 91cedc4b172..d6c4d30496e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4017,6 +4017,11 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } .calendarviewcontainertr { height: 100px; } +td.cal_other_month { + opacity: 0.8; +} + + /* ============================================================================== */ /* Ajax - Liste deroulante de l'autocompletion */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 02e819496c4..08baeb664a2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4156,6 +4156,11 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } background-size: 24px auto; } +td.cal_other_month { + opacity: 0.8; +} + + /* ============================================================================== */ /* Ajax - Liste deroulante de l'autocompletion */ /* ============================================================================== */ From 6227d14cf3e501f4784e30b6e5ac23cf220465db Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 6 Dec 2019 13:48:24 +0100 Subject: [PATCH 26/88] NEW 10.0: link to template of origin in bill cards for bills created from a template --- htdocs/compta/facture/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9cb76a2f292..d320105ae2a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3817,9 +3817,14 @@ elseif ($id > 0 || ! empty($ref)) if ($object->fk_fac_rec_source > 0) { - $tmptemplate = new FactureRec($db); - $result = $tmptemplate->fetch($object->fk_fac_rec_source); - if ($result > 0) print '. '.$langs->trans("GeneratedFromTemplate", $tmptemplate->ref); + $tmptemplate = new FactureRec($db); + $result = $tmptemplate->fetch($object->fk_fac_rec_source); + if ($result > 0) { + print '. '.$langs->trans( + "GeneratedFromTemplate", + ''.$tmptemplate->ref.'' + ); + } } print ''; From 796f34628dda99fbb757f141e34966555a549593 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 17:40:22 +0100 Subject: [PATCH 27/88] Debug v11 --- htdocs/comm/remx.php | 56 ++++++++++++++++----------- htdocs/core/class/html.form.class.php | 4 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index e5f84bbec77..59c28cfb4ea 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -252,7 +252,7 @@ if ($socid > 0) print ''; print ''; - dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company'); + dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), -1, 'company'); dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); @@ -273,7 +273,7 @@ if ($socid > 0) } - print ''; + print '
'; if ($isCustomer) { // Calcul avoirs client en cours $remise_all = $remise_user = 0; @@ -342,13 +342,15 @@ if ($socid > 0) print ''; + dol_fiche_end(); + + if ($user->rights->societe->creer) { print '
'; print load_fiche_titre($langs->trans("NewGlobalDiscount"), '', ''); - print '
'; if ($isCustomer && !$isSupplier) { print ''; @@ -358,6 +360,8 @@ if ($socid > 0) print ''; } + dol_fiche_head(); + print '
'; if ($isCustomer && $isSupplier) { print ''; @@ -376,9 +380,9 @@ if ($socid > 0) print ''; print "
'.$langs->trans('DiscountType').'
"; - } - dol_fiche_end(); + dol_fiche_end(); + } if ($user->rights->societe->creer) { @@ -404,7 +408,7 @@ if ($socid > 0) /* - * Liste remises fixes client restant en cours (= liees a aucune facture ni ligne de facture) + * List remises fixes client restant en cours (= liees a aucune facture ni ligne de facture) */ print load_fiche_titre($langs->trans("DiscountStillRemaining")); @@ -511,15 +515,14 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ttc).''; } - print ''; + print ''; print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; print ''; if ($user->rights->societe->creer || $user->rights->facture->creer) { - print ''; - print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; - //print '   '; - print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; + print ''; + print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; + print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; } else print ' '; @@ -535,7 +538,9 @@ if ($socid > 0) } else { - print ''.$langs->trans("None").''; + $colspan = 8; + if (!empty($conf->multicurrency->enabled)) $colspan+=2; + print ''.$langs->trans("None").''; } $db->free($resql); print ""; @@ -551,7 +556,7 @@ if ($socid > 0) array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0); } } else @@ -672,9 +677,8 @@ if ($socid > 0) if ($user->rights->societe->creer || $user->rights->facture->creer) { print ''; - print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; - //print '   '; - print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; + print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; + print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; } else print ' '; @@ -690,7 +694,9 @@ if ($socid > 0) } else { - print ''.$langs->trans("None").''; + $colspan = 8; + if (!empty($conf->multicurrency->enabled)) $colspan+=2; + print ''.$langs->trans("None").''; } $db->free($resql); print ""; @@ -701,9 +707,9 @@ if ($socid > 0) $amount1 = price2num($showconfirminfo['amount_ttc'] / 2, 'MT'); $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); $formquestion = array( - 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), - array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), - array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') + 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), + array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), + array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); @@ -738,7 +744,7 @@ if ($socid > 0) // Discount linked to invoice lines $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; - $sql .= " rc.fk_facture_source,"; + $sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,"; $sql .= " u.login, u.rowid as user_id,"; $sql .= " f.rowid as invoiceid, f.ref,"; $sql .= " fa.ref as invoice_source_ref, fa.type as type"; @@ -890,7 +896,9 @@ if ($socid > 0) } else { - print ''.$langs->trans("None").''; + $colspan = 8; + if (!empty($conf->multicurrency->enabled)) $colspan+=2; + print ''.$langs->trans("None").''; } print ""; @@ -1064,7 +1072,9 @@ if ($socid > 0) } else { - print ''.$langs->trans("None").''; + $colspan = 8; + if (!empty($conf->multicurrency->enabled)) $colspan+=2; + print ''.$langs->trans("None").''; } print ""; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 23d7e88b45b..57b29e78647 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4117,7 +4117,9 @@ class Form // Now add questions $more .= '
'."\n"; - if (!empty($formquestion['text'])) $more .= ''.$formquestion['text'].''."\n"; + if (!empty($formquestion['text'])) { + $more .= '
'.$formquestion['text'].'
'."\n"; + } foreach ($formquestion as $key => $input) { if (is_array($input) && !empty($input)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 59037d18525..6306162af34 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3081,7 +3081,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap', 'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar', - 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork', + 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-branch', 'object_list'=>'list-alt', 'object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt' diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index e59d8e3f81a..5f7c8f60233 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -108,7 +108,7 @@ $badgeStatus0 = '#cbd3d3'; $badgeStatus1 = '#bc9526'; $badgeStatus2 = '#e6f0f0'; $badgeStatus3 = '#bca52b'; -$badgeStatus4 = '#759580'; +$badgeStatus4 = '#55a590'; $badgeStatus5 = '#cad2d2'; $badgeStatus6 = '#cad2d2'; $badgeStatus7 = '#baa32b'; From 4d489f64b0999c5dff91ae9772d6f5d5ad7a4a96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 17:42:09 +0100 Subject: [PATCH 28/88] Fix getpost --- htdocs/comm/remx.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 59c28cfb4ea..70f9846bd6b 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -61,9 +61,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) - $amount_ttc_1 = GETPOST('amount_ttc_1'); + $amount_ttc_1 = GETPOST('amount_ttc_1', 'alpha'); $amount_ttc_1 = price2num($amount_ttc_1); - $amount_ttc_2 = GETPOST('amount_ttc_2'); + $amount_ttc_2 = GETPOST('amount_ttc_2', 'alpha'); $amount_ttc_2 = price2num($amount_ttc_2); $error = 0; From 6366a2a60656b16bbbd508af41d2a68f11906d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 6 Dec 2019 18:05:16 +0100 Subject: [PATCH 29/88] doxygen --- htdocs/user/class/user.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f2f6bc00d1f..ffb8c15e3c3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1800,10 +1800,10 @@ class User extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Mise a jour en base de la date de derniere connexion d'un utilisateur - * Fonction appelee lors d'une nouvelle connexion + * Mise a jour en base de la date de derniere connexion d'un utilisateur + * Fonction appelee lors d'une nouvelle connexion * - * @return <0 si echec, >=0 si ok + * @return int <0 si echec, >=0 si ok */ public function update_last_login_date() { @@ -2267,7 +2267,6 @@ class User extends CommonObject } else { - $this->error = $interface->error; dol_syslog(get_class($this)."::RemoveFromGroup ".$this->error, LOG_ERR); $this->db->rollback(); return -2; From ed4f04f90a8dab5371e1aa2c656e9457c8d4bcff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Dec 2019 18:41:22 +0100 Subject: [PATCH 30/88] Fix a supplier ref is mandatory for import --- htdocs/core/modules/modProduct.class.php | 2 +- htdocs/core/modules/modService.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index b15bd41f9bb..db20bf3b2ff 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -594,7 +594,7 @@ class modProduct extends DolibarrModules $this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields 'sp.fk_product'=>"ProductOrService*", 'sp.fk_soc' => "Supplier*", - 'sp.ref_fourn' => 'SupplierRef', + 'sp.ref_fourn' => 'SupplierRef*', 'sp.quantity' => "QtyMin*", 'sp.tva_tx' => 'VATRate', 'sp.default_vat_code' => 'VATCode', diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 379799a0ac6..4fb5cb175b0 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -563,7 +563,7 @@ class modService extends DolibarrModules $this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields 'sp.fk_product'=>"ProductOrService*", 'sp.fk_soc' => "Supplier*", - 'sp.ref_fourn' => 'SupplierRef', + 'sp.ref_fourn' => 'SupplierRef*', 'sp.quantity' => "QtyMin*", 'sp.tva_tx' => 'VATRate', 'sp.default_vat_code' => 'VATCode', From 8138fa978070fef67d817054b04ef2a99de5382f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 11:51:21 +0100 Subject: [PATCH 31/88] Missing X-Content-Type-Options: nosniff on header of website pages --- htdocs/core/lib/website.lib.php | 9 +++++++-- htdocs/core/website.inc.php | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 02c5cf8dcf7..f97c6efed1c 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -384,12 +384,13 @@ function dolWebsiteSaveContent($content) /** * Make a redirect to another container. * - * @param string $containerref Ref of container to redirect to (must be a page from website root. Example: 'mypage.php' means 'mywebsite/mypage.php'). + * @param string $containerref Ref of container to redirect to (Example: 'mypage' or 'mypage.php'). * @param string $containeraliasalt Ref of alternative aliases to redirect to. * @param int $containerid Id of container. + * @param int $permanent 0=Use temporary redirect 302, 1=Use permanent redirect 301 * @return void */ -function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0) +function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0, $permanent = 0) { global $db, $website; @@ -436,6 +437,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri if ($result > 0) { $currenturi = $_SERVER["REQUEST_URI"]; + $regtmp = array(); if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) { if ($regtmp[0] == $containerref) @@ -461,6 +463,9 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri if ($newurl) { + if ($permanent) { + header("Status: 301 Moved Permanently", false, 301); + } header("Location: ".$newurl); exit; } diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 34c011c34ca..2cc046ac818 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -61,6 +61,10 @@ if ($pageid > 0) } } +if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { + header("X-Content-Type-Options: nosniff"); +} + // A lang was forced, so we change weblangs init if (GETPOST('l', 'aZ09')) $weblangs->setDefaultLang(GETPOST('l', 'aZ09')); // A lang was forced, so we check to find if we must make a redirect on translation page From 3030a9fa2a3c68ab666d33204cfdf21ef193c196 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 13:09:55 +0100 Subject: [PATCH 32/88] Fix manifest file was saved but not enabled. --- htdocs/core/lib/website2.lib.php | 14 +++++++++++++- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_website.sql | 3 ++- htdocs/website/class/website.class.php | 8 ++++++++ htdocs/website/class/websitepage.class.php | 4 ++++ htdocs/website/index.php | 4 ++-- 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index ff83d9136aa..2b3e20f1895 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -86,7 +86,7 @@ function dolSavePageAlias($filealias, $object, $objectpage) * @param WebsitePage $objectpage Object websitepage * @return boolean True if OK */ -function dolSavePageContent($filetpl, $object, $objectpage) +function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) { global $conf; @@ -122,7 +122,19 @@ function dolSavePageContent($filetpl, $object, $objectpage) $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; + // Add translation reference (main language) + $translationof = $objectpage->fk_page; + if ($translationof) { + $tmppage = new WebsitePage($db); + $tmppage->fetch($translationof); + if ($tmppage->id > 0) { + $tplcontent .= ''."\n"; + } + } + // Add canonical reference $tplcontent .= ''."\n"; + // Add manifest.json on homepage + $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 340b3720dd7..b4d956129a7 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -539,3 +539,5 @@ ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement F ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); + +ALTER TABLE llx_website ADD COLUMN use_manifest integer; diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index b5764565a34..645343544a4 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -27,7 +27,8 @@ CREATE TABLE llx_website maincolor varchar(16), maincolorbis varchar(16), status integer DEFAULT 1, - fk_default_home integer, + fk_default_home integer, + use_manifest integer, virtualhost varchar(255), fk_user_creat integer, fk_user_modif integer, diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index de8c947512d..f45298e082a 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -96,6 +96,11 @@ class Website extends CommonObject */ public $virtualhost; + /** + * @var int + */ + public $use_manifest; + /** * List of containers * @@ -237,6 +242,7 @@ class Website extends CommonObject $sql .= " t.description,"; $sql .= " t.status,"; $sql .= " t.fk_default_home,"; + $sql .= " t.use_manifest,"; $sql .= " t.virtualhost,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif,"; @@ -264,6 +270,7 @@ class Website extends CommonObject $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; $this->virtualhost = $obj->virtualhost; + $this->use_manifest = $obj->use_manifest; $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; $this->date_creation = $this->db->jdate($obj->date_creation); @@ -425,6 +432,7 @@ class Website extends CommonObject $sql .= ' description = '.(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").','; $sql .= ' status = '.(isset($this->status) ? $this->status : "null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0) ? $this->fk_default_home : "null").','; + $sql .= ' use_manifest = '.((int) $this->use_manifest).','; $sql .= ' virtualhost = '.(($this->virtualhost != '') ? "'".$this->db->escape($this->virtualhost)."'" : "null").','; $sql .= ' fk_user_modif = '.(!isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).','; $sql .= ' date_creation = '.(!isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index b6371c14df7..abdb8d323eb 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -74,6 +74,10 @@ class WebsitePage extends CommonObject * @var string keywords */ public $keywords; + /** + * @var string language code ('en', 'fr', 'en-gb', ..) + */ + public $lang; public $htmlheader; public $content; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 1d94eadf626..df479f0cd36 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1059,6 +1059,7 @@ if ($action == 'updatecss') if (!$error) { $object->virtualhost = GETPOST('virtualhost', 'alpha'); + $object->use_manifest = GETPOST('use_manifest', 'alpha'); $result = $object->update($user); if ($result < 0) @@ -2738,10 +2739,9 @@ if ($action == 'editcss') $htmlhelp .= dol_htmlentitiesbr($manifestjsoncontentdefault); print $form->textwithpicto($langs->trans('WEBSITE_MANIFEST_JSON'), $htmlhelp, 1, 'help', '', 0, 2, 'manifestjsontooltip'); print ''; - + print $langs->trans("UseManifest").': '.$form->selectyesno('use_manifest', $website->use_manifest, 1).'
'; $doleditor = new DolEditor('WEBSITE_MANIFEST_JSON', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); print $doleditor->Create(1, '', true, $langs->trans("File").' manifest.json', 'text'); - print ''; // README.md From a2da98c08ae528591cbaf838771b423096167d51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 13:19:12 +0100 Subject: [PATCH 33/88] Fix $db not defined --- htdocs/core/lib/website2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 2b3e20f1895..25159253e19 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -88,7 +88,7 @@ function dolSavePageAlias($filealias, $object, $objectpage) */ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) { - global $conf; + global $conf, $db; // Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header) dol_syslog("We regenerate the tpl page filetpl=".$filetpl); From 7f23c5f74eb3aabbea3aa7dab193c39e18037ca0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 13:21:11 +0100 Subject: [PATCH 34/88] Fix link for alternate language --- htdocs/core/lib/website2.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 25159253e19..7ff7c405bec 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -128,7 +128,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tmppage = new WebsitePage($db); $tmppage->fetch($translationof); if ($tmppage->id > 0) { - $tplcontent .= ''."\n"; + $tmpshortlangcode = ''; + if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en + $tplcontent .= ''."\n"; } } // Add canonical reference From ff05150f7eaa1b837fea80daf813e3a36ba9aa2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 13:25:59 +0100 Subject: [PATCH 35/88] Fix link for alternate language --- htdocs/core/lib/website2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 7ff7c405bec..5b482e01bfd 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -130,7 +130,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) if ($tmppage->id > 0) { $tmpshortlangcode = ''; if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } } // Add canonical reference From 3f0fd9b82ad1ec3cebe174adfb0d2ca0aa212f5d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 13:36:37 +0100 Subject: [PATCH 36/88] Fix url --- htdocs/core/lib/website2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 5b482e01bfd..bb7217c8df5 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -130,7 +130,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) if ($tmppage->id > 0) { $tmpshortlangcode = ''; if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } } // Add canonical reference From f93e11468861363787a33bd22a6539daaf36904c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2019 15:37:15 +0100 Subject: [PATCH 37/88] do not trim int --- htdocs/don/class/paymentdonation.class.php | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index d38e19e62f5..5e7a2fdad6f 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -121,14 +121,14 @@ class PaymentDonation extends CommonObject } // Clean parameters - if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation); + if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation; if (isset($this->amount)) $this->amount=trim($this->amount); if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment); if (isset($this->note_public)) $this->note_public=trim($this->note_public); - if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); - if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat); - if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); + if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; + if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; $totalamount = 0; foreach ($this->amounts as $key => $value) // How payment is dispatch @@ -275,14 +275,14 @@ class PaymentDonation extends CommonObject // Clean parameters - if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation); + if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation; if (isset($this->amount)) $this->amount=trim($this->amount); if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment); if (isset($this->note_public)) $this->note_public=trim($this->note_public); - if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); - if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat); - if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); + if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; + if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; // Check parameters // Put here code to add control on parameters values @@ -306,7 +306,10 @@ class PaymentDonation extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { + $error++; + $this->errors[]="Error ".$this->db->lasterror(); + } if (! $error) { @@ -609,7 +612,7 @@ class PaymentDonation extends CommonObject public function update_fk_bank($id_bank) { // phpcs:enable - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".(int) $this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); $result = $this->db->query($sql); From f379f510fa797f53684a7001f87bbcbfa7c116d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2019 15:44:13 +0100 Subject: [PATCH 38/88] Update paymentdonation.class.php --- htdocs/don/class/paymentdonation.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 5e7a2fdad6f..22b75cd777b 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -300,7 +300,7 @@ class PaymentDonation extends CommonObject $sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").","; $sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").","; $sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null").""; - $sql.= " WHERE rowid=".$this->id; + $sql.= " WHERE rowid=".(int) $this->id; $this->db->begin(); @@ -361,7 +361,7 @@ class PaymentDonation extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; - $sql.= " WHERE type='payment_donation' AND url_id=".$this->id; + $sql.= " WHERE type='payment_donation' AND url_id=".(int) $this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); @@ -375,7 +375,10 @@ class PaymentDonation extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { + $error++; + $this->errors[]="Error ".$this->db->lasterror(); + } } if (! $error) @@ -612,7 +615,7 @@ class PaymentDonation extends CommonObject public function update_fk_bank($id_bank) { // phpcs:enable - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".(int) $this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".(int) $id_bank." WHERE rowid = ".(int) $this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); $result = $this->db->query($sql); From 0e063a3bb328ac86907f3cac15bac318a920e83c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 15:46:14 +0100 Subject: [PATCH 39/88] Fix hreflang tag (must include itself) --- htdocs/core/lib/website2.lib.php | 19 +++++++++++-------- htdocs/core/website.inc.php | 5 +++++ htdocs/main.inc.php | 2 +- htdocs/website/class/website.class.php | 12 ++++++++++++ htdocs/website/index.php | 2 +- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index bb7217c8df5..48ef724e4dc 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -123,14 +123,17 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; // Add translation reference (main language) - $translationof = $objectpage->fk_page; - if ($translationof) { - $tmppage = new WebsitePage($db); - $tmppage->fetch($translationof); - if ($tmppage->id > 0) { - $tmpshortlangcode = ''; - if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en - $tplcontent .= ''."\n"; + if ($object->isMultiLang()) { + $tplcontent .= ''."\n"; + $translationof = $objectpage->fk_page; + if ($translationof) { + $tmppage = new WebsitePage($db); + $tmppage->fetch($translationof); + if ($tmppage->id > 0) { + $tmpshortlangcode = ''; + if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en + $tplcontent .= ''."\n"; + } } } // Add canonical reference diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 2cc046ac818..fc6fa02cbec 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -63,6 +63,11 @@ if ($pageid > 0) if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { header("X-Content-Type-Options: nosniff"); + /* TODO Manage allow_frames flag on websitepage. + if (empty($websitepage->allow_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) { + header("X-Frame-Options: SAMEORIGIN"); + } + */ } // A lang was forced, so we change weblangs init diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index eae61993dd6..4824ced47db 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1137,7 +1137,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) header("X-Content-Type-Options: nosniff"); // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on) if (!defined('XFRAMEOPTIONS_ALLOWALL')) header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) else header("X-Frame-Options: ALLOWALL"); - //header("X-XSS-Protection: 1"); // XSS protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. + //header("X-XSS-Protection: 1"); // XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. if (!defined('FORCECSP')) { //if (! isset($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY)) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index f45298e082a..5c2bf40aa03 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1161,6 +1161,18 @@ class Website extends CommonObject } } + /** + * Return if web site is a multilanguage web site. Return false if there is only 0 or 1 language. + * + * @return boolean True if web site is a multilanguage web site + */ + public function isMultiLang() + { + // TODO Can edit list of languages of web site. Return false if there is only 0 or 1 language. + + return true; + } + /** * Component to select language inside a container (Full CSS Only) * diff --git a/htdocs/website/index.php b/htdocs/website/index.php index df479f0cd36..3d0d7f25871 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -25,7 +25,7 @@ define('NOSCANPOSTFORINJECTION', 1); define('NOSTYLECHECK', 1); define('USEDOLIBARREDITOR', 1); -header('X-XSS-Protection:0'); +//header('X-XSS-Protection:0'); // Disable XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; From d58a6a7d9a5f31bd6397955645ba47d89e487a4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 16:59:35 +0100 Subject: [PATCH 40/88] Fix hreflang is more complete --- htdocs/core/lib/website2.lib.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 48ef724e4dc..2ef48e94bda 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -124,7 +124,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= ''."\n"; // Add translation reference (main language) if ($object->isMultiLang()) { + // Add myself $tplcontent .= ''."\n"; + // Add page "translation of" $translationof = $objectpage->fk_page; if ($translationof) { $tmppage = new WebsitePage($db); @@ -132,9 +134,30 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) if ($tmppage->id > 0) { $tmpshortlangcode = ''; if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en - $tplcontent .= ''."\n"; + if ($tmpshortlangcode != $shortlangcode) { + $tplcontent .= ''."\n"; + } } } + // Add "has translation pages" + $sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$objectpage->id.($translationof ? ", ".$translationof : "").")"; + $resql = $db->query($sql); + if ($resql) + { + $num_rows = $db->num_rows($resql); + if ($num_rows > 0) + { + while ($obj = $db->fetch_object($resql)) + { + $tmpshortlangcode = ''; + if ($obj->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en + if ($tmpshortlangcode != $shortlangcode) { + $tplcontent .= ''."\n"; + } + } + } + } + else dol_print_error($db); } // Add canonical reference $tplcontent .= ''."\n"; From 4d3ed4ffd39ef5aa75e854ebe563908eef5ff848 Mon Sep 17 00:00:00 2001 From: ATM John BOTELLA Date: Sat, 7 Dec 2019 17:41:13 +0100 Subject: [PATCH 41/88] Fix dolGetBadge class --- htdocs/core/lib/functions.lib.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6306162af34..7530b9a7fc5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8132,7 +8132,7 @@ function roundUpToNextMultiple($n, $x = 5) function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array()) { $attr = array( - 'class'=>'badge badge-status'.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css']) + 'class'=>'badge '.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css']) ); if (empty($html)) { @@ -8153,7 +8153,15 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' // Override attr if (!empty($params['attr']) && is_array($params['attr'])) { foreach ($params['attr']as $key => $value) { - $attr[$key] = $value; + if ($key == 'class') { + $attr['class'] .= ' '.$value; + } + elseif ($key == 'classOverride') { + $attr['class'] = $value; + } + else { + $attr[$key] = $value; + } } } @@ -8260,6 +8268,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { $statusLabelShort = !empty($statusLabelShort) ? $statusLabelShort : $statusLabel; + $dolGetBadgeParams['attr']['class'] = 'badge-status'; + if ($displayMode == 3) { $return = dolGetBadge($statusLabel, '', $statusType, 'dot', $url, $dolGetBadgeParams); } From f35577d79245c4fd96651506a40af3aaeefb8215 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 19:08:40 +0100 Subject: [PATCH 42/88] Fix backtopage link --- htdocs/website/index.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3d0d7f25871..a175d6f48fd 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2445,7 +2445,7 @@ if (!GETPOST('hide_websitemenu')) { if (preg_match('/^create/', $action)) print ''; if (preg_match('/^edit/', $action)) print ''; - if ($action != 'preview') print ''; + if ($action != 'preview') print ''; } print ''; // end websitetools @@ -3343,6 +3343,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print ''.$langs->trans("Type").''; print ''.$langs->trans("Link").''; print ''.$langs->trans("Description").''; + print ''; print ''; foreach ($listofpages['list'] as $answerrecord) @@ -3357,7 +3358,20 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print $answerrecord->getNomUrl(1); print ' ('.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).')'; print ''; - print ''.$answerrecord->description; + print ''.$answerrecord->description.''; + print ''; + $param = '?action=replacesiteconfirm'; + $param .= '&optioncontent='.GETPOST('optioncontent'); + $param .= '&optionmeta='.GETPOST('optionmeta'); + $param .= '&optionsitefiles='.GETPOST('optionsitefiles'); + $param .= '&searchstring='.$searchkey; + $disabled = ''; + $urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editsource&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param); + if (empty($user->rights->website->write)) { + $disabled = ' disabled'; + $urltoedithtmlsource = ''; + } + print ''.$langs->trans("EditHTMLSource").''; print ''; print ''; } @@ -3387,6 +3401,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print ''; print ''; print ''; + print ''; print ''; } } From dbbe40ca3d5c3c9ae4b9a4047096ab416bb3e246 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Dec 2019 19:09:45 +0100 Subject: [PATCH 43/88] Fix link --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index a175d6f48fd..105b332dd63 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3371,7 +3371,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') $disabled = ' disabled'; $urltoedithtmlsource = ''; } - print ''.$langs->trans("EditHTMLSource").''; + print ''.$langs->trans("EditHTMLSource").''; print ''; print ''; } From 72c30c4101f95dde8636d7c7be4146a2889217b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2019 23:39:09 +0100 Subject: [PATCH 44/88] Update server_order.php --- htdocs/webservices/server_order.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 4f1a2bf64e2..59ccbc29df0 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -444,10 +444,10 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') 'total' => $order->total_ttc, 'project_id' => $order->fk_project, - 'date' => $order->date_commande ?dol_print_date($order->date_commande, 'dayrfc') : '', - 'date_creation' => $invoice->date_creation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', - 'date_validation' => $invoice->date_validation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', - 'date_modification' => $invoice->datem ?dol_print_date($invoice->datem, 'dayhourrfc') : '', + 'date' => $order->date ?dol_print_date($order->date, 'dayrfc') : '', + 'date_creation' => $order->date_creation ?dol_print_date($order->date_creation, 'dayhourrfc') : '', + 'date_validation' => $order->date_validation ?dol_print_date($order->date_creation, 'dayhourrfc') : '', + 'date_modification' => $order->datem ?dol_print_date($order->datem, 'dayhourrfc') : '', 'remise' => $order->remise, 'remise_percent' => $order->remise_percent, @@ -476,13 +476,15 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') else { $error++; - $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; + $errorcode = 'NOT_FOUND'; + $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } else { $error++; - $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; + $errorcode = 'PERMISSION_DENIED'; + $errorlabel = 'User does not have permission for this request'; } } @@ -552,7 +554,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty) if( $socid && ( $socid != $order->socid) ) { $error++; - $errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request'; + $errorcode='PERMISSION_DENIED'; + $errorlabel=$order->socid.' User does not have permission for this request'; } if(!$error) From 394104291a430cf3e7eda6ad99ba66f3e98f25c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Dec 2019 04:22:09 +0100 Subject: [PATCH 45/88] Fix function not found when creating a payment of an expense report --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cff0ef2b8ef..6bc3fcd0866 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1251,6 +1251,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here. { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $ret = dol_convert_file($file, 'png', $fileimage); if ($ret < 0) $error++; } From ab33bb1d3b9beedfd18083945e86a24ca874917d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 13:37:50 +0100 Subject: [PATCH 46/88] The property datem does not exist on Societe --- htdocs/societe/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a56762ce447..f0206175d0d 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -239,7 +239,7 @@ $sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur"; $sql .= ", s.code_client"; $sql .= ", s.code_fournisseur"; $sql .= ", s.logo"; -$sql .= ", s.canvas, s.tms as datem, s.status as status"; +$sql .= ", s.canvas, s.tms as date_modification, s.status as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ' WHERE s.entity IN ('.getEntity('societe').')'; @@ -279,7 +279,7 @@ if ($result) $thirdparty_static->client = $objp->client; $thirdparty_static->fournisseur = $objp->fournisseur; $thirdparty_static->logo = $objp->logo; - $thirdparty_static->datem = $db->jdate($objp->datem); + $thirdparty_static->date_modification = $db->jdate($objp->date_modification); $thirdparty_static->status = $objp->status; $thirdparty_static->code_client = $objp->code_client; $thirdparty_static->code_fournisseur = $objp->code_fournisseur; @@ -313,7 +313,7 @@ if ($result) print ''; // Last modified date print ''; - print dol_print_date($thirdparty_static->datem, 'day'); + print dol_print_date($thirdparty_static->date_modification, 'day'); print ""; print ''; print $thirdparty_static->getLibStatut(3); From f0af4504940d175312aa2b80c946f16f596f8069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 13:40:55 +0100 Subject: [PATCH 47/88] The variable $db seems to be never defined The variable $db seems to be never defined on line 154 --- htdocs/societe/canvas/actions_card_common.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index aafcd8ffc69..a76e9aa34cb 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -82,7 +82,7 @@ abstract class ActionsCardCommon public function assign_values(&$action, $id = 0, $ref = '') { // phpcs:enable - global $conf, $langs, $user, $mysoc, $canvas; + global $conf, $langs, $db, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; if ($action == 'add' || $action == 'update') $this->assign_post($action); From 48564ea760adef644fb2a353308d162a54f779a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 14:26:59 +0100 Subject: [PATCH 48/88] doxygen societe class --- htdocs/install/mysql/tables/llx_societe.sql | 18 +-- htdocs/societe/class/societe.class.php | 157 +++++++++++++++++--- 2 files changed, 148 insertions(+), 27 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index fc3100b823d..a98be7912f7 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -52,15 +52,15 @@ create table llx_societe email varchar(128), -- socialnetworks text DEFAULT NULL, -- json with socialnetworks - skype varchar(255), -- - twitter varchar(255), -- - facebook varchar(255), -- - linkedin varchar(255), -- - instagram varchar(255), -- - snapchat varchar(255), -- - googleplus varchar(255), -- - youtube varchar(255), -- - whatsapp varchar(255), -- + skype varchar(255), -- deprecated + twitter varchar(255), -- deprecated + facebook varchar(255), -- deprecated + linkedin varchar(255), -- deprecated + instagram varchar(255), -- deprecated + snapchat varchar(255), -- deprecated + googleplus varchar(255), -- deprecated + youtube varchar(255), -- deprecated + whatsapp varchar(255), -- deprecated fk_effectif integer DEFAULT 0, -- fk_typent integer DEFAULT 0, -- diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 788fc45ee7e..c2017c894c0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -59,16 +59,51 @@ class Societe extends CommonObject */ public $fk_element = 'fk_soc'; + /** + * @var string Fields for combobox + */ public $fieldsforcombobox = 'nom,name_alias'; /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables = array("supplier_proposal"=>'SupplierProposal', "propal"=>'Proposal', "commande"=>'Order', "facture"=>'Invoice', "facture_rec"=>'RecurringInvoiceTemplate', "contrat"=>'Contract', "fichinter"=>'Fichinter', "facture_fourn"=>'SupplierInvoice', "commande_fournisseur"=>'SupplierOrder', "projet"=>'Project', "expedition"=>'Shipment', "prelevement_lignes"=>'DirectDebitRecord'); + protected $childtables = array( + "supplier_proposal" => 'SupplierProposal', + "propal" => 'Proposal', + "commande" => 'Order', + "facture" => 'Invoice', + "facture_rec" => 'RecurringInvoiceTemplate', + "contrat" => 'Contract', + "fichinter" => 'Fichinter', + "facture_fourn" => 'SupplierInvoice', + "commande_fournisseur" => 'SupplierOrder', + "projet" => 'Project', + "expedition" => 'Shipment', + "prelevement_lignes" => 'DirectDebitRecord', + ); + /** * @var array List of child tables. To know object to delete on cascade. */ - protected $childtablesoncascade = array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); + protected $childtablesoncascade = array( + "societe_prices", + "societe_log", + "societe_address", + "product_fournisseur_price", + "product_customer_price_log", + "product_customer_price", + "socpeople", + "adherent", + "societe_account", + "societe_rib", + "societe_remise", + "societe_remise_except", + "societe_commerciaux", + "categorie", + "notify", + "notify_def", + "actioncomm", + ); /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -87,8 +122,6 @@ class Societe extends CommonObject */ public $restrictiononfksoc = 1; - - // BEGIN MODULEBUILDER PROPERTIES /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ @@ -123,7 +156,7 @@ class Societe extends CommonObject public $nom; /** - * @var string name + * @var string Thirdparty name */ public $name; @@ -133,6 +166,9 @@ class Societe extends CommonObject */ public $name_alias; + /** + * @var int Physical thirdparty not a company + */ public $particulier; /** @@ -140,7 +176,14 @@ class Societe extends CommonObject */ public $address; + /** + * @var string Zip code of thirdparty + */ public $zip; + + /** + * @var string Town of thirdparty + */ public $town; /** @@ -154,7 +197,15 @@ class Societe extends CommonObject * @var int */ public $state_id; + + /** + * @var string State code + */ public $state_code; + + /** + * @var string State name + */ public $state; /** @@ -162,11 +213,14 @@ class Societe extends CommonObject * @var int */ public $region_code; + + /** + * @var string Region name + */ public $region; /** - * State code - * @var string + * @var string State code * @deprecated Use state_code instead * @see $state_code */ @@ -220,25 +274,27 @@ class Societe extends CommonObject * @deprecated */ public $twitter; + /** * Facebook username * @var string * @deprecated */ public $facebook; + /** * LinkedIn username * @var string * @deprecated */ - public $linkedin; + public $linkedin; + /** * Webpage * @var string */ public $url; - //! barcode /** * Barcode value * @var string @@ -283,9 +339,16 @@ class Societe extends CommonObject */ public $idprof6; + /** + * @var string Prefix comm + */ public $prefix_comm; + /** + * @var int Vat concerned + */ public $tva_assuj = 1; + /** * Intracommunitary VAT ID * @var string @@ -298,8 +361,19 @@ class Societe extends CommonObject public $localtax2_assuj; public $localtax2_value; + /** + * @var string Manager + */ public $managers; + + /** + * @var float Capital + */ public $capital; + + /** + * @var int Type thirdparty + */ public $typent_id = 0; public $typent_code; public $effectif; @@ -317,6 +391,9 @@ class Societe extends CommonObject */ public $fk_prospectlevel; + /** + * @var string second name + */ public $name_bis; //Log data @@ -326,6 +403,7 @@ class Societe extends CommonObject * @var string */ public $date_modification; + /** * User that made last update * @var string @@ -351,11 +429,13 @@ class Societe extends CommonObject * @var int */ public $client = 0; + /** * 0=no prospect, 1=prospect * @var int */ public $prospect = 0; + /** * 0=no supplier, 1=supplier * @var int @@ -416,6 +496,7 @@ class Societe extends CommonObject * @var int */ public $stcomm_id; + /** * Status prospect label * @var int @@ -427,12 +508,20 @@ class Societe extends CommonObject * @var int */ public $price_level; + + /** + * @var string outstanding limit + */ public $outstanding_limit; /** - * Min order amounts + * @var string Min order amount */ public $order_min_amount; + + /** + * @var string Supplier min order amount + */ public $supplier_order_min_amount; /** @@ -440,11 +529,13 @@ class Societe extends CommonObject * @var int */ public $commercial_id; + /** * Id of parent thirdparty (if one) * @var int */ public $parent; + /** * Default language code of thirdparty (en_US, ...) * @var string @@ -456,7 +547,11 @@ class Societe extends CommonObject */ public $ref; + /** + * @var string Internal ref + */ public $ref_int; + /** * External user reference. * This is to allow external systems to store their id and make self-developed synchronizing functions easier to @@ -485,22 +580,49 @@ class Societe extends CommonObject */ public $webservices_key; + /** + * @var string Logo + */ public $logo; + + /** + * @var string logo small + */ public $logo_small; + + /** + * @var string Logo mini + */ public $logo_mini; + + /** + * @var string Logo squarred + */ public $logo_squarred; + + /** + * @var string Logo squarred small + */ public $logo_squarred_small; + + /** + * @var string Logo squarred mini + */ public $logo_squarred_mini; - public $array_options; - - // Incoterms /** - * @var int ID + * @var int ID Incoterms */ public $fk_incoterms; + /** + * @var string Incoterms Location + */ public $location_incoterms; + + /** + * @var string Incoterm label + */ public $label_incoterms; //Used into tooltip // Multicurrency @@ -509,12 +631,11 @@ class Societe extends CommonObject */ public $fk_multicurrency; + /** + * @var string Multicurrency code + */ public $multicurrency_code; - - // END MODULEBUILDER PROPERTIES - - /** * Constructor * From a6ca56a7e1eb5ae2d51d6823c9db595f68b264bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Dec 2019 15:57:51 +0100 Subject: [PATCH 49/88] Fix navigation backtopage and "save and stay" --- htdocs/website/index.php | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 105b332dd63..72fd6d0b70e 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1505,17 +1505,25 @@ if ($action == 'updatemeta') if ($result) { setEventMessages($langs->trans("Saved"), null, 'mesgs'); - //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); - //exit; + + if (!GETPOSTISSET('updateandstay')) // If we click on "Save And Stay", we do not make the redirect + { + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); + //exit; + $action = 'preview'; + } + else + { + $action = 'editmeta'; + } } else { setEventMessages('Failed to write file '.$filetpl, null, 'errors'); //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); //exit; + $action = 'preview'; } - - $action = 'preview'; } } @@ -1742,8 +1750,22 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf if ($result) { setEventMessages($langs->trans("Saved"), null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); - exit; + + if (!GETPOSTISSET('updateandstay')) // If we click on "Save And Stay", we do not make the redirect + { + if ($backtopage) { + header("Location: ".$backtopage); + exit; + } else { + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); + exit; + } + } + else + { + if ($action == 'updatesource') $action = 'editsource'; + if ($action == 'updatecontent') $action = 'editcontent'; + } } else { @@ -2154,7 +2176,7 @@ if (!GETPOST('hide_websitemenu')) if (in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesite', 'replacesiteconfirm'))) { - if ($action == 'editcss' && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print ''; + if ($action == 'editcss') print ''; if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print ''; if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print ''; if ($action != 'preview') print ''; @@ -2443,6 +2465,7 @@ if (!GETPOST('hide_websitemenu')) } if (!in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesite', 'replacesiteconfirm', 'createsite', 'createcontainer', 'createfromclone', 'createpagefromclone', 'deletesite'))) { + if ($action == 'editsource' || $action == 'editmeta') print ''; if (preg_match('/^create/', $action)) print ''; if (preg_match('/^edit/', $action)) print ''; if ($action != 'preview') print ''; @@ -3371,7 +3394,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') $disabled = ' disabled'; $urltoedithtmlsource = ''; } - print ''.$langs->trans("EditHTMLSource").''; + print ''.img_picto($langs->trans("EditHTMLSource"), 'edit').''; print ''; print ''; } From 49f22faceffe66655f5f1d2e16b5cfa4dead2793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:37:19 +0100 Subject: [PATCH 50/88] doxygen --- htdocs/compta/deplacement/class/deplacement.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 0601c62fd80..5d6221e5135 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,8 +83,16 @@ class Deplacement extends CommonObject public $fk_user; public $km; + + /** + * @var int Thirdparty id + */ public $socid; - public $statut; // 0=draft, 1=validated + + /** + * @var int Status 0=draft, 1=validated, 2=Refunded + */ + public $statut; public $extraparams=array(); public $statuts=array(); From 6c5629b5a53998e62eea297c72dfd9a40c217700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:39:33 +0100 Subject: [PATCH 51/88] Update deplacement.class.php --- htdocs/compta/deplacement/class/deplacement.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 5d6221e5135..242ae5f6211 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -82,7 +82,10 @@ class Deplacement extends CommonObject */ public $fk_user; - public $km; + /** + * @var string km value formatted + */ + public $km; /** * @var int Thirdparty id From 3db84df60e8654d8621dc44888b8fce1cdea3260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:45:10 +0100 Subject: [PATCH 52/88] Update card.php --- htdocs/compta/deplacement/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 5f469a2cef6..c121ee7836d 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if ($action == 'validate' && $user->rights->deplacement->creer) { $object->fetch($id); - if ($object->statut == 0) + if ($object->statut == Deplacement::STATUS_DRAFT) { $result = $object->setStatut(1); if ($result > 0) @@ -81,9 +81,9 @@ if ($action == 'validate' && $user->rights->deplacement->creer) elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { $object->fetch($id); - if ($object->statut == 1) + if ($object->statut == Deplacement::STATUS_VALIDATED) { - $result = $object->setStatut(2); + $result = $object->setStatut(Deplacement::STATUS_REFUNDED); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); @@ -116,14 +116,14 @@ elseif ($action == 'add' && $user->rights->deplacement->creer) { $error = 0; - $object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount - $object->type = GETPOST('type', 'alpha'); - $object->socid = GETPOST('socid', 'int'); - $object->fk_user = GETPOST('fk_user', 'int'); + $object->type = GETPOST('type', 'alpha'); + $object->socid = (int) GETPOST('socid', 'int'); + $object->fk_user = (int) GETPOST('fk_user', 'int'); $object->note_private = GETPOST('note_private', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha'); - $object->statut = 0; + $object->statut = Deplacement::STATUS_DRAFT; if (!$object->date) { @@ -178,8 +178,8 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) $object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount $object->type = GETPOST('type', 'alpha'); - $object->socid = GETPOST('socid', 'int'); - $object->fk_user = GETPOST('fk_user', 'int'); + $object->socid = (int) GETPOST('socid', 'int'); + $object->fk_user = (int) GETPOST('fk_user', 'int'); $object->note_private = GETPOST('note_private', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha'); @@ -523,7 +523,7 @@ elseif ($id) print '
'; - if ($object->statut < 2) // if not refunded + if ($object->statut < Deplacement::STATUS_REFUNDED) // if not refunded { if ($user->rights->deplacement->creer) { @@ -535,7 +535,7 @@ elseif ($id) } } - if ($object->statut == 0) // if draft + if ($object->statut == Deplacement::STATUS_DRAFT) // if draft { if ($user->rights->deplacement->creer) { @@ -547,7 +547,7 @@ elseif ($id) } } - if ($object->statut == 1) // if validated + if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated { if ($user->rights->deplacement->creer) { From c05ba624ce153471b974950baecdd3d8f2459ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:46:22 +0100 Subject: [PATCH 53/88] Update deplacement.class.php --- .../deplacement/class/deplacement.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 242ae5f6211..be46e1dfd14 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -101,6 +101,21 @@ class Deplacement extends CommonObject public $statuts=array(); public $statuts_short=array(); + /** + * Draft status + */ + const STATUS_DRAFT = 0; + + /** + * Validated status + */ + const STATUS_VALIDATED = 1; + + /** + * Refunded status + */ + const STATUS_REFUNDED = 2; + /** * Constructor * From fbb5fbae139029dacde9a0775427791b204a81b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 23:02:34 +0100 Subject: [PATCH 54/88] Update new.php --- htdocs/public/members/new.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a6e06dfb5ff..72c49b6e9fd 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -567,7 +567,7 @@ $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''.$langs->trans('Nature').' *'."\n"; + print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } From 2b5866aca2e6883971aa1a603c48d185c853858c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Dec 2019 23:45:06 +0100 Subject: [PATCH 55/88] WIP Complete module MRP --- htdocs/core/actions_addupdatedelete.inc.php | 1 + htdocs/core/class/commonobject.class.php | 4 +- .../install/mysql/migration/10.0.0-11.0.0.sql | 4 + .../mysql/tables/llx_mrp_production.sql | 2 + htdocs/langs/en_US/mrp.lang | 1 + htdocs/mrp/class/mo.class.php | 197 +++++++++++++++++- htdocs/mrp/mo_card.php | 13 +- 7 files changed, 212 insertions(+), 10 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 0d718c2abc2..f5f0f822108 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -44,6 +44,7 @@ if ($cancel) $action = ''; } + // Action to add record if ($action == 'add' && !empty($permissiontoadd)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a6084a49f7e..1508575ba37 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7317,7 +7317,7 @@ abstract class CommonObject global $conf; $queryarray = array(); - foreach ($this->fields as $field=>$info) // Loop on definition of fields + foreach ($this->fields as $field => $info) // Loop on definition of fields { // Depending on field type ('datetime', ...) if ($this->isDate($info)) @@ -7553,6 +7553,8 @@ abstract class CommonObject { $error++; $this->errors[] = $this->db->lasterror(); + } else { + $this->ref = '(PROV'.$this->id.')'; } } } diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index b4d956129a7..4bacfa9b765 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -521,6 +521,8 @@ CREATE TABLE llx_mrp_production( fk_product integer NOT NULL, fk_warehouse integer, qty integer NOT NULL DEFAULT 1, + qty_frozen smallint DEFAULT 0, + disable_stock_change smallint DEFAULT 0, batch varchar(30), role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation) fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' @@ -532,6 +534,8 @@ CREATE TABLE llx_mrp_production( import_key varchar(14) ) ENGINE=innodb; +ALTER TABLE llx_mrp_production ADD COLUMN qty_frozen smallint DEFAULT 0; +ALTER TABLE llx_mrp_production ADD COLUMN disable_stock_change smallint DEFAULT 0; ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid); ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid); diff --git a/htdocs/install/mysql/tables/llx_mrp_production.sql b/htdocs/install/mysql/tables/llx_mrp_production.sql index 275acde6aef..b05e261c65b 100644 --- a/htdocs/install/mysql/tables/llx_mrp_production.sql +++ b/htdocs/install/mysql/tables/llx_mrp_production.sql @@ -21,6 +21,8 @@ CREATE TABLE llx_mrp_production( fk_product integer NOT NULL, fk_warehouse integer, qty integer NOT NULL DEFAULT 1, + qty_frozen smallint DEFAULT 0, + disable_stock_change smallint DEFAULT 0, batch varchar(30), role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation) fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 2eb28366a55..4bed22df445 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -53,3 +53,4 @@ CreateMO=Create MO ToConsume=A consommer Manufactured=Fabriqué TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce. +ForAQuantityOf1=For a quantity to produce of 1 \ No newline at end of file diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index cf8e45b5901..982bff9d9ae 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -231,13 +231,57 @@ class Mo extends CommonObject */ public function create(User $user, $notrigger = false) { + global $conf; + + $error = 0; + $this->db->begin(); $result = $this->createCommon($user, $notrigger); + if ($result <= 0) { + $error++; + } // Insert lines in mrp_production table + if (! $error && $this->fk_bom > 0) + { + include_once DOL_DOCULENT_ROOT.'/bom/class/bom.class.php'; + $bom = new Bom($this->db); + $bom->fetch($this->fk_bom); + if ($bom->id > 0) + { + foreach($bom->lines as $line) + { + $moline = new MOLine($this->db); - if ($result > 0) { + $moline->fk_mo = $this->id; + $moline->qty = $line->qty * $this->qty * $bom->efficiency; + if ($moline->qty <= 0) { + $error++; + $this->error = "BadValueForquantityToConsume"; + break; + } + else { + $moline->fk_product = $line->fk_product; + $moline->role = 'toconsume'; + $moline->position = $line->position; + $moline->qty_frozen = $line->qty_frozen; + $moline->disable_stock_change = $line->disable_stock_change; + + $resultline = $moline->create($user); + if ($resultline <= 0) { + $error++; + $this->error = $moline->error; + $this->errors = $moline->errors; + dol_print_error($this->db, $moline->error, $moline->errors); + break; + } + } + } + } + } + + if (! $error) { $this->db->commit(); } else { $this->db->rollback(); @@ -838,8 +882,153 @@ class Mo extends CommonObject /** * Class MoLine. You can also remove this and generate a CRUD class for lines objects. */ -class MoLine +class MoLine extends CommonObjectLine { - // To complete with content of an object MoLine - // We should have a field rowid, fk_mo and position + /** + * @var string ID to identify managed object + */ + public $element = 'mrp_production'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'mrp_production'; + + /** + * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var int Does moline support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 0; + + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'fk_mo' =>array('type'=>'integer', 'label'=>'Fk mo', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'position' =>array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), + 'fk_product' =>array('type'=>'integer', 'label'=>'Fk product', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), + 'fk_warehouse' =>array('type'=>'integer', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>30), + 'qty' =>array('type'=>'integer', 'label'=>'Qty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), + 'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'), + 'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'), + 'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>140), + 'role' =>array('type'=>'varchar(10)', 'label'=>'Role', 'enabled'=>1, 'visible'=>-1, 'position'=>145), + 'fk_mrp_production' =>array('type'=>'integer', 'label'=>'Fk mrp production', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'fk_stock_movement' =>array('type'=>'integer', 'label'=>'Fk stock movement', 'enabled'=>1, 'visible'=>-1, 'position'=>155), + 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>160), + 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>165), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>170), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>175), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-1, 'position'=>180), + ); + + public $rowid; + public $fk_mo; + public $position; + public $fk_product; + public $fk_warehouse; + public $qty; + public $qty_frozen; + public $disable_stock_change; + public $batch; + public $role; + public $fk_mrp_production; + public $fk_stock_movement; + public $date_creation; + public $tms; + public $fk_user_creat; + public $fk_user_modif; + public $import_key; + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; + + // Unset fields that are disabled + foreach ($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + if (is_object($langs)) + { + foreach($this->fields as $key => $val) + { + if (is_array($val['arrayofkeyval'])) + { + foreach($val['arrayofkeyval'] as $key2 => $val2) + { + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } } diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index baa4c09725f..9534e643e0d 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -93,10 +93,13 @@ if (GETPOST('fk_bom', 'int')) { $objectbom->fetch(GETPOST('fk_bom', 'int')); - $_POST['fk_product'] = $objectbom->fk_product; - $_POST['qty'] = $objectbom->qty; - $_POST['fk_warehouse'] = $objectbom->fk_warehouse; - $_POST['note_private'] = $objectbom->note_private; + if ($action != 'add') { + // We force calling parameters if we are not in the submit of creation of MO + $_POST['fk_product'] = $objectbom->fk_product; + $_POST['qty'] = $objectbom->qty; + $_POST['fk_warehouse'] = $objectbom->fk_warehouse; + $_POST['note_private'] = $objectbom->note_private; + } } // Security check - Protection if external user @@ -279,7 +282,7 @@ if ($action == 'create') print '
'; if (GETPOST('fk_bom', 'int') > 0) { - print load_fiche_titre($langs->trans("ToConsume")); + print load_fiche_titre($langs->trans("ToConsume").' ('.$langs->trans("ForAQuantityOf1").')'); print '
'; print ''; From 9e479afff1c3a89400a7c66e21f34f0fb0edc6fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 00:06:51 +0100 Subject: [PATCH 56/88] WIP Complete module MRP --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 93 ++++++++++++++++++++++-- htdocs/mrp/mo_card.php | 7 +- htdocs/mrp/mo_production.php | 13 +++- 4 files changed, 102 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1508575ba37..aba487ab4a0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4118,7 +4118,7 @@ abstract class CommonObject $i = 0; - print "\n"; + print "\n"; foreach ($this->lines as $line) { //Line extrafield diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 982bff9d9ae..1dced508aec 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -157,32 +157,32 @@ class Mo extends CommonObject /** * @var int Name of subtable line */ - //public $table_element_line = 'mrp_moline'; + public $table_element_line = 'mo_production'; /** * @var int Field with ID of parent key if this field has a parent */ - //public $fk_element = 'fk_mo'; + public $fk_element = 'fk_mo'; /** * @var int Name of subtable class that manage subtable lines */ - //public $class_element_line = 'Moline'; + public $class_element_line = 'MoLine'; /** * @var array List of child tables. To test if we can delete object. */ - //protected $childtables=array(); + protected $childtables=array('mrp_production'); /** * @var array List of child tables. To know object to delete on cascade. */ - //protected $childtablesoncascade=array('mrp_modet'); + protected $childtablesoncascade=array('mrp_production'); /** * @var MoLine[] Array of subtable lines */ - //public $lines = array(); + public $lines = array(); @@ -252,7 +252,7 @@ class Mo extends CommonObject { foreach($bom->lines as $line) { - $moline = new MOLine($this->db); + $moline = new MoLine($this->db); $moline->fk_mo = $this->id; $moline->qty = $line->qty * $this->qty * $bom->efficiency; @@ -1007,6 +1007,85 @@ class MoLine extends CommonObjectLine return $result; } + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records = array(); + + $sql = 'SELECT '; + $sql .= $this->getFieldList(); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; + else $sql .= ' WHERE 1 = 1'; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key == 't.rowid') { + $sqlwhere[] = $key.'='.$value; + } + elseif (strpos($key, 'date') !== false) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } + elseif ($key == 'customsql') { + $sqlwhere[] = $value; + } + else { + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' '.$this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < min($limit, $num)) + { + $obj = $this->db->fetch_object($resql); + + $record = new self($this->db); + $record->setVarsFromFetchObj($obj); + + $records[$record->id] = $record; + + $i++; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); + + return -1; + } + } + /** * Update object into database * diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 9534e643e0d..f22c42140f5 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -504,9 +504,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; + + print ''; } - if (!empty($object->lines)) + /*if (!empty($object->lines)) { $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/mrp/tpl'); } @@ -522,7 +524,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook } - } + } */ if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { @@ -530,6 +532,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; + print "\n"; } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 28800d23bd2..931a6253510 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -326,13 +326,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } + $object->fetchLines(); + print '
'; if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print '
TODO...
'; + print '
'; + + print ''; + + //var_dump($object->lines); + } - if (!empty($object->lines)) + /*if (!empty($object->lines)) { $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/mrp/tpl'); } @@ -348,7 +355,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook } - } + }*/ if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { From d0f90de33cb7c2e35a8134ad6fea758295b6f24b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 00:27:54 +0100 Subject: [PATCH 57/88] css --- htdocs/theme/eldy/global.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d6c4d30496e..129e3dee727 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1521,6 +1521,7 @@ div#id-top { display:none; background: rgb(); + background-image: linear-gradient(-45deg, , rgb()); } From 2ca5a4378b46ab786ec1762d2fea642195e97b24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 00:54:42 +0100 Subject: [PATCH 58/88] Fix empty div when no address Fix deletion of MO --- htdocs/core/class/commonobject.class.php | 30 ++++++++++++++---------- htdocs/core/lib/functions.lib.php | 9 ++++--- htdocs/mrp/class/mo.class.php | 2 +- htdocs/mrp/mo_agenda.php | 7 +++--- htdocs/mrp/mo_note.php | 7 +++--- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index aba487ab4a0..544063bc4c8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -621,7 +621,7 @@ abstract class CommonObject $thirdpartyid = $object->fk_soc; } - $out = ''; + $out = ''; $outdone = 0; $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); @@ -682,7 +682,7 @@ abstract class CommonObject $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++; } - $out .= '
'; + if ($out) $out .= '
'; $outdone = 0; if (!empty($this->email)) { @@ -695,32 +695,36 @@ abstract class CommonObject $out .= dol_print_url($this->url, '_blank', 0, 1); $outdone++; } - $out .= '
'; + if (!empty($conf->socialnetworks->enabled)) { + $outsocialnetwork = ''; + if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) { foreach ($this->socialnetworks as $key => $value) { - $out .= dol_print_socialnetworks($value, $this->id, $object->id, $key); + $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key); $outdone++; } } else { - if ($this->skype) $out .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype'); + if ($this->skype) $outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype'); $outdone++; - if ($this->jabberid) $out .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber'); + if ($this->jabberid) $outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber'); $outdone++; - if ($this->twitter) $out .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter'); + if ($this->twitter) $outsocialnetwork .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter'); $outdone++; - if ($this->facebook) $out .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook'); + if ($this->facebook) $outsocialnetwork .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook'); $outdone++; - if ($this->linkedin) $out .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin'); + if ($this->linkedin) $outsocialnetwork .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin'); $outdone++; } + + if ($outsocialnetwork) { + $out .= '
'.$outsocialnetwork.'
'; + } } - $out .= '
'; - $out .= ''; - - return $out; + if ($out) return ''."\n".$out.''."\n"; + else return ''; } /** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6306162af34..1d275e0f512 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1582,9 +1582,12 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') { - $morehtmlref .= '
'; - $morehtmlref .= $object->getBannerAddress('refaddress', $object); - $morehtmlref .= '
'; + $moreaddress = $object->getBannerAddress('refaddress', $object); + if ($moreaddress) { + $morehtmlref .= '
'; + $morehtmlref .= $moreaddress; + $morehtmlref .= '
'; + } } if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) { diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 1dced508aec..0536ee41b8d 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -172,7 +172,7 @@ class Mo extends CommonObject /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables=array('mrp_production'); + protected $childtables=array(); /** * @var array List of child tables. To know object to delete on cascade. diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 5822ce0d170..669102487d5 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -136,8 +136,9 @@ if ($object->id > 0) // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
'; + $morehtmlref = ''; /* + $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); @@ -175,9 +176,9 @@ if ($object->id > 0) $morehtmlref.=''; } } - }*/ + } $morehtmlref .= '
'; - + */ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index 1a9fbe278a9..c177012a201 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -89,8 +89,9 @@ if ($id > 0 || ! empty($ref)) // ------------------------------------------------------------ $linkback = '' . $langs->trans("BackToList") . ''; - $morehtmlref='
'; + $morehtmlref = ''; /* + $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); @@ -128,9 +129,9 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=''; } } - }*/ + } $morehtmlref.='
'; - + */ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); From 39afe39016f1dcd7aa9e129233462fdd49cda644 Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Sun, 8 Dec 2019 19:29:46 -0600 Subject: [PATCH 59/88] Bugfix: Module builder missing table prefix The function rebuildObjectSql from the module builder module is missing the table prefix when adding a constraint --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index deac3de6157..b18618d4dfa 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -321,7 +321,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $tmp = explode('.', $val['foreignkey']); if (!empty($tmp[0]) && !empty($tmp[1])) { - $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".MAIN_DB_PREFIX.$tmp[0]."(".$tmp[1].");"; $texttoinsert .= "\n"; } } From 76cf54e6e7d5e18892ca731d468104bcc4e81800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2019 08:07:59 +0100 Subject: [PATCH 60/88] typo + doxygen --- htdocs/mrp/class/mo.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0536ee41b8d..195a3805c32 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -120,7 +120,15 @@ class Mo extends CommonObject public $qty; public $fk_warehouse; public $fk_soc; + + /** + * @var string public note + */ public $note_public; + + /** + * @var string private note + */ public $note_private; /** @@ -245,7 +253,7 @@ class Mo extends CommonObject // Insert lines in mrp_production table if (! $error && $this->fk_bom > 0) { - include_once DOL_DOCULENT_ROOT.'/bom/class/bom.class.php'; + include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $bom = new Bom($this->db); $bom->fetch($this->fk_bom); if ($bom->id > 0) From eb0d20b77e872156e90cff3bc90eb103365fcb8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 09:16:59 +0100 Subject: [PATCH 61/88] Fix label of country Fix div empty --- htdocs/compta/stats/byratecountry.php | 13 +++++++++---- htdocs/core/lib/functions.lib.php | 9 ++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 3416cd553a0..acd58f90217 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -257,7 +257,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT fd.tva_tx AS vatrate,"; $sql .= " fd.product_type AS product_type,"; - $sql .= " cc.label AS country,"; + $sql .= " cc.code, cc.label AS country,"; for ($i = 1; $i <= 12; $i++) { $sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$i, 'fd.total_ht', '0').") AS month".str_pad($i, 2, '0', STR_PAD_LEFT).","; } @@ -289,7 +289,10 @@ if ($modecompta == 'CREANCES-DETTES') { } else { print '
'; } - print ''; + // Country + print ''; for ($i = 0; $i < 12; $i++) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; @@ -335,7 +338,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql2 = "SELECT ffd.tva_tx AS vatrate,"; $sql2 .= " ffd.product_type AS product_type,"; - $sql2 .= " cc.label AS country,"; + $sql2 .= " cc.code, cc.label AS country,"; for ($i = 1; $i <= 12; $i++) { $sql2 .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$i, 'ffd.total_ht', '0').") AS month".str_pad($i, 2, '0', STR_PAD_LEFT).","; } @@ -368,7 +371,9 @@ if ($modecompta == 'CREANCES-DETTES') { } else { print ''; } - print ''; + print ''; for ($i = 0; $i < 12; $i++) { $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) $j -= 12; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6306162af34..1d275e0f512 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1582,9 +1582,12 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') { - $morehtmlref .= '
'; - $morehtmlref .= $object->getBannerAddress('refaddress', $object); - $morehtmlref .= '
'; + $moreaddress = $object->getBannerAddress('refaddress', $object); + if ($moreaddress) { + $morehtmlref .= '
'; + $morehtmlref .= $moreaddress; + $morehtmlref .= '
'; + } } if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) { From 652e99600a69652ae72c1e084c4fc9d86ed9d6cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 09:43:38 +0100 Subject: [PATCH 62/88] Look and feel v11 --- htdocs/admin/events.php | 2 +- htdocs/admin/perms.php | 3 +-- htdocs/admin/proxy.php | 2 +- htdocs/admin/security.php | 3 ++- htdocs/admin/security_file.php | 2 +- htdocs/conf/conf.php.example | 4 ++-- htdocs/main.inc.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index ca569b66b76..0109538f71f 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -74,7 +74,7 @@ llxHeader('', $langs->trans("Audit"), $wikihelp); //$linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); -print $langs->trans("LogEventDesc", $langs->transnoentitiesnoconv("AdminTools"), $langs->transnoentitiesnoconv("Audit"))."
\n"; +print ''.$langs->trans("LogEventDesc", $langs->transnoentitiesnoconv("AdminTools"), $langs->transnoentitiesnoconv("Audit"))."
\n"; print "
\n"; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 23fa06887a9..a9c581733a4 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -66,8 +66,7 @@ llxHeader('', $langs->trans("DefaultRights"), $wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); -print $langs->trans("DefaultRightsDesc"); -print " ".$langs->trans("OnlyActiveElementsAreShown")."

\n"; +print ''.$langs->trans("DefaultRightsDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."

\n"; $db->begin(); diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 9974e58a1f6..670e6e43b54 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -82,7 +82,7 @@ llxHeader('', $langs->trans("Proxy"), $wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); -print $langs->trans("ProxyDesc")."
\n"; +print ''.$langs->trans("ProxyDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 1760651b693..7a1f5c04dd2 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -194,6 +194,7 @@ if ($action == 'maj_pattern') /* * View */ + $form = new Form($db); $wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; @@ -201,7 +202,7 @@ llxHeader('', $langs->trans("Passwords"), $wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); -print $langs->trans("GeneratedPasswordDesc")."
\n"; +print ''.$langs->trans("GeneratedPasswordDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index aeb2ee0fe19..7b11aa3570e 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -90,7 +90,7 @@ llxHeader('', $langs->trans("Files"), $wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); -print $langs->trans("SecurityFilesDesc")."
\n"; +print ''.$langs->trans("SecurityFilesDesc")."
\n"; print "
\n"; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 84fc87d35f8..a742c5c45fd 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -250,11 +250,11 @@ $dolibarr_main_prod='0'; $dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; // $dolibarr_main_restrict_ip -// To restrict access to backoffice to some ip addresses only. +// To restrict access to backoffice to some ip addresses only. Use a comma to separate values. // Note: Pages that does not need login (like public pages, web site) are not protected with this. // Default value: '' // Examples: -// $dolibarr_main_restrict_ip='127.0.0.1, 192.168.0.1'; +// $dolibarr_main_restrict_ip='127.0.0.1, ::1, 192.168.0.1'; // $dolibarr_main_restrict_ip=''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4824ced47db..6eeb1cb8cb7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -309,7 +309,7 @@ if (!defined('NOLOGIN') && !defined('NOIPCHECK') && !empty($dolibarr_main_restri } if (!$found) { - print 'Access refused by IP protection'; + print 'Access refused by IP protection. Your detected IP is '.$_SERVER['REMOTE_ADDR']; exit; } } From 54ca37dc65845e4561fd6aa1db6b103a2816ce2f Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Mon, 9 Dec 2019 09:35:58 +0000 Subject: [PATCH 63/88] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/comm/remx.php | 8 ++++---- htdocs/core/website.inc.php | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 70f9846bd6b..272e0173980 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -539,7 +539,7 @@ if ($socid > 0) else { $colspan = 8; - if (!empty($conf->multicurrency->enabled)) $colspan+=2; + if (!empty($conf->multicurrency->enabled)) $colspan += 2; print '
'; } $db->free($resql); @@ -695,7 +695,7 @@ if ($socid > 0) else { $colspan = 8; - if (!empty($conf->multicurrency->enabled)) $colspan+=2; + if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''; } $db->free($resql); @@ -897,7 +897,7 @@ if ($socid > 0) else { $colspan = 8; - if (!empty($conf->multicurrency->enabled)) $colspan+=2; + if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''; } @@ -1073,7 +1073,7 @@ if ($socid > 0) else { $colspan = 8; - if (!empty($conf->multicurrency->enabled)) $colspan+=2; + if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''; } diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index fc6fa02cbec..b90da632fac 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -28,31 +28,31 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; // Define $website -if (! is_object($website)) +if (!is_object($website)) { - $website=new Website($db); + $website = new Website($db); $website->fetch(0, $websitekey); } // Define $weblangs -if (! is_object($weblangs)) +if (!is_object($weblangs)) { - $weblangs = dol_clone($langs); // TODO Use an object lang from a language set into $website object instead of backoffice + $weblangs = dol_clone($langs); // TODO Use an object lang from a language set into $website object instead of backoffice } // Define $websitepage if we have $websitepagefile defined -if (! $pageid && ! empty($websitepagefile)) +if (!$pageid && !empty($websitepagefile)) { $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile)); if ($pageid == 'index.php') $pageid = $website->fk_default_home; } -if (! is_object($websitepage)) +if (!is_object($websitepage)) { - $websitepage=new WebsitePage($db); + $websitepage = new WebsitePage($db); } if ($pageid > 0) { $websitepage->fetch($pageid); - if (! defined('USEDOLIBARREDITOR') && in_array($websitepage->type_container, array('menu', 'other'))) + if (!defined('USEDOLIBARREDITOR') && in_array($websitepage->type_container, array('menu', 'other'))) { $weblangs->load("website"); http_response_code(404); @@ -61,7 +61,7 @@ if ($pageid > 0) } } -if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { +if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { header("X-Content-Type-Options: nosniff"); /* TODO Manage allow_frames flag on websitepage. if (empty($websitepage->allow_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) { @@ -78,13 +78,13 @@ if ($_SERVER['PHP_SELF'] != DOL_URL_ROOT.'/website/index.php') // If we browsing //print_r(get_defined_constants(true));exit; if (GETPOST('l', 'aZ09')) { - $sql ="SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page"; - $sql.=" FROM ".MAIN_DB_PREFIX."website_page as wp"; - $sql.=" WHERE wp.fk_website = ".$website->id; - $sql.=" AND (wp.fk_page = ".$pageid." OR wp.rowid = ".$pageid; - if (is_object($websitepage) && $websitepage->fk_page > 0) $sql.=" OR wp.fk_page = ".$websitepage->fk_page." OR wp.rowid = ".$websitepage->fk_page; - $sql.=")"; - $sql.= " AND wp.lang = '".$db->escape(GETPOST('l', 'aZ09'))."'"; + $sql = "SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page"; + $sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp"; + $sql .= " WHERE wp.fk_website = ".$website->id; + $sql .= " AND (wp.fk_page = ".$pageid." OR wp.rowid = ".$pageid; + if (is_object($websitepage) && $websitepage->fk_page > 0) $sql .= " OR wp.fk_page = ".$websitepage->fk_page." OR wp.rowid = ".$websitepage->fk_page; + $sql .= ")"; + $sql .= " AND wp.lang = '".$db->escape(GETPOST('l', 'aZ09'))."'"; $resql = $db->query($sql); if ($resql) @@ -112,7 +112,7 @@ if ($_SERVER['PHP_SELF'] != DOL_URL_ROOT.'/website/index.php') // If we browsing } // Show off line message -if (! defined('USEDOLIBARREDITOR') && empty($website->status)) +if (!defined('USEDOLIBARREDITOR') && empty($website->status)) { $weblangs->load("website"); http_response_code(503); From 655574262b51e622874aeb568bdca154c710c8ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 14:01:55 +0100 Subject: [PATCH 64/88] Fix google plus --- README-FR.md | 2 -- README.md | 1 - 2 files changed, 3 deletions(-) diff --git a/README-FR.md b/README-FR.md index 382f2a670ac..3d5473b14cc 100644 --- a/README-FR.md +++ b/README-FR.md @@ -161,13 +161,11 @@ Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/CO Suivez le projet Dolibarr project sur les réseaux francophones - [Facebook](https://www.facebook.com/dolibarr.fr) -- [Google+](https://plus.google.com/+DolibarrFrance) - [Twitter](https://www.twitter.com/dolibarr_france) ou sur les réseaux anglophones - [Facebook](https://www.facebook.com/dolibarr) -- [Google+](https://plus.google.com/+DolibarrOrg) - [Twitter](https://www.twitter.com/dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) diff --git a/README.md b/README.md index eb1b7955b67..e7f1535d1e5 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,6 @@ See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) fil Follow Dolibarr project on: - [Facebook](https://www.facebook.com/dolibarr) -- [Google+](https://plus.google.com/+DolibarrOrg) - [Twitter](https://www.twitter.com/dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) From e1cf93d9a9c4a381fa90ddef4f679a7045384f83 Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 9 Dec 2019 14:44:37 +0100 Subject: [PATCH 65/88] Fix exif_read_data fatal error --- htdocs/core/lib/images.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 69b907036c1..1d1a6b8c7b9 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -323,7 +323,7 @@ function dolRotateImage($file_path) function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) { if (function_exists('exif_read_data')) { - $exif = exif_read_data($fileSource); + $exif = @exif_read_data($fileSource); if ($exif && isset($exif['Orientation'])) { $infoImg = getimagesize($fileSource); // Get image infos @@ -456,7 +456,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $ort = false; if (function_exists('exif_read_data')) { - $exif = exif_read_data($filetoread); + $exif = @exif_read_data($filetoread); if ($exif && !empty($exif['Orientation'])) { $ort = $exif['Orientation']; } From a12b2fea803b7de37fa99c03783744503ebd6bbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 15:54:14 +0100 Subject: [PATCH 66/88] Update modulebuilder.lib.php --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index b18618d4dfa..f0438cc3198 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -321,7 +321,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $tmp = explode('.', $val['foreignkey']); if (!empty($tmp[0]) && !empty($tmp[1])) { - $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".MAIN_DB_PREFIX.$tmp[0]."(".$tmp[1].");"; + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES llx_".$tmp[0]."(".$tmp[1].");"; $texttoinsert .= "\n"; } } From 8c50097012f0c3b9e4c2f0ce9478e80b0e7710d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 15:55:25 +0100 Subject: [PATCH 67/88] Update modulebuilder.lib.php --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index f0438cc3198..fe5d707b10a 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -321,7 +321,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $tmp = explode('.', $val['foreignkey']); if (!empty($tmp[0]) && !empty($tmp[1])) { - $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES llx_".$tmp[0]."(".$tmp[1].");"; + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES llx_".preg_replace('/^llx_/', '', $tmp[0])."(".$tmp[1].");"; $texttoinsert .= "\n"; } } From 89c5407e461d459143f3998ea37e7846a5bc75d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 16:18:29 +0100 Subject: [PATCH 68/88] Fix phpcs --- htdocs/mrp/mo_production.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 931a6253510..0fc427ebea1 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -336,7 +336,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; //var_dump($object->lines); - } /*if (!empty($object->lines)) From dfeca5fae82411fbc9b138e2af6c1d29d229407d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2019 17:42:38 +0100 Subject: [PATCH 69/88] Fix phpcs --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ae878e0f85d..4391c52d482 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -259,10 +259,8 @@ class pdf_azur extends ModelePDFPropales if (!$arephoto) { if ($conf->product->entity != $objphoto->entity) { - $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities - }else{ - + } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product } From 39da0bef9ec7b48b4930171f967cc8ac8b11f443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2019 23:56:46 +0100 Subject: [PATCH 70/88] Update server_order.php --- htdocs/webservices/server_order.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 59ccbc29df0..157d34652c1 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -447,7 +447,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') 'date' => $order->date ?dol_print_date($order->date, 'dayrfc') : '', 'date_creation' => $order->date_creation ?dol_print_date($order->date_creation, 'dayhourrfc') : '', 'date_validation' => $order->date_validation ?dol_print_date($order->date_creation, 'dayhourrfc') : '', - 'date_modification' => $order->datem ?dol_print_date($order->datem, 'dayhourrfc') : '', + 'date_modification' => $order->date_modification ?dol_print_date($order->date_modification, 'dayhourrfc') : '', 'remise' => $order->remise, 'remise_percent' => $order->remise_percent, @@ -531,10 +531,10 @@ function getOrdersForThirdParty($authentication, $idthirdparty) { $linesorders=array(); - $sql.='SELECT c.rowid as orderid'; - $sql.=' FROM '.MAIN_DB_PREFIX.'commande as c'; - $sql.=" WHERE c.entity = ".$conf->entity; - if ($idthirdparty != 'all' ) $sql.=" AND c.fk_soc = ".$db->escape($idthirdparty); + $sql = 'SELECT c.rowid as orderid'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c'; + $sql .= " WHERE c.entity = ".$conf->entity; + if ($idthirdparty != 'all' ) $sql .= " AND c.fk_soc = ".$db->escape($idthirdparty); $resql=$db->query($sql); @@ -677,7 +677,8 @@ function createOrder($authentication, $order) // Init and check authentication $objectresp = array(); - $errorcode = ''; $errorlabel = ''; + $errorcode = ''; + $errorlabel = ''; $error = 0; $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); @@ -820,7 +821,8 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) // Init and check authentication $objectresp=array(); - $errorcode='';$errorlabel=''; + $errorcode=''; + $errorlabel=''; $error=0; if ($authentication['entity']) $conf->entity=$authentication['entity']; $fuser=check_authentication($authentication, $error, $errorcode, $errorlabel); @@ -851,7 +853,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) $db->rollback(); $error++; $errorcode = 'KO'; - $errorlabel = $newobject->error; + $errorlabel = $order->error; } } else @@ -859,7 +861,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) $db->rollback(); $error++; $errorcode = 'KO'; - $errorlabel = $newobject->error; + $errorlabel = $order->error; } } else @@ -867,7 +869,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) $db->rollback(); $error++; $errorcode = 'KO'; - $errorlabel = $newobject->error; + $errorlabel = $order->error; } } From 5572102ae57fdc0e05528edecb429edcd3663b35 Mon Sep 17 00:00:00 2001 From: Arunas Ruksnaitis Date: Tue, 10 Dec 2019 00:30:47 +0000 Subject: [PATCH 71/88] Docker corrections --- build/docker/Dockerfile | 18 ++++++++++++------ build/docker/docker-compose.yml | 2 +- build/docker/docker-run.sh | 3 ++- build/docker/mariadb/Dockerfile | 3 +++ 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 build/docker/mariadb/Dockerfile diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 0d5918c3f4c..507170c7368 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,31 +1,37 @@ -FROM php:7.0-apache +FROM php:7.2-apache ENV HOST_USER_ID 33 ENV PHP_INI_DATE_TIMEZONE 'UTC' -RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev \ +RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++\ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-install gd \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-install ldap \ && docker-php-ext-install mysqli \ - && apt-get purge -y libjpeg-dev libldap2-dev + && docker-php-ext-install calendar \ + && docker-php-ext-configure intl \ + && docker-php-ext-install intl \ + && apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++ + +RUN mkdir /var/documents +RUN chown www-data /var/documents COPY docker-run.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-run.sh -RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug +RUN pecl install xdebug && docker-php-ext-enable xdebug RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.default_enable=0' >> /usr/local/etc/php/php.ini -RUN echo 'xdebug.remote_host=docker.for.mac.host.internal' >> /usr/local/etc/php/php.ini +RUN echo 'xdebug.remote_host=docker.host' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.profiler_enable=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> /usr/local/etc/php/php.ini - +RUN echo '172.17.0.1 docker.host' >> /etc/hosts EXPOSE 80 diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index a2017335197..3fe6125a874 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -1,5 +1,5 @@ mariadb: - image: mariadb:latest + build: mariadb environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: dolibarr diff --git a/build/docker/docker-run.sh b/build/docker/docker-run.sh index c151e1c3cab..df7272c317d 100644 --- a/build/docker/docker-run.sh +++ b/build/docker/docker-run.sh @@ -3,7 +3,8 @@ usermod -u $HOST_USER_ID www-data groupmod -g $HOST_USER_ID www-data -chown -hR www-data:www-data /var/www +chgrp -hR www-data /var/www/html +chmod g+rwx /var/www/html/conf if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini diff --git a/build/docker/mariadb/Dockerfile b/build/docker/mariadb/Dockerfile new file mode 100644 index 00000000000..a4db0f42065 --- /dev/null +++ b/build/docker/mariadb/Dockerfile @@ -0,0 +1,3 @@ +FROM mariadb:latest +# Enable comented out UTF8 charset/collation options +RUN sed '/utf8/ s/^#//' /etc/mysql/mariadb.cnf >/tmp/t && mv /tmp/t /etc/mysql/mariadb.cnf From e078bc6f83ac57e938bb47db971142ee1d7a9ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2019 08:08:56 +0100 Subject: [PATCH 72/88] doxygen --- .../fourn/class/fournisseur.facture.class.php | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7ec271c84ec..dba7392a9e4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2804,15 +2804,70 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $fk_prev_id; + /** + * VAT code + * @var string + */ + public $vat_src_code; + + /** + * VAT % + * @var float + */ public $tva_tx; + + /** + * Local tax 1 % + * @var float + */ public $localtax1_tx; + + /** + * Local tax 2 % + * @var float + */ public $localtax2_tx; + + /** + * Quantity + * @var double + */ public $qty; + + /** + * Percent of discount + * @var float + */ public $remise_percent; + + /** + * Total amount without taxes + * @var float + */ public $total_ht; + + /** + * Total amount with taxes + * @var float + */ public $total_ttc; + + /** + * Total amount of taxes + * @var float + */ public $total_tva; + + /** + * Total local tax 1 amount + * @var float + */ public $total_localtax1; + + /** + * Total local tax 2 amount + * @var float + */ public $total_localtax2; /** @@ -2820,8 +2875,24 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $fk_product; + /** + * Type of the product. 0 for product 1 for service + * @var int + */ public $product_type; + + /** + * Label of the product + * @var string + */ public $product_label; + + /** + * List of cumulative options: + * Bit 0: 0 si TVA normal - 1 si TVA NPR + * Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except) + * @var int + */ public $info_bits; /** @@ -2830,8 +2901,22 @@ class SupplierInvoiceLine extends CommonObjectLine public $fk_parent_line; public $special_code; + + /** + * @var int rank of line + */ public $rang; + + /** + * Total local tax 1 amount + * @var float + */ public $localtax1_type; + + /** + * Total local tax 2 amount + * @var float + */ public $localtax2_type; // Multicurrency From 2d97c0bb7964b14dc2ae64a693d4087b54ff5339 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2019 13:55:45 +0100 Subject: [PATCH 73/88] Try better fix for #12674 --- htdocs/compta/tva/clients.php | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index d1c0897d1e0..2c5c1dc3745 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -43,11 +43,16 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class. // Load translation files required by the page $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin")); + +$now = dol_now(); +$current_date = dol_getdate($now); +if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) $conf->global->SOCIETE_FISCAL_MONTH_START = 1; + // Date range $year = GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = $current_date['year']; $year_start = $year_current; } else { $year_current = $year; @@ -64,10 +69,27 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } else { - $date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); - if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; + if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter + $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); + $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; + } + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { + if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year + $year_start--; + } + } else { + if (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) < 6) { // If perdio started from less than 6 years, we show past year + $year_start--; + } + } + $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); + $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; + } + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); + $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; + } } } else From fe44d3a4fa6cf8a35f20e4f4354b3c30343562b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2019 14:02:03 +0100 Subject: [PATCH 74/88] FIX #12674 --- htdocs/compta/tva/clients.php | 4 ++-- htdocs/compta/tva/index.php | 31 +++++++++++++++++++++++---- htdocs/compta/tva/quadri_detail.php | 33 +++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 2c5c1dc3745..fc91c6b9877 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -60,10 +60,10 @@ if (empty($year)) } $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); -// Quarter +// Set default period if not defined if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $q = GETPOST("q"); + $q = GETPOST("q", "int"); if (empty($q)) { if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 55a340d7682..8fbf5b1b0fa 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -35,12 +35,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php'; // Load translation files required by the page $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin")); +$now = dol_now(); +$current_date = dol_getdate($now); +if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) $conf->global->SOCIETE_FISCAL_MONTH_START = 1; + // Date range $year = GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); - if ($conf->global->SOCIETE_FISCAL_MONTH_START > date('m')) $year_current--; + $year_current = $current_date['year']; $year_start = $year_current; } else { $year_current = $year; @@ -48,6 +51,7 @@ if (empty($year)) } $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); +// Set default period if not defined if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q = GETPOST("q", "int"); @@ -56,8 +60,27 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { - $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); - $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; + if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter + $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); + $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; + } + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { + if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year + $year_start--; + } + } else { + if (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) < 6) { // If perdio started from less than 6 years, we show past year + $year_start--; + } + } + $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); + $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; + } + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); + $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; + } } } else diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index db461c4e790..0309139d3d5 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -44,11 +44,15 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class. // Load translation files required by the page $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin")); +$now = dol_now(); +$current_date = dol_getdate($now); +if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) $conf->global->SOCIETE_FISCAL_MONTH_START = 1; + // Date range $year = GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = $current_date['year']; $year_start = $year_current; } else { $year_current = $year; @@ -56,7 +60,7 @@ if (empty($year)) } $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); -// Quarter +// Set default period if not defined if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q = GETPOST("q", "int"); @@ -65,10 +69,27 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { - $date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); - if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; + if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter + $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); + $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; + } + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { + if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year + $year_start--; + } + } else { + if (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) < 6) { // If perdio started from less than 6 years, we show past year + $year_start--; + } + } + $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); + $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; + } + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); + $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; + } } } else From 738526e77e84cb863e1f6c07ef8f78da69ef1f0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2019 14:04:50 +0100 Subject: [PATCH 75/88] Fix br --- htdocs/compta/tva/clients.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index fc91c6b9877..d6ed2bf054a 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -188,7 +188,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description .= '
'.$langs->trans("ThisIsAnEstimatedValue"); //$periodlink=($year_start?"".img_previous()." ".img_next()."":""); -$description .= $fsearch; +$description .= ($description ? '
' : '').$fsearch; if (!empty($conf->global->TAX_REPORT_EXTRA_REPORT)) { $description .= '
' From 4c463cdbb52e303cfba0e6beb579d18421b851ba Mon Sep 17 00:00:00 2001 From: David Date: Tue, 10 Dec 2019 16:16:33 +0100 Subject: [PATCH 76/88] FIX: propal update Update fields 'date' and 'fin_validite' --- htdocs/comm/propal/class/propal.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f654ed932b7..139b88d5dda 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1544,6 +1544,7 @@ class Propal extends CommonObject if (isset($this->note_public)) $this->note_public = trim($this->note_public); if (isset($this->modelpdf)) $this->modelpdf = trim($this->modelpdf); if (isset($this->import_key)) $this->import_key = trim($this->import_key); + if (isset($this->duree_validite)) $this->fin_validite=$this->date + ($this->duree_validite * 24 * 3600); // Check parameters // Put here code to add control on parameters values @@ -1555,7 +1556,8 @@ class Propal extends CommonObject $sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").","; $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").","; - $sql .= " datep=".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null').","; + $sql .= " datep=".(strval($this->date) != '' ? "'".$this->db->idate($this->date)."'" : 'null').","; + $sql .= " fin_validite=".(strval($this->fin_validite)!='' ? "'".$this->db->idate($this->fin_validite)."'" : 'null').","; $sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').","; $sql .= " tva=".(isset($this->total_tva) ? $this->total_tva : "null").","; $sql .= " localtax1=".(isset($this->total_localtax1) ? $this->total_localtax1 : "null").","; From 452976850f202612e88cddb4e714fb4899420e3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2019 19:18:45 +0100 Subject: [PATCH 77/88] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 139b88d5dda..17fcbfb18cd 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1544,7 +1544,7 @@ class Propal extends CommonObject if (isset($this->note_public)) $this->note_public = trim($this->note_public); if (isset($this->modelpdf)) $this->modelpdf = trim($this->modelpdf); if (isset($this->import_key)) $this->import_key = trim($this->import_key); - if (isset($this->duree_validite)) $this->fin_validite=$this->date + ($this->duree_validite * 24 * 3600); + if (! empty($this->duree_validite)) $this->fin_validite=$this->date + ($this->duree_validite * 24 * 3600); // Check parameters // Put here code to add control on parameters values From f98713efdd8ffad6564fd6761e799bd11219f8d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2019 19:20:23 +0100 Subject: [PATCH 78/88] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 17fcbfb18cd..d421e7bc344 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1557,7 +1557,7 @@ class Propal extends CommonObject $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").","; $sql .= " datep=".(strval($this->date) != '' ? "'".$this->db->idate($this->date)."'" : 'null').","; - $sql .= " fin_validite=".(strval($this->fin_validite)!='' ? "'".$this->db->idate($this->fin_validite)."'" : 'null').","; + if (! empty($this->fin_validite)) $sql .= " fin_validite=".(strval($this->fin_validite)!='' ? "'".$this->db->idate($this->fin_validite)."'" : 'null').","; $sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').","; $sql .= " tva=".(isset($this->total_tva) ? $this->total_tva : "null").","; $sql .= " localtax1=".(isset($this->total_localtax1) ? $this->total_localtax1 : "null").","; From 63b965646864a778083145e1891d767ef531b9ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Dec 2019 17:05:42 +0100 Subject: [PATCH 79/88] Fix use of currency accuracy --- htdocs/margin/agentMargins.php | 12 +++++------- htdocs/margin/customerMargins.php | 12 +++++------- htdocs/margin/productMargins.php | 27 +++++++++++++-------------- htdocs/product/price.php | 3 ++- 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index a47acb63eec..f65acb2eeda 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -223,8 +223,6 @@ if ($result) print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); print "\n"; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); - if ($num > 0) { $group_list = array(); @@ -291,13 +289,13 @@ if ($result) print '
'; print "\n"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; } } diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 149464ceb2f..d54eee43056 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -277,8 +277,6 @@ if ($result) $cumul_achat = 0; $cumul_vente = 0; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); - if ($num > 0) { while ($i < $num /*&& $i < $conf->liste_limit*/) @@ -317,13 +315,13 @@ if ($result) print "\n"; } - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; $i++; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 66f42475548..cc6f7fe0ed9 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -252,7 +252,6 @@ if ($result) $cumul_achat = 0; $cumul_vente = 0; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); if ($num > 0) { @@ -303,13 +302,13 @@ if ($result) print "\n"; //print "\n"; } - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; $i++; @@ -331,13 +330,13 @@ if ($result) else print '"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; print "
TODO...
'.$langs->trans("Service").''.$obj->country.''; + print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country; + print ''.$langs->trans("Service").''.$obj->country.''; + print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country; + print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans("None").'
TODO...
".$group_array['htmlname']."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".price(price2num($pv, 'MT'))."".price(price2num($pa, 'MT'))."".price(price2num($marge, 'MT'))."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price(price2num($marginRate, 'MT'))."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price(price2num($markRate, 'MT'))."%")."
".$companystatic->getNomUrl(1, 'margin')."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".price(price2num($pv, 'MT'))."".price(price2num($pa, 'MT'))."".price(price2num($marge, 'MT'))."".(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."
".$product_static->getNomUrl(1)."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".price(price2num($pv, 'MT'))."".price(price2num($pa, 'MT'))."".price(price2num($marge, 'MT'))."".(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."
'; print $langs->trans('TotalMargin')."".price($cumul_vente, null, null, null, null, $rounding)."".price($cumul_achat, null, null, null, null, $rounding)."".price($totalMargin, null, null, null, null, $rounding)."".price(price2num($cumul_vente, 'MT'))."".price(price2num($cumul_achat, 'MT'))."".price(price2num($totalMargin, 'MT'))."".(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."
"; @@ -358,9 +357,9 @@ $(document).ready(function() { $("div.fiche form").submit(); }); - $("#totalMargin").html("'.price($totalMargin, null, null, null, null, $rounding).'"); - $("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%").'"); - $("#markRate").html("'.(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%").'"); + $("#totalMargin").html("'.price(price2num($totalMargin, 'MT')).'"); + $("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'"); + $("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'"); }); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index c02f2149de0..c102e89898c 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1350,7 +1350,8 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print ''; print ''; - print $form->textwithpicto($langs->trans('SellingPrice').' '.$i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); + $text = $langs->trans('SellingPrice').' '.$i; + print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); print ''; // VAT From 0b73cdb7ccb8a4d9b4860cd00b9dac5cc5426d63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Dec 2019 17:14:32 +0100 Subject: [PATCH 80/88] Fix use of currency accuracy --- htdocs/core/tpl/objectline_view.tpl.php | 6 ++--- htdocs/margin/tabs/productMargins.php | 31 ++++++++++++------------ htdocs/margin/tabs/thirdpartyMargins.php | 28 ++++++++++----------- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 5b85887fc20..2c1b5085e89 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -243,8 +243,6 @@ if (!empty($line->remise_percent) && $line->special_code != 3) { $coldisplay++; } -$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); - // Fields for situation invoices if ($this->situation_cycle_ref) { @@ -263,10 +261,10 @@ if ($usemargins && ! empty($conf->margin->enabled) && empty($user->socid)) pa_ht); ?> global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> - pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?> + pa_ht == 0)?'n/a':price(price2num($line->marge_tx, 'MT')).'%'); ?> global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> - marque_tx, null, null, null, null, $rounding).'%'; ?> + marque_tx, 'MT')).'%'; ?> special_code == 3) { ?> diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index dcb15ea27db..3b53cea29d2 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -188,7 +188,6 @@ if ($id > 0 || !empty($ref)) $cumul_achat = 0; $cumul_vente = 0; $cumul_qty = 0; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); if ($num > 0) { while ($i < $num /*&& $i < $conf->liste_limit*/) { @@ -207,14 +206,14 @@ if ($id > 0 || !empty($ref)) print "".$objp->code_client."\n"; print ""; print dol_print_date($db->jdate($objp->datef), 'day').""; - print "".price($objp->selling_price, null, null, null, null, $rounding)."\n"; - print "".price($objp->buying_price, null, null, null, null, $rounding)."\n"; - print "".price($objp->qty, null, null, null, null, $rounding)."\n"; - print "".price($objp->marge, null, null, null, null, $rounding)."\n"; + print "".price(price2num($objp->selling_price, 'MT'))."\n"; + print "".price(price2num($objp->buying_price, 'MT'))."\n"; + print "".price(price2num($objp->qty, 'MT'))."\n"; + print "".price(price2num($objp->marge, 'MT'))."\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) - print "".(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."\n"; print ''.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).''; print "\n"; $i++; @@ -239,14 +238,14 @@ if ($id > 0 || !empty($ref)) } print ''; print ''.$langs->trans('TotalMargin').""; - print ''.price($cumul_vente, null, null, null, null, $rounding)."\n"; - print ''.price($cumul_achat, null, null, null, null, $rounding)."\n"; - print ''.price($cumul_qty, null, null, null, null, $rounding)."\n"; - print ''.price($totalMargin, null, null, null, null, $rounding)."\n"; + print ''.price(price2num($cumul_vente, 'MT'))."\n"; + print ''.price(price2num($cumul_achat, 'MT'))."\n"; + print ''.price(price2num($cumul_qty, 'MT'))."\n"; + print ''.price(price2num($totalMargin, 'MT'))."\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''.(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print ''.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."\n"; print ' '; print "\n"; print ""; @@ -264,9 +263,9 @@ if ($id > 0 || !empty($ref)) print ' '; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 1edd5349467..0b4ab1b2da2 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -192,8 +192,6 @@ if ($socid > 0) $cumul_achat = 0; $cumul_vente = 0; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); - if ($num > 0) { while ($i < $num /*&& $i < $conf->liste_limit*/) @@ -216,13 +214,13 @@ if ($socid > 0) print "\n"; print ""; print dol_print_date($db->jdate($objp->datef), 'day').""; - print "".price($objp->selling_price, null, null, null, null, $rounding)."\n"; - print "".price(($objp->type == 2 ? -1 : 1) * $objp->buying_price, null, null, null, null, $rounding)."\n"; - print "".$sign.price($objp->marge, null, null, null, null, $rounding)."\n"; + print "".price(price2num($objp->selling_price, 'MT'))."\n"; + print "".price(price2num(($objp->type == 2 ? -1 : 1) * $objp->buying_price, 'MT'))."\n"; + print "".$sign.price(price2num($objp->marge, 'MT'))."\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "".(($marginRate === '')?'n/a':$sign.price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($marginRate === '')?'n/a':$sign.price(price2num($marginRate, 'MT'))."%")."\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($markRate === '')?'n/a':price(price2num($markRate, 'MT'))."%")."\n"; print ''.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).''; print "\n"; $i++; @@ -248,13 +246,13 @@ if ($socid > 0) // Total print ''; print ''.$langs->trans('TotalMargin').""; - print "".price($cumul_vente, null, null, null, null, $rounding)."\n"; - print "".price($cumul_achat, null, null, null, null, $rounding)."\n"; - print "".price($totalMargin, null, null, null, null, $rounding)."\n"; + print "".price(price2num($cumul_vente, 'MT'))."\n"; + print "".price(price2num($cumul_achat, 'MT'))."\n"; + print "".price(price2num($totalMargin, 'MT'))."\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($marginRate === '')?'n/a':price(price2num($marginRate, 'MT'))."%")."\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($markRate === '')?'n/a':price(price2num($markRate, 'MT'))."%")."\n"; print ' '; print "\n"; } @@ -277,9 +275,9 @@ else print ' '; From 6f4e2e7e611cca0df6770e9018ae10ad9889e5f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Dec 2019 17:58:14 +0100 Subject: [PATCH 81/88] Fix rounding with multicurrency --- htdocs/core/lib/price.lib.php | 36 ++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index f4efd0c0ee9..d95acc75718 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -51,6 +51,7 @@ * @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default) * @param double $multicurrency_tx Currency rate (1 by default) * @param double $pu_devise Amount in currency + * @param string $multicurrency_code Value of the foreign currency if multicurrency is used ('EUR', 'USD', ...). It will be used for rounding according to currency. * @return array [ * 0=total_ht, * 1=total_vat, (main vat only) @@ -82,7 +83,7 @@ * 25=multicurrency_total_tax1 for total_ht * 26=multicurrency_total_tax2 for total_ht */ -function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = '', $progress = 100, $multicurrency_tx = 1, $pu_devise = 0) +function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = '', $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '') { global $conf,$mysoc,$db; @@ -185,7 +186,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // if there's some localtax including vat, we calculate localtaxes (we will add later) - //If input unit price is 'HT', we need to have the totals with main VAT for a correct calculation + // if input unit price is 'HT', we need to have the totals with main VAT for a correct calculation if ($price_base_type != 'TTC') { $tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)), 'MU'); @@ -367,8 +368,31 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // Multicurrency if ($multicurrency_tx != 1) { + if ($multicurrency_code) { + $savMAIN_MAX_DECIMALS_UNIT = $conf->global->MAIN_MAX_DECIMALS_UNIT; + $savMAIN_MAX_DECIMALS_TOT = $conf->global->MAIN_MAX_DECIMALS_TOT; + $savMAIN_ROUNDING_RULE_TOT = $conf->global->MAIN_ROUNDING_RULE_TOT; + + // Set parameter for currency accurency according to the value of $multicurrency_code (this is because a foreign currency may have different rounding rules) + $keyforforeignMAIN_MAX_DECIMALS_UNIT = 'MAIN_MAX_DECIMALS_UNIT_'.$multicurrency_code; + $keyforforeignMAIN_MAX_DECIMALS_TOT = 'MAIN_MAX_DECIMALS_TOT_'.$multicurrency_code; + $keyforforeignMAIN_ROUNDING_RULE_TOT = 'MAIN_ROUNDING_RULE_TOT_'.$multicurrency_code; + if (! empty($conf->global->$keyforforeignMAIN_ROUNDING_RULE_TOT)) { + $conf->global->MAIN_MAX_DECIMALS_UNIT = $keyforforeignMAIN_MAX_DECIMALS_UNIT; + $conf->global->MAIN_MAX_DECIMALS_TOT = $keyforforeignMAIN_MAX_DECIMALS_TOT; + $conf->global->MAIN_ROUNDING_RULE_TOT = $keyforforeignMAIN_ROUNDING_RULE_TOT; + } + } + // Recal function using the multicurrency price as reference price. We must set param $multicurrency_tx to 1 to avoid infinite loop. - $newresult = calcul_price_total($qty, $pu_devise, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller, $localtaxes_array, $progress, 1, 0); + $newresult = calcul_price_total($qty, $pu_devise, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller, $localtaxes_array, $progress, 1, 0, ''); + + if ($multicurrency_code) { + // Restore setup of currency accurency + $conf->global->MAIN_MAX_DECIMALS_UNIT = $savMAIN_MAX_DECIMALS_UNIT; + $conf->global->MAIN_MAX_DECIMALS_TOT = $savMAIN_MAX_DECIMALS_TOT; + $conf->global->MAIN_ROUNDING_RULE_TOT = $savMAIN_ROUNDING_RULE_TOT; + } $result[16] = $newresult[0]; $result[17] = $newresult[1]; @@ -381,12 +405,6 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result[24] = $newresult[8]; $result[25] = $newresult[9]; $result[26] = $newresult[10]; - /* - $result[16] = price2num($result[0] * $multicurrency_tx, 'MT'); - $result[17] = price2num($result[1] * $multicurrency_tx, 'MT'); - $result[18] = price2num($result[2] * $multicurrency_tx, 'MT'); - $result[19] = price2num($pu_devise, 'MU'); - */ } else { From 54543808348950edf2627af37760735ae8ec1d75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Dec 2019 19:14:41 +0100 Subject: [PATCH 82/88] CSS --- htdocs/compta/bank/bankentries_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index eeb662c6168..59a602fa706 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -93,7 +93,6 @@ $search_req_nb = GETPOST("req_nb", 'alpha'); $search_num_releve = GETPOST("search_num_releve", 'alpha'); $search_conciliated = GETPOST("search_conciliated", 'int'); $num_releve = GETPOST("num_releve", "alpha"); -$cat = GETPOST("cat"); if (empty($dateop)) $dateop = -1; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -420,6 +419,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $options = array(); $buttonreconcile = ''; +$morehtmlref = ''; if ($id > 0 || !empty($ref)) { @@ -458,9 +458,9 @@ if ($id > 0 || !empty($ref)) if ($user->rights->banque->consolidate) { $newparam = $param; $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam); - $buttonreconcile = ''.$langs->trans("Conciliate").''; + $buttonreconcile = ''.$langs->trans("Conciliate").''; } else { - $buttonreconcile = ''.$langs->trans("Conciliate").''; + $buttonreconcile = ''.$langs->trans("Conciliate").''; } } } From ce47de453e4d9388db447d2416c13db8cb8d504d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Dec 2019 10:31:08 +0100 Subject: [PATCH 83/88] Fix HTML5 --- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/admin/bank.php | 4 +-- htdocs/admin/fichinter.php | 14 +++++----- htdocs/admin/holiday.php | 14 +++++----- htdocs/admin/livraison.php | 8 +++--- htdocs/admin/mails_templates.php | 6 ++-- htdocs/admin/multicurrency.php | 10 +++---- htdocs/admin/payment.php | 4 +-- htdocs/admin/perms.php | 4 +-- htdocs/admin/prelevement.php | 10 +++---- htdocs/admin/propal.php | 10 +++---- htdocs/admin/reception_setup.php | 14 +++++----- htdocs/admin/security.php | 6 ++-- htdocs/admin/stock.php | 4 +-- htdocs/admin/supplier_invoice.php | 14 +++++----- htdocs/admin/supplier_order.php | 14 +++++----- htdocs/admin/supplier_payment.php | 14 +++++----- htdocs/admin/supplier_proposal.php | 10 +++---- htdocs/admin/ticket.php | 24 ++++++++-------- htdocs/admin/ticket_public.php | 20 ++++++------- htdocs/admin/translation.php | 6 ++-- htdocs/admin/user.php | 10 +++---- htdocs/admin/usergroup.php | 10 +++---- htdocs/admin/website.php | 2 +- htdocs/admin/workflow.php | 2 +- htdocs/api/class/api_setup.class.php | 28 +++++++++---------- htdocs/bookmarks/list.php | 6 ++-- htdocs/comm/action/list.php | 4 +-- htdocs/comm/action/pertype.php | 2 +- htdocs/comm/action/peruser.php | 2 +- htdocs/comm/action/rapport/index.php | 16 +++++------ htdocs/comm/mailing/cibles.php | 4 +-- htdocs/comm/mailing/index.php | 8 +++--- htdocs/comm/mailing/list.php | 4 +-- htdocs/comm/propal/list.php | 12 ++++---- htdocs/comm/propal/stats/index.php | 2 +- htdocs/comm/remise.php | 8 +++--- htdocs/comm/remx.php | 2 +- htdocs/commande/list.php | 10 +++---- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/commande/stats/index.php | 2 +- htdocs/compta/bank/bankentries_list.php | 8 +++--- .../compta/cashcontrol/cashcontrol_card.php | 12 ++++---- htdocs/compta/charges/index.php | 8 +++--- htdocs/compta/deplacement/list.php | 2 +- htdocs/compta/deplacement/stats/index.php | 8 +++--- htdocs/compta/facture/card.php | 8 +++--- .../compta/facture/invoicetemplate_list.php | 20 ++++++------- htdocs/compta/facture/list.php | 6 ++-- htdocs/compta/facture/prelevement.php | 18 ++++++------ htdocs/compta/facture/stats/index.php | 2 +- htdocs/compta/index.php | 4 +-- htdocs/compta/paiement.php | 8 +++--- htdocs/compta/paiement/cheque/card.php | 16 +++++------ htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/compta/paiement/tovalidate.php | 2 +- htdocs/compta/paiement_charge.php | 4 +-- htdocs/compta/payment_sc/card.php | 4 +-- htdocs/compta/prelevement/bons.php | 2 +- htdocs/compta/prelevement/create.php | 4 +-- htdocs/compta/prelevement/factures.php | 2 +- htdocs/compta/prelevement/fiche-rejet.php | 4 +-- htdocs/compta/prelevement/list.php | 2 +- htdocs/compta/prelevement/stats.php | 2 +- htdocs/compta/sociales/list.php | 2 +- htdocs/compta/sociales/payments.php | 8 +++--- htdocs/compta/stats/cabyuser.php | 2 +- htdocs/compta/stats/casoc.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/core/ajax/ajaxdirpreview.php | 2 +- htdocs/core/ajax/ajaxdirtree.php | 2 +- htdocs/core/class/html.formticket.class.php | 8 +++--- htdocs/core/lib/admin.lib.php | 4 +-- htdocs/core/lib/agenda.lib.php | 2 +- htdocs/core/lib/company.lib.php | 6 ++-- htdocs/core/lib/project.lib.php | 2 +- htdocs/core/modules/dons/html_cerfafr.html | 2 +- .../modules/printing/printgcp.modules.php | 4 +-- .../modules/printing/printipp.modules.php | 4 +-- .../societe/doc/doc_generic_odt.modules.php | 2 +- htdocs/core/search_page.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- htdocs/opensurvey/results.php | 2 +- htdocs/product/fournisseurs.php | 2 +- htdocs/product/list.php | 8 +++--- htdocs/product/stats/commande.php | 6 ++-- htdocs/product/stats/commande_fournisseur.php | 6 ++-- htdocs/product/stats/contrat.php | 6 ++-- htdocs/product/stats/facture.php | 6 ++-- htdocs/product/stats/facture_fournisseur.php | 6 ++-- htdocs/product/stats/propal.php | 4 +-- htdocs/product/stats/supplier_proposal.php | 4 +-- htdocs/public/opensurvey/studs.php | 2 +- htdocs/salaries/list.php | 2 +- htdocs/salaries/stats/index.php | 2 +- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/ticket/tpl/linkedobjectblock.tpl.php | 8 +++--- 98 files changed, 311 insertions(+), 311 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 0db4c7b6c24..758906cb19d 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -974,7 +974,7 @@ while ($i < min($num, $limit)) // Exported operation date if (! empty($arrayfields['t.date_export']['checked'])) { - print '' . dol_print_date($line->date_export, 'dayhour') . ''; + print '' . dol_print_date($line->date_export, 'dayhour') . ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 0dc682a32f8..534153a6c37 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -442,7 +442,7 @@ print $langs->trans('BankColorizeMovementDesc'); print ""; // Active if ($conf->global->BANK_COLORIZE_MOVEMENT) { - print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -450,7 +450,7 @@ if ($conf->global->BANK_COLORIZE_MOVEMENT) { } else { - print ''."\n"; + print ''."\n"; print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index b9e89450d33..413f14e02df 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -320,7 +320,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; + print ''; if ($conf->global->FICHEINTER_ADDON == $classname) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -348,7 +348,7 @@ foreach ($dirmodels as $reldir) $htmltooltip .= $langs->trans($module->error).'
'; } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; @@ -486,12 +486,12 @@ foreach ($dirmodels as $reldir) $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, -1, 0); print ''; // Preview - print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'intervention').''; @@ -587,7 +587,7 @@ print ''; print ''; print $langs->trans("UseServicesDurationOnFichinter"); print ''; -print ''; +print ''; print 'global->FICHINTER_USE_SERVICE_DURATION ? ' checked' : '').'>'; print ''; print ''; @@ -603,7 +603,7 @@ print ''; print ''; print $langs->trans("UseDurationOnFichinter"); print ''; -print ''; +print ''; print 'global->FICHINTER_WITHOUT_DURATION ? ' checked' : '').'>'; print ''; print ''; @@ -619,7 +619,7 @@ print ''; print ''; print $langs->trans("UseDateWithoutHourOnFichinter"); print ''; -print ''; +print ''; print 'global->FICHINTER_DATE_WITHOUT_HOUR ? ' checked' : '').'>'; print ''; print ''; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 5eb36b111c8..0920b656e4f 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -250,7 +250,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; + print ''; if ($conf->global->HOLIDAY_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -281,7 +281,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; @@ -397,7 +397,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -405,13 +405,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } // Default - print ''; + print ''; if ($conf->global->HOLIDAY_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -437,12 +437,12 @@ foreach ($dirmodels as $reldir) $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; // Preview - print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'contract').''; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 6d08456a470..a1f6f27883f 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -245,7 +245,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; + print ''; if ($conf->global->LIVRAISON_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; @@ -408,12 +408,12 @@ foreach ($dirmodels as $reldir) $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; // Preview - print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'sending').''; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index aa8a7e79719..47300a5530d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -571,7 +571,7 @@ foreach ($fieldsforcontent as $tmpfieldlist) } print ''; if ($tmpfieldlist == 'topic') { - print ''; + print ''; if ($action != 'edit') { print ''; } @@ -730,7 +730,7 @@ if ($resql) if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit'); print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -874,7 +874,7 @@ if ($resql) $url.='&'; // Status / Active - print ''; + print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; else print ''.$actl[$obj->active].''; print ""; diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index d6a7fb26a98..2544b9bd0ee 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -189,12 +189,12 @@ dol_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurren print ''; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; print ''; print ''; -print ''; print ''; print ''; -print ''; print ''; - print '
'.$langs->trans("Parameters").''.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE'); } else { @@ -206,7 +206,7 @@ print '
'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MULTICURRENCY_USE_ORIGIN_TX'); } else { @@ -220,7 +220,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print '
'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT'); } else { @@ -313,7 +313,7 @@ print ''; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 4fcb3c84786..0aa25d446dd 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -175,7 +175,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; print ''; print ''; - print ''; + print ''; print ''; print "\n"; } @@ -193,7 +193,7 @@ if ($result) $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle)); print ''; - print '"; } // Default - print ''; // Preview - print ''."\n"; - print ''; @@ -442,7 +442,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''; // Preview - print ''."\n"; - print ''; @@ -395,7 +395,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Defaut - print ''; // Preview - print '
'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).''.$langs->trans("Rate").''.$langs->trans("Rate").'
'; + print ''; //print "> ".$conf->global->PAYMENT_ADDON." - ".$file; if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) { @@ -205,7 +205,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); if ($conf->global->PAYMENT_ADDON.'.php' == $file) // If module is the one used, we show existing errors diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index a9c581733a4..ea8f839600d 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -178,7 +178,7 @@ if ($result) print '
'.$langs->trans("Module").''.$langs->trans("Permission").''.$langs->trans("Default").''.$langs->trans("Default").' 
'.$perm_libelle. ''; + print ''; if ($obj->bydefault == 1) { print img_picto($langs->trans("Active"), 'tick'); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 1d9b181b295..d7061def3e9 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -355,7 +355,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; @@ -363,13 +363,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print "'; + print ''; if ($conf->global->PAYMENTORDER_ADDON_PDF == $name) { print img_picto($langs->trans("Default"),'on'); @@ -397,12 +397,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); - print '
'; + print ''; print $form->textwithpicto('',$htmltooltip,1,0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"),'bill').''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index dc58a2c4809..4cde7aa8a20 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -306,7 +306,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''; + print ''; if ($conf->global->PROPALE_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -338,7 +338,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -484,12 +484,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index eacf0deaf68..d705ee0e38d 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -259,7 +259,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''; + print ''; if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -290,7 +290,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -403,13 +403,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->RECEPTION_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -434,12 +434,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 7a1f5c04dd2..f3004e7b6e7 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -246,7 +246,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; foreach ($arrayhandler as $key => $module) @@ -406,8 +406,8 @@ print ""; print '
'.$langs->trans("RuleForGeneratedPasswords").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("Activated").'
'; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''; // Disable clear password in database diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index b36106b3e80..d3a361db66f 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -473,7 +473,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Example with a yes / no select /*print ''; print ''; - print ''; print ''; - print ''."\n"; - print ''; @@ -395,7 +395,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Default - print ''; - print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index fa87a7f5bb7..9a97ccb640f 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -298,7 +298,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Default - print ''; - print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index e184e98a4b1..1f368eb2b50 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -259,7 +259,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print '"; } // Default - print ''; - print ''; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 03f144ecd38..783804a3d3f 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -408,7 +408,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''; // Preview - print ''."\n"; - print ''; @@ -315,7 +315,7 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("TICKET_DISABLE_ALL_MAILS", $arrval, $conf->global->TICKET_DISABLE_ALL_MAILS); } print ''; -print ''; print ''; @@ -330,7 +330,7 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL); } print ''; -print ''; print ''; @@ -348,7 +348,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); } print ''; - print ''; print ''; @@ -365,7 +365,7 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("TICKET_LIMIT_VIEW_ASSIGNED_ONLY", $arrval, $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY); } print ''; -print ''; print ''; @@ -386,7 +386,7 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); } print ''; -print ''; print ''; @@ -426,7 +426,7 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL); } print ''; -print ''; print ''; @@ -438,7 +438,7 @@ print ''; print ''; print ''; -print ''; print ''; @@ -447,7 +447,7 @@ print ''; print ''; print ''; -print ''; print ''; @@ -460,7 +460,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); $doleditor->Create(); print ''; -print ''; @@ -472,7 +472,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); $doleditor->Create(); print ''; -print ''; diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index d216252c329..de46acb69f5 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -218,7 +218,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS); } print ''; - print ''; print ''; @@ -235,7 +235,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO); } print ''; - print ''; print ''; @@ -251,7 +251,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO); } print ''; - print ''; print ''; @@ -268,7 +268,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); } print ''; - print ''; print ''; @@ -310,7 +310,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print ''; print ''; - print ''; @@ -322,7 +322,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); $doleditor->Create(); print ''; - print ''; @@ -334,7 +334,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); $doleditor->Create(); print ''; - print ''; @@ -348,7 +348,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS); } print ''; - print ''; print ''; @@ -361,7 +361,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); $doleditor->Create(); print ''; - print ''; @@ -371,7 +371,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print ''; print ''; - print ''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 99a198df394..9be3591a298 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -302,11 +302,11 @@ if ($mode == 'overwrite') print ''; - print ''; - print '"; } // Defaut - print ''; // Preview - print '"; } // Defaut - print ''; // Preview - print ''; - else print ''; + else print ''; print "\n"; } diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 81899fee0f0..02abcf59660 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -162,7 +162,7 @@ foreach ($workflowcodes as $key => $params) print ' '.img_warning($langs->transnoentitiesnoconv($params['warning'])); } print "\n"; - print ''; $out .= ''; $out .= ''; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= ''."\n"; $i = 0; @@ -1451,8 +1451,8 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; $out .= "\n"; } @@ -1498,7 +1498,7 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''."\n"; $tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); if (is_array($tmpfilelist) && count($tmpfilelist)) @@ -1510,7 +1510,7 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; $out .= "\n"; } } @@ -1532,8 +1532,8 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''; $out .= ''; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''."\n"; @@ -1547,8 +1547,8 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out .= ''."\n"; @@ -1582,8 +1582,8 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''; $out .= ''; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''."\n"; @@ -1597,8 +1597,8 @@ class Setup extends DolibarrApi $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out .= ''."\n"; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 351f50438ed..be1afb30bd4 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -213,13 +213,13 @@ while ($i < min($num, $limit)) print "\n"; // Target - print '\n"; // Author - print '\n"; // Date creation - print '"; + print '"; // Position print '"; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9fca6afab6e..b9519dc377c 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -618,7 +618,7 @@ if ($resql) $formatToUse = $obj->fulldayevent ? 'day' : 'dayhour'; // Start date if (!empty($arrayfields['a.datep']['checked'])) { - print ''; } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 134e239b66f..43e28b34ca3 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -603,7 +603,7 @@ echo ''; $i=0; for ($h = $begin_d; $h < $end_d; $h++) { - echo '"; } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 54373fcf8a9..a21d6472ec6 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -665,7 +665,7 @@ while($currentdaytoshow<$lastdaytoshow) { } for ($h = $begin_h; $h < $end_h; $h++) { - echo '"; } diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index c6549c5c39a..b26f05a4adb 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -131,11 +131,11 @@ if ($resql) print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; while ($i < min($num, $limit)) @@ -150,10 +150,10 @@ if ($resql) print "\n"; // Nb of events - print ''; + print ''; // Button to build doc - print ''; @@ -184,8 +184,8 @@ if ($resql) print $out; print ''; - print ''; - print ''; + print ''; + print ''; } else { print ''; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index f2754658f37..706153e897c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -598,7 +598,7 @@ if ($object->fetch($id) >= 0) print ''; print ''; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Activated").''.$langs->trans("Action").''.$langs->trans("Activated").''.$langs->trans("Action").'
'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('INVENTORY_DISABLE_VIRTUAL'); } else { @@ -486,7 +486,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Example with a yes / no select /*print '
'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('INVENTORY_USE_MIN_PA_IF_NO_LAST_PA'); } else { diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index ff9a621f706..7ebe887f306 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -268,7 +268,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''; + print ''; if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -297,7 +297,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''."\n"; + print ''."\n"; //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //{ // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all @@ -411,13 +411,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") { //print img_picto($langs->trans("Default"),'on'); @@ -438,10 +438,10 @@ foreach ($dirmodels as $reldir) $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; print ''.img_object($langs->trans("Preview"), 'order').''; print ''; + print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -327,7 +327,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''."\n"; + print ''."\n"; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'; @@ -435,13 +435,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -460,10 +460,10 @@ foreach ($dirmodels as $reldir) $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; print ''.img_object($langs->trans("Preview"), 'order').''; print ''; + print ''; //print "> ".$conf->global->SUPPLIER_PAYMENT_ADDON." - ".$file; if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.'.php' == $file) { @@ -289,7 +289,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); if ($conf->global->PAYMENT_ADDON.'.php' == $file) // If module is the one used, we show existing errors @@ -366,7 +366,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''."\n"; + print ''."\n"; //if ($conf->global->SUPPLIER_PAYMENT_ADDON_PDF != "$name") //{ // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all @@ -382,13 +382,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->SUPPLIER_PAYMENT_ADDON_PDF == "$name") { //print img_picto($langs->trans("Default"),'on'); @@ -407,10 +407,10 @@ foreach ($dirmodels as $reldir) $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; print ''.img_object($langs->trans("Preview"), 'order').''; print ''; + print ''; if ($conf->global->SUPPLIER_PROPOSAL_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -305,7 +305,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -450,12 +450,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 98d77d47118..a7982d38ab9 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -250,7 +250,7 @@ foreach ($dirmodels as $reldir) { print ''; + print ''; if ($conf->global->TICKET_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { @@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir) { } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; +print ''; print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); print '
'; +print ''; print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); print '
'; +print ''; print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help'); print '
'; +print ''; print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help'); print '
'; +print ''; print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help'); print '
'.$langs->trans("TicketEmailNotificationTo").''; print ''; +print ''; print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print '
'.$langs->trans("TicketEmailNotificationFrom").''; print ''; +print ''; print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help'); print '
'; +print ''; print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help'); print '
'; +print ''; print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); print '
'; print ''; + print ''; print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); print '
'; + print ''; print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help'); print '
'; print ''; + print ''; print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help'); print '
'; print ''; print ''; + print ''; } else {*/ - print ''; + print ''; print ''; //} print ''; @@ -356,7 +356,7 @@ if ($mode == 'overwrite') } print ''; + print ''; if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int')) { print ''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index cfc5a65cc54..c0db15a48a7 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -263,7 +263,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -271,13 +271,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->USER_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -303,12 +303,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'contract').''; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index fd7348bc603..75cdc514518 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -210,7 +210,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ''."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -218,13 +218,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->USERGROUP_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -250,12 +250,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'contract').''; diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index c759b0a8d8c..9840121861a 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -625,7 +625,7 @@ if ($id) // Delete link if ($iserasable) print ''.img_delete().''.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').''.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'
'; + print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff($key); diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 0dfdc9362ed..05bad1bbe7e 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1430,8 +1430,8 @@ class Setup extends DolibarrApi $out .= '
#'.$langs->trans("Constant").''.$langs->trans("ExpectedValue").''.$langs->trans("Value").''.$langs->trans("ExpectedValue").''.$langs->trans("Value").'
'.$i.''.$constname.''.$constvalue.''.$valueforchecksum.''.$constvalue.''.$valueforchecksum.'
#'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("ExpectedChecksum").'
'.$i.''.$file['filename'].''.$file['expectedmd5'].''.$file['expectedmd5'].'
#'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("Size").''.$langs->trans("DateModification").'
'.$i.''.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size($size).'
#'.$langs->trans("Filename").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("ExpectedChecksum").''.$langs->trans("CurrentChecksum").''.$langs->trans("Size").''.$langs->trans("DateModification").'
'.$i.''.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size($size).''; + print ''; if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort"); if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort"); print "'; + print ''; if ($obj->fk_user) { $userstatic->id=$obj->fk_user; @@ -233,7 +233,7 @@ while ($i < min($num, $limit)) print "'.dol_print_date($db->jdate($obj->dateb), 'day')."'.dol_print_date($db->jdate($obj->dateb), 'day')."'.$obj->position."'; + print ''; print dol_print_date($db->jdate($obj->dp), $formatToUse); $late = 0; if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1; @@ -631,7 +631,7 @@ if ($resql) // End date if (!empty($arrayfields['a.datep2']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->dp2), $formatToUse); print ''; + echo ''; print ''.sprintf("%02d", $h).''; print "'; + echo ''; print ''.sprintf("%02d", $h).''; print "
'.$langs->trans("Period").''.$langs->trans("EventsNb").''.$langs->trans("Action").''.$langs->trans("EventsNb").''.$langs->trans("Action").''.$langs->trans("PDF").''.$langs->trans("Date").''.$langs->trans("Size").''.$langs->trans("Date").''.$langs->trans("Size").'
".$obj->df."'.$obj->cc.''.$obj->cc.''; + print ''; print 'month.'&year='.$obj->year.'">'.img_picto($langs->trans('BuildDoc'), 'filenew').''; print ''.dol_print_date(dol_filemtime($file), 'dayhour').''.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file), 'dayhour').''.dol_print_size(dol_filesize($file)).' '.$obj->lastname.''.$obj->firstname.''.$obj->other.''; + print ''; if (empty($obj->source_id) || empty($obj->source_type)) { print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility @@ -649,7 +649,7 @@ if ($object->fetch($id) >= 0) else { // Date sent - print ''.$obj->date_envoi.''.$obj->date_envoi.''; print $object::libStatutDest($obj->statut, 2, $obj->error_text); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 1dc7a430575..b0cbcc23784 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -165,8 +165,8 @@ if ($result) { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; $num = $db->num_rows($result); @@ -184,8 +184,8 @@ if ($result) { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; $i++; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index cbd0c244bb3..b3b07a8a875 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -228,14 +228,14 @@ if ($result) print ''; // Date creation - print ''; // Nb of email if (!$filteremail) { - print ''; @@ -890,7 +890,7 @@ if ($resql) { if (!is_array($typenArray) || empty($typenArray)) $typenArray = $formcompany->typent_array(1); - print ''; if (!$i) $totalarray['nbfield']++; @@ -899,7 +899,7 @@ if ($resql) // Date proposal if (!empty($arrayfields['p.date']['checked'])) { - print '\n"; if (!$i) $totalarray['nbfield']++; @@ -910,7 +910,7 @@ if ($resql) { if ($obj->dfv) { - print ''; } else @@ -924,7 +924,7 @@ if ($resql) { if ($obj->ddelivery) { - print ''; } else @@ -936,7 +936,7 @@ if ($resql) // Availability if (! empty($arrayfields['ava.rowid']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 4c7b393c8db..4a2b8dea419 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -274,7 +274,7 @@ print '
'; print '
'; print '
'.$langs->trans("LastMailings", $limit).''.$langs->trans("DateCreation").''.$langs->trans("NbOfEMails").''.$langs->trans("DateCreation").''.$langs->trans("NbOfEMails").''.$langs->trans("AllEMailings").'
'.$mailstatic->getNomUrl(1).''.dol_trunc($obj->titre, 38).''.dol_print_date($db->jdate($obj->date_creat), 'day').''.($obj->nbemail ? $obj->nbemail : "0").''.dol_print_date($db->jdate($obj->date_creat), 'day').''.($obj->nbemail ? $obj->nbemail : "0").''.$mailstatic->LibStatut($obj->statut, 5).'
'.$obj->titre.''; + print ''; print dol_print_date($db->jdate($obj->datec), 'day'); print ''; + print ''; $nbemail = $obj->nbemail; /*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1a44efa45ec..887c99e7aeb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -879,7 +879,7 @@ if ($resql) // Country if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray = getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; print $typenArray[$obj->typent_code]; print ''; + print ''; print dol_print_date($db->jdate($obj->dp), 'day'); print "'.dol_print_date($db->jdate($obj->dfv), 'day'); + print ''.dol_print_date($db->jdate($obj->dfv), 'day'); print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); + print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); print ''; + print ''; $form->form_availability('', $obj->availability, 'none', 1); print '
'; print ''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index a4f3fb0503b..2b8c8ef5df2 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -235,7 +235,7 @@ if ($socid > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; $num = $db->num_rows($resql); if ($num > 0) @@ -246,7 +246,7 @@ if ($socid > 0) $obj = $db->fetch_object($resql); print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -294,7 +294,7 @@ if ($socid > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; $num = $db->num_rows($resql); if ($num > 0) @@ -305,7 +305,7 @@ if ($socid > 0) $obj = $db->fetch_object($resql); print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 272e0173980..c4b6ac18987 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -1062,7 +1062,7 @@ if ($socid > 0) { print ''; } - print ''; print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 70a504f23f3..e8dde584661 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1020,7 +1020,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -1029,7 +1029,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -1039,7 +1039,7 @@ if ($resql) // Order date if (! empty($arrayfields['c.date_commande']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1047,7 +1047,7 @@ if ($resql) // Plannned date of delivery if (! empty($arrayfields['c.date_delivery']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1116,7 +1116,7 @@ if ($resql) // Billed if (! empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 20014e58767..ced7d258167 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -705,7 +705,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; // Checkbox - print ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index e3413f5b927..e9eca9dafa9 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -301,7 +301,7 @@ print '

'; print '
'; print '
'.$langs->trans("Year").''.$langs->trans("Year").''.$langs->trans("NbOfProposals").'%'.$langs->trans("AmountTotal").''.$langs->trans("Date").''.$langs->trans("CustomerRelativeDiscountShort").''.$langs->trans("NoteReason").''.$langs->trans("User").''.$langs->trans("User").'
'.dol_print_date($db->jdate($obj->dc), "dayhour").''.price2num($obj->remise_percent).'%'.price2num($obj->remise_percent).'%'.$obj->note.''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'
'.$langs->trans("Date").''.$langs->trans("CustomerRelativeDiscountShort").''.$langs->trans("NoteReason").''.$langs->trans("User").''.$langs->trans("User").'
'.dol_print_date($db->jdate($obj->dc), "dayhour").''.price2num($obj->remise_percent).'%'.price2num($obj->remise_percent).'%'.$obj->note.''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'
'.price($obj->multicurrency_amount_ttc).''; + print ''; print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; print ' '; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; print dol_print_date($db->jdate($obj->date_commande), 'day'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_delivery), 'day'); print ''.yn($obj->billed).''.yn($obj->billed).''.$generic_commande->LibStatut($objp->fk_statut, $objp->billed, 5).''; + print ''; print ''; print '
'; print ''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 59a602fa706..0980f70df29 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -703,7 +703,7 @@ if ($resql) print ''; /*if (! empty($conf->accounting->enabled)) { - print ''; }*/ @@ -739,11 +739,11 @@ if ($resql) print ''; /*if (! empty($conf->accounting->enabled)) { - print ''; }*/ - print ''; @@ -1101,7 +1101,7 @@ if ($resql) print ''; } - print '
'.$langs->trans("Year").''.$langs->trans("Year").''.$langs->trans("NbOfOrders").'%'.$langs->trans("AmountTotal").''.$langs->trans("Credit").''; + print ''; print $langs->trans("AccountAccounting"); print ''; + print ''; print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, null, 1, 1, ''); print ''; + print ''; print '
'; print ''; print '
'; + print ''; print ''; print '