2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'origin/3.6' into 3.7

Conflicts:
	htdocs/core/lib/agenda.lib.php
	htdocs/core/lib/functions.lib.php
This commit is contained in:
Laurent Destailleur
2015-02-20 22:51:47 +01:00
6 changed files with 64 additions and 18 deletions

View File

@@ -196,6 +196,7 @@ Dolibarr better:
- Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object - Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object
- Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php - Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php
- Fix: [ bug #1830 ] Salaries payment only allows checking accounts - Fix: [ bug #1830 ] Salaries payment only allows checking accounts
- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
@@ -362,6 +363,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 #1757 ] Sorting breaks product/service statistics
Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date 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 #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 ***** ***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973 Fix: Avoid missing class error for fetch_thirdparty method #1973

View File

@@ -23,10 +23,11 @@
* \ingroup agenda * \ingroup agenda
* \brief File of class to parse ical calendars * \brief File of class to parse ical calendars
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php';
/** /**
* Class to parse ICal calendars * Class to read/parse ICal calendars
*/ */
class ICal class ICal
{ {
@@ -107,6 +108,7 @@ class ICal
if (!stristr($this->file_text[0],'BEGIN:VCALENDAR')) return 'error not VCALENDAR'; if (!stristr($this->file_text[0],'BEGIN:VCALENDAR')) return 'error not VCALENDAR';
$insidealarm=0; $insidealarm=0;
$tmpkey='';$tmpvalue='';
foreach ($this->file_text as $text) foreach ($this->file_text as $text)
{ {
$text = trim($text); // trim one line $text = trim($text); // trim one line
@@ -137,7 +139,7 @@ class ICal
case "BEGIN:DAYLIGHT": case "BEGIN:DAYLIGHT":
case "BEGIN:VTIMEZONE": case "BEGIN:VTIMEZONE":
case "BEGIN:STANDARD": case "BEGIN:STANDARD":
$type = $value; // save tu array under value key $type = $value; // save array under value key
break; break;
case "END:VTODO": // end special text - goto VCALENDAR key case "END:VTODO": // end special text - goto VCALENDAR key
@@ -159,8 +161,31 @@ class ICal
$insidealarm=0; $insidealarm=0;
break; break;
default: // no special string default: // no special string (SUMMARY, DESCRIPTION, ...)
if (! $insidealarm) $this->add_to_array($type, $key, $value); // add to array if ($tmpvalue)
{
$tmpvalue .= $text;
if (! preg_match('/=$/',$text)) // No more lines
{
$key=$tmpkey;
$value=quotedPrintDecode(preg_replace('/^ENCODING=QUOTED-PRINTABLE:/i','',$tmpvalue));
$tmpkey='';
$tmpvalue='';
}
}
elseif (preg_match('/^ENCODING=QUOTED-PRINTABLE:/i',$value))
{
if (preg_match('/=$/',$value))
{
$tmpkey=$key;
$tmpvalue=$tmpvalue.preg_replace('/=$/',"",$value); // We must wait to have next line to have complete message
}
else
{
$value=quotedPrintDecode(preg_replace('/^ENCODING=QUOTED-PRINTABLE:/i','',$tmpvalue.$value));
}
} //$value=quotedPrintDecode($tmpvalue.$value);
if (! $insidealarm && ! $tmpkey) $this->add_to_array($type, $key, $value); // add to array
break; break;
} }
} }

View File

@@ -361,6 +361,7 @@ if (! empty($conf->use_javascript_ajax))
foreach ($showextcals as $val) foreach ($showextcals as $val)
{ {
$htmlname = dol_string_nospecial($val['name']); $htmlname = dol_string_nospecial($val['name']);
$htmlname = dol_string_nospecial($htmlname,'_',array("\.","#"));
$s.='<script type="text/javascript">' . "\n"; $s.='<script type="text/javascript">' . "\n";
$s.='jQuery(document).ready(function () {' . "\n"; $s.='jQuery(document).ready(function () {' . "\n";
$s.=' jQuery("#check_' . $htmlname . '").click(function() {'; $s.=' jQuery("#check_' . $htmlname . '").click(function() {';

View File

@@ -140,6 +140,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (empty($conf->dol_use_jmobile)) print ' - '; if (empty($conf->dol_use_jmobile)) print ' - ';
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">'; print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("AgendaShowBirthdayEvents").' <input type="checkbox" id="check_birthday" name="check_birthday"></td></tr>';
print '</table>';
print '</td>';
} }
// Hooks // Hooks

View File

@@ -10,8 +10,8 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -156,7 +156,7 @@ function getBrowserInfo()
elseif (preg_match('/epiphany/i',$_SERVER["HTTP_USER_AGENT"])) { $name='epiphany'; $version=$reg[2]; } 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 ((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('/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 // Other
$firefox=0; $firefox=0;
if (in_array($name,array('firefox','iceweasel'))) $firefox=1; if (in_array($name,array('firefox','iceweasel'))) $firefox=1;
@@ -454,18 +454,18 @@ function dol_string_unaccent($str)
/** /**
* Clean a string from all punctuation characters to use it as a ref or login * Clean a string from all punctuation characters to use it as a ref or login
* *
* @param string $str String to clean * @param string $str String to clean
* @param string $newstr String to replace forbidden chars with * @param string $newstr String to replace forbidden chars with
* @param array $badchars List of forbidden characters * @param array $badcharstoreplace List of forbidden characters
* @return string Cleaned string * @return string Cleaned string
* *
* @see dol_sanitizeFilename, dol_string_unaccent * @see dol_sanitizeFilename, dol_string_unaccent
*/ */
function dol_string_nospecial($str,$newstr='_',$badchars='') function dol_string_nospecial($str,$newstr='_',$badcharstoreplace='')
{ {
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
$forbidden_chars_to_remove=array(); $forbidden_chars_to_remove=array();
if (is_array($badchars)) $forbidden_chars_to_replace=$badchars; if (is_array($badcharstoreplace)) $forbidden_chars_to_replace=$badcharstoreplace;
//$forbidden_chars_to_remove=array("(",")"); //$forbidden_chars_to_remove=array("(",")");
return str_replace($forbidden_chars_to_replace,$newstr,str_replace($forbidden_chars_to_remove,"",$str)); return str_replace($forbidden_chars_to_replace,$newstr,str_replace($forbidden_chars_to_remove,"",$str));
@@ -2656,7 +2656,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
$return=''; $return='';
if ($picto == 'setup') $picto='title.png'; 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.= "\n";
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>'; $return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
@@ -2695,7 +2695,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
global $conf,$langs; global $conf,$langs;
if ($picto == 'setup') $picto='title.png'; 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)) if (($num > $conf->liste_limit) || ($num == -1))
{ {
@@ -3010,7 +3010,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
/** /**
* Return localtax rate for a particular vat, when selling a product with vat $tva, from a $thirdparty_buyer to a $thirdparty_seller * Return localtax rate for a particular vat, when selling a product with vat $tva, from a $thirdparty_buyer to a $thirdparty_seller
* Note: It applies same rule than get_default_tva * Note: This function applies same rules than get_default_tva
* *
* @param float $tva Vat taxe * @param float $tva Vat taxe
* @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2)
@@ -3111,13 +3111,10 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
} }
} }
$sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $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_country as c"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; $sql .= " WHERE t.fk_pays = c.rowid AND c.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", LOG_DEBUG); dol_syslog("get_localtax", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@@ -4610,6 +4607,8 @@ function picto_from_langcode($codelang)
if (empty($codelang)) return ''; if (empty($codelang)) return '';
if (empty($codelang)) return '';
if ($codelang == 'auto') if ($codelang == 'auto')
{ {
return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png'); return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png');

View File

@@ -128,22 +128,37 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$tmp=getBrowserInfo(); $tmp=getBrowserInfo();
$this->assertEquals('ie',$tmp['browsername']); $this->assertEquals('ie',$tmp['browsername']);
$this->assertEquals('5.0',$tmp['browserversion']); $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 $_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(); $tmp=getBrowserInfo();
$this->assertEquals('firefox',$tmp['browsername']); $this->assertEquals('firefox',$tmp['browsername']);
$this->assertEquals('0.9.1',$tmp['browserversion']); $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]'; $_SERVER['HTTP_USER_AGENT']='Mozilla/3.0 (Windows 98; U) Opera 6.03 [en]';
$tmp=getBrowserInfo(); $tmp=getBrowserInfo();
$this->assertEquals('opera',$tmp['browsername']); $this->assertEquals('opera',$tmp['browsername']);
$this->assertEquals('6.03',$tmp['browserversion']); $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'; $_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(); $tmp=getBrowserInfo();
$this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('chrome',$tmp['browsername']);
$this->assertEquals('19.0.1042.0',$tmp['browserversion']); $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)'; $_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(); $tmp=getBrowserInfo();
$this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('chrome',$tmp['browsername']);
$this->assertEquals('17.0.963.56',$tmp['browserversion']); $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'; $_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(); $tmp=getBrowserInfo();
$this->assertEquals('safari',$tmp['browsername']); $this->assertEquals('safari',$tmp['browsername']);