From 0a81fe667f42219a66201a2e4440a8b8c8336987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 10:44:10 +0100 Subject: [PATCH 1/6] Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work --- ChangeLog | 1 + htdocs/core/lib/agenda.lib.php | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5870e55152d..afeeb932e9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase - Fix: [ bug #1819 ] SQL error when searching for an invoice payment - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes +- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index e730a1ed45b..c9773372e93 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -144,12 +144,19 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh foreach ($showextcals as $val) { $htmlname = dol_string_nospecial($val['name']); + print ''; print '' . "\n"; From 6f08893016977a6a4b767bde1bb4259df72af562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 12:26:20 +0100 Subject: [PATCH 2/6] Fix: [ bug #1846 ] Browser IE11 not detected --- ChangeLog | 1 + htdocs/core/lib/functions.lib.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 29fadcba4fc..31e0bad5a16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 0 Fix: [ bug #1757 ] Sorting breaks product/service statistics Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled +Fix: [ bug #1846 ] Browser IE11 not detected ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b5bac3b0ab0..85e4b68f519 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10,6 +10,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2014-2015 Marcos García * * 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 @@ -146,7 +147,7 @@ function getBrowserInfo() elseif (preg_match('/epiphany/i',$_SERVER["HTTP_USER_AGENT"])) { $name='epiphany'; $version=$reg[2]; } elseif ((empty($phone) || preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) && preg_match('/safari(\/|\s)([\d\.]*)/i',$_SERVER["HTTP_USER_AGENT"], $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not. elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='opera'; $version=$reg[2]; } - elseif (preg_match('/msie(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='ie'; $version=$reg[2]; } // MS products at end + elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='ie'; $version= end($reg); } // MS products at end // Other $firefox=0; if (in_array($name,array('firefox','iceweasel'))) $firefox=1; From 3efb737cbf685501752a6c69131b8d79cf07bbde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 12:30:10 +0100 Subject: [PATCH 3/6] Fix: [ bug #1845 ] Undefined "$conf->browser->ie" var in "functions.lib.php" --- 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 85e4b68f519..687c8d3d855 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2516,7 +2516,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath $return=''; if ($picto == 'setup') $picto='title.png'; - if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif'; + if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif'; $return.= "\n"; $return.= ''; @@ -2554,7 +2554,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so global $conf,$langs; if ($picto == 'setup') $picto='title.png'; - if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif'; + if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif'; if (($num > $conf->liste_limit) || ($num == -1)) { From d1a4b6c2c5a7cfab1b21731de2ef790130d55d17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Feb 2015 00:04:35 +0100 Subject: [PATCH 4/6] phpcs --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 121fbc769b7..3bded45bc9f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1054,11 +1054,11 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) $default_timezone=@date_default_timezone_get(); } } - + if (empty($localtz)) { $localtz = new DateTimeZone('UTC'); } - + $dt = new DateTime(null,$localtz); $dt->setDate($year,$month,$day); $dt->setTime((int) $hour, (int) $minute, (int) $second); @@ -2952,7 +2952,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; - $sql .= " AND t.taux = ".(float)$tva." AND t.active = 1"; + $sql .= " AND t.taux = ".((float) $tva)." AND t.active = 1"; dol_syslog("get_localtax sql=".$sql); $resql=$db->query($sql); @@ -2988,7 +2988,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty) $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'"; - $sql .= " AND t.taux = ".(float)$vatrate." AND t.active = 1"; + $sql .= " AND t.taux = ".((float) $vatrate)." AND t.active = 1"; $resql=$db->query($sql); if ($resql) From ec56667f5ea8969536ffc83bcfd1ec9fd387c0e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Feb 2015 09:44:22 +0100 Subject: [PATCH 5/6] Fix: [ bug #1849 ] Broken flag image when a contact does not have a country set --- htdocs/core/lib/functions.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3bded45bc9f..0c24e5fba72 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4305,6 +4305,8 @@ function picto_from_langcode($codelang) { global $langs; + if (empty($codelang)) return ''; + if ($codelang == 'auto') { return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png'); From bd6b465ee10aa20bc45072f67ddfdc07aff06ea4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Feb 2015 20:16:15 +0100 Subject: [PATCH 6/6] Add phpunit for ie11 and ie10 --- test/phpunit/FunctionsLibTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 78c2278ba69..73af66e3cbc 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -128,22 +128,37 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo(); $this->assertEquals('ie',$tmp['browsername']); $this->assertEquals('5.0',$tmp['browserversion']); + $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firefox/0.9.1'; // Firefox 0.9.1 $tmp=getBrowserInfo(); $this->assertEquals('firefox',$tmp['browsername']); $this->assertEquals('0.9.1',$tmp['browserversion']); + + $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)'; // IE 10 + $tmp=getBrowserInfo(); + $this->assertEquals('ie',$tmp['browsername']); + $this->assertEquals('10.0',$tmp['browserversion']); + + $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; // IE 11 + $tmp=getBrowserInfo(); + $this->assertEquals('ie',$tmp['browsername']); + $this->assertEquals('11.0',$tmp['browserversion']); + $_SERVER['HTTP_USER_AGENT']='Mozilla/3.0 (Windows 98; U) Opera 6.03 [en]'; $tmp=getBrowserInfo(); $this->assertEquals('opera',$tmp['browsername']); $this->assertEquals('6.03',$tmp['browserversion']); + $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21'; $tmp=getBrowserInfo(); $this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('19.0.1042.0',$tmp['browserversion']); + $_SERVER['HTTP_USER_AGENT']='chrome (Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11)'; $tmp=getBrowserInfo(); $this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('17.0.963.56',$tmp['browserversion']); + $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1'; $tmp=getBrowserInfo(); $this->assertEquals('safari',$tmp['browsername']);