From 4dd740fe2f4bb1f8da072180b3da731b0809dc62 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 13 Dec 2016 11:41:26 +0100 Subject: [PATCH 1/5] FIX : wrong test on dict.php --- htdocs/admin/dict.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index bef8c6951bf..cae081e55e3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1292,8 +1292,6 @@ if ($id) } else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) From 1f1c75adfb627d6e48543959ee8804bd84241359 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 14 Dec 2016 15:50:50 +0100 Subject: [PATCH 2/5] FIX : HT and TTC price should always be displayed together --- htdocs/product/price.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 88c6c3e57b1..3be258f4243 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1269,14 +1269,14 @@ if ($result) } else { - print '' . ($objp->price_base_type != 'TTC' ? price($objp->price) : ''). ""; - print '' . ($objp->price_base_type == 'TTC' ? price($objp->price_ttc) : '') . ""; + print '' . price($objp->price). ""; + print '' . price($objp->price_ttc) . ""; if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled print ''; } } - print '' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . ''; - print '' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . ''; + print '' . price($objp->price_min) . ''; + print '' . price($objp->price_min_ttc) . ''; // User print '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . ''; From dbf96b8f5977fa44b2f268d0827fa8383fb7a96e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 23:32:31 +0100 Subject: [PATCH 3/5] Log at wrong place --- htdocs/core/class/CMailFile.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index bd803ca3851..ba4eb1ad017 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -441,8 +441,6 @@ class CMailFile } else { - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG); - $bounce = ''; // By default if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { @@ -455,7 +453,8 @@ class CMailFile { $bounce .= ($bounce?' ':'').'-ba'; } - + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); + $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); From 74e00c4d803a4da3e21c345445aac3b95db19243 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 01:04:17 +0100 Subject: [PATCH 4/5] More comment and hidden option to solve problems when sending emails. --- htdocs/core/class/CMailFile.class.php | 7 +++++-- htdocs/core/class/smtps.class.php | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ba4eb1ad017..a7c9b0a0e56 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -143,6 +143,8 @@ class CMailFile $this->msgishtml = $msgishtml; } + if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html. + // Detect images if ($this->msgishtml) { @@ -822,8 +824,9 @@ class CMailFile $strContent = preg_replace("/\r\n/si", "\n", $strContent); } - //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged - $strContent = rtrim(wordwrap($strContent)); + // Make RFC2045 Compliant, split lines + //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content + $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 6731b46fe0f..91efd218de1 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1188,7 +1188,9 @@ class SMTPs // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?_msgContent[$strType] = array(); From 876722733aa721d03d9ce369cbdaaa67cf046e77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 02:33:54 +0100 Subject: [PATCH 5/5] Better fix to get localtax --- htdocs/core/lib/functions.lib.php | 17 +++++++---------- htdocs/product/price.php | 11 +++++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8c810b76b97..bd184469e49 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3330,7 +3330,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party - * @param Societe $thirdparty_seller Object of selling third party + * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not * @return mixed 0 if not found, localtax rate if found * @see get_default_tva @@ -3389,18 +3389,15 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; } - //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); - // Do not enabled this. We want localtax that match the vat rate. - // If we forced a vat, we must also force local tax - /* - if (is_object($thirdparty_buyer)) + // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on. + if (in_array($mysoc->country_code, array('ES'))) { - if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; - }*/ - + $conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1; + } + // Search local taxes - if ($mysoc->country_code == 'ES' || ! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) + if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) { if ($local==1) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3be258f4243..625b6c29631 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -246,10 +246,17 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); $npr = $obj->recuperableonly; - $localtax1 = get_localtax($tva_tx,1); - $localtax2 = get_localtax($tva_tx,2); + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; $localtax1_type = $obj->localtax1_type; $localtax2_type = $obj->localtax2_type; + + // If spain, we don't use the localtax found into tax record in database with same code, but using the get_localtax rule + if (in_array($mysoc->country_code, array('ES'))) + { + $localtax1 = get_localtax($tva_tx,1); + $localtax2 = get_localtax($tva_tx,2); + } } } $pricestoupdate[0] = array(