Add more test to prepare option for rounding lines
This commit is contained in:
parent
2093b3f0be
commit
7b527e085d
@ -159,7 +159,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
|
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
|
||||||
$a=getCurrentTimeZoneString();
|
$a=getCurrentTimeZoneString();
|
||||||
$a.=' '.getCurrentTimeZoneInt();
|
$a.=' '.getCurrentTimeZoneInt();
|
||||||
$a.=' ('.(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970)).')';
|
$a.=' ('.(getCurrentTimeZoneInt()>0?'+':'').(getCurrentTimeZoneInt()*3600).')';
|
||||||
print $form->textwithtooltip($a,$txt,2,1,img_info(''));
|
print $form->textwithtooltip($a,$txt,2,1,img_info(''));
|
||||||
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
|
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -203,4 +203,6 @@ print '</table>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -86,7 +86,6 @@ class Conf
|
|||||||
$this->user=(object) array();
|
$this->user=(object) array();
|
||||||
//! Charset for HTML output and for storing data in memory
|
//! Charset for HTML output and for storing data in memory
|
||||||
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
|
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
|
||||||
$this->global->MAIN_OLD_DATE=1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,14 +76,14 @@ function getCurrentTimeZoneString()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return server timezone int.
|
* Return server timezone int.
|
||||||
* If $conf->global->MAIN_OLD_DATE is set, we use old behaviour: All convertion does not include daylight.
|
* If $conf->global->MAIN_NEW_DATE is set, we use new behaviour: All convertions take care of dayling saving time.
|
||||||
*
|
*
|
||||||
* @return string An offset in seconds (3600 for Europe/Paris on winter and 7200 for Europe/Paris on summer)
|
* @return string An offset in seconds (3600 for Europe/Paris on winter and 7200 for Europe/Paris on summer)
|
||||||
*/
|
*/
|
||||||
function getCurrentTimeZoneInt()
|
function getCurrentTimeZoneInt()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
if (class_exists('DateTime') && empty($conf->global->MAIN_OLD_DATE))
|
if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE))
|
||||||
{
|
{
|
||||||
// Method 1 (include daylight)
|
// Method 1 (include daylight)
|
||||||
$localtz = new DateTimeZone(date_default_timezone_get());
|
$localtz = new DateTimeZone(date_default_timezone_get());
|
||||||
|
|||||||
@ -1047,6 +1047,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec
|
|||||||
*/
|
*/
|
||||||
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -1065,26 +1066,29 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
|||||||
if ($second< 0 || $second > 60) return '';
|
if ($second< 0 || $second > 60) return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$usealternatemethod=false;
|
if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE))
|
||||||
if ($year <= 1970) $usealternatemethod=true; // <= 1970
|
|
||||||
if ($year >= 2038) $usealternatemethod=true; // >= 2038
|
|
||||||
|
|
||||||
if ($usealternatemethod || $gm) // Si time gm, seule adodb peut convertir
|
|
||||||
{
|
{
|
||||||
/*
|
if (empty($gm)) $localtz = new DateTimeZone(date_default_timezone_get());
|
||||||
// On peut utiliser strtotime pour obtenir la traduction.
|
else $localtz = new DateTimeZone('UTC');
|
||||||
// strtotime is ok for range: Friday 13 December 1901 20:45:54 GMT to Tuesday 19 January 2038 03:14:07 GMT.
|
$dt = new DateTime(null,$localtz);
|
||||||
$montharray=array(1=>'january',2=>'february',3=>'march',4=>'april',5=>'may',6=>'june',
|
$dt->setDate($year,$month,$day);
|
||||||
7=>'july',8=>'august',9=>'september',10=>'october',11=>'november',12=>'december');
|
$dt->setTime($hour,$minute,$second);
|
||||||
$string=$day." ".$montharray[0+$month]." ".$year." ".$hour.":".$minute.":".$second." GMT";
|
$date=$dt->getTimestamp();
|
||||||
$date=strtotime($string);
|
|
||||||
print "- ".$string." ".$date." -";
|
|
||||||
*/
|
|
||||||
$date=adodb_mktime($hour,$minute,$second,$month,$day,$year,$isdst,$gm);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$date=mktime($hour,$minute,$second,$month,$day,$year);
|
$usealternatemethod=false;
|
||||||
|
if ($year <= 1970) $usealternatemethod=true; // <= 1970
|
||||||
|
if ($year >= 2038) $usealternatemethod=true; // >= 2038
|
||||||
|
|
||||||
|
if ($usealternatemethod || $gm) // Si time gm, seule adodb peut convertir
|
||||||
|
{
|
||||||
|
$date=adodb_mktime($hour,$minute,$second,$month,$day,$year,$isdst,$gm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$date=mktime($hour,$minute,$second,$month,$day,$year);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,7 +204,7 @@ if (! defined('DOL_DEFAULT_TTF_BOLD')) { define('DOL_DEFAULT_TTF_BOLD', (!isset(
|
|||||||
* Include functions
|
* Include functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('ADODB_DATE_VERSION')) include_once(ADODB_PATH.'adodb-time.inc.php');
|
if (! defined('ADODB_DATE_VERSION')) include_once(ADODB_PATH.'adodb-time.inc.php');
|
||||||
|
|
||||||
if (! file_exists(DOL_DOCUMENT_ROOT ."/core/lib/functions.lib.php"))
|
if (! file_exists(DOL_DOCUMENT_ROOT ."/core/lib/functions.lib.php"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
@ -75,8 +75,7 @@ if (! empty($dolibarr_main_document_root_alt))
|
|||||||
}
|
}
|
||||||
// Force db type (for test purpose)
|
// Force db type (for test purpose)
|
||||||
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
|
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
|
||||||
|
// Force Multi-Company transverse mode
|
||||||
// Multi-Company transverse mode
|
|
||||||
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
|
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
|
||||||
|
|
||||||
// Chargement des includes principaux de librairies communes
|
// Chargement des includes principaux de librairies communes
|
||||||
|
|||||||
@ -91,8 +91,11 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||||||
print __METHOD__."\n";
|
print __METHOD__."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
* Init phpunit tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs,$db;
|
global $conf,$user,$langs,$db;
|
||||||
@ -103,8 +106,11 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
print __METHOD__."\n";
|
print __METHOD__."\n";
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*/
|
* End phpunit tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
print __METHOD__."\n";
|
print __METHOD__."\n";
|
||||||
@ -222,6 +228,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* testDolMkTime
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDolMkTime()
|
public function testDolMkTime()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -89,6 +89,9 @@ class PropalTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Init phpunit tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -102,6 +105,9 @@ class PropalTest extends PHPUnit_Framework_TestCase
|
|||||||
//print $db->getVersion()."\n";
|
//print $db->getVersion()."\n";
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* End phpunit tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user