From 8fa7b924d5975f5d69d8571bc31a04dd15acfb5f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 9 Dec 2017 12:08:50 +0100 Subject: [PATCH 001/118] enhance image using awesome icon --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9683517f377..ba842682221 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6245,7 +6245,7 @@ function dol_validElement($element) * Return img flag of country for a language code or country code * * @param string $codelang Language code (en_IN, fr_CA...) or Country code (IN, FR) - * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @return string HTML img string with flag. */ function picto_from_langcode($codelang, $moreatt = '') @@ -6258,7 +6258,7 @@ function picto_from_langcode($codelang, $moreatt = '') if ($codelang == 'auto') { - return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png', $moreatt); + return ''; } $langtocountryflag = array( From a9c7dc48abfaa23a0411535576472daf4cbb1a23 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 24 Dec 2017 17:31:31 +0100 Subject: [PATCH 002/118] New option to force e-mail recipient, helpful for test purposes --- htdocs/admin/mails.php | 11 +++++++++++ htdocs/core/class/CMailFile.class.php | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index d482322a054..677e6099a8d 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -70,6 +70,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs); if ($action == 'update' && empty($_POST["cancel"])) { dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"),'chaine',0,'',$conf->entity); // Send mode parameters dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity); @@ -238,6 +239,11 @@ if ($action == 'edit') print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''; print $form->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1); print ''; + + // Force e-mail recipient + print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''; + print ''; + print ''; // Separator @@ -477,6 +483,11 @@ else // Disable print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.yn($conf->global->MAIN_DISABLE_ALL_MAILS).''; + + // Force e-mail recipient + print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.$conf->global->MAIN_MAIL_FORCE_SENDTO; + if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO) && ! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail")); + print ''; // Separator diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 86a6cb008d3..c79b7ac0cea 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -495,7 +495,7 @@ class CMailFile $res=false; - if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) + if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) { require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); @@ -557,6 +557,12 @@ class CMailFile $keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING'; $keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING'; } + + if(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) { + $this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO; + $this->addr_cc = ''; + $this->addr_bcc = ''; + } // Action according to choosed sending method if ($this->sendmode == 'mail') From d770f732193e97811ec9f94fd3d1e8b6a07ed009 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 26 Dec 2017 16:21:15 +0100 Subject: [PATCH 003/118] Add option translation --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a4ece445581..e2c39c45a3d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -272,6 +272,7 @@ MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (By default in php.ini: < MAIN_MAIL_ERRORS_TO=Sender email used for error returns emails sent MAIN_MAIL_AUTOCOPY_TO= Send systematically a hidden carbon-copy of all sent emails to MAIN_DISABLE_ALL_MAILS=Disable all emails sendings (for test purposes or demos) +MAIN_MAIL_FORCE_SENDTO=Send all emails to (instead of real recipients, for test purposes) MAIN_MAIL_SENDMODE=Method to use to send EMails MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required MAIN_MAIL_SMTPS_PW=SMTP Password if authentication required From 33f6ba19da673faf0bec863cfebcdee5d4a608f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Dec 2017 16:20:08 +0100 Subject: [PATCH 004/118] display weight volume in propal --- htdocs/comm/propal/card.php | 16 ++++++++++++++++ htdocs/commande/card.php | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index edd2607a11c..78c38c1cc32 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2100,6 +2100,22 @@ if ($action == 'create') print ''; } + $tmparray=$object->getTotalWeightVolume(); + $totalWeight=$tmparray['weight']; + $totalVolume=$tmparray['volume']; + if ($totalWeight) { + print '' . $langs->trans("CalculatedWeight") . ''; + print ''; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); + print ''; + } + if ($totalVolume) { + print '' . $langs->trans("CalculatedVolume") . ''; + print ''; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); + print ''; + } + // Incoterms if (!empty($conf->incoterm->enabled)) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bb6d2d78571..32bbdb9d0d8 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2268,12 +2268,15 @@ if ($action == 'create' && $user->rights->commande->creer) $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; - if ($totalWeight || $totalVolume) + if ($totalWeight) { print ''.$langs->trans("CalculatedWeight").''; print ''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); print ''; + } + if ($totalVolume) + { print ''.$langs->trans("CalculatedVolume").''; print ''; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); From c45e5c91b118dbd985c42c57d91ff898671149ea Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 14 Jan 2018 17:13:42 +0100 Subject: [PATCH 005/118] New hidden option MAIN_DISABLE_FREE_LINES --- htdocs/core/tpl/objectline_create.tpl.php | 80 +++++++++++++---------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 2d6178ed79b..2ea5b6899d7 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -142,49 +142,54 @@ else { element == 'contrat') + + $freelines = false; + if(empty($conf->global->MAIN_DISABLE_FREE_LINES)) { - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set - else $forceall=0; - } - - // Free line - echo ''; - // Show radio free line - if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) - { - echo ''; - echo ' '; - } - else - { - echo ''; - // Show type selector - if ($forceall >= 0) + $freelines = true; + $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) + if ($object->element == 'contrat') { - if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); - else echo $langs->trans("FreeLineOfType"); + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set + else $forceall=0; + } + + // Free line + echo ''; + // Show radio free line + if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) + { + echo ''; echo ' '; } + else + { + echo ''; + // Show type selector + if ($forceall >= 0) + { + if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); + else echo $langs->trans("FreeLineOfType"); + echo ' '; + } + } + + echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); + + echo ''; } - echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); - - echo ''; - // Predefined product/service if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - if ($forceall >= 0) echo '
'; + if ($forceall >= 0 && $freelines) echo '
'; echo ''; echo '