forked from Wavyzz/dolibarr
Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -157,10 +157,15 @@ $txt =$langs->trans("OSTZ").' (variable system TZ): '.($_ENV["TZ"]?$_ENV["TZ"]:$
|
|||||||
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||||
$var=!$var;
|
$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=getServerTimeZoneString();
|
$a=getServerTimeZoneInt('now');
|
||||||
$a.=' '.(getServerTimeZoneInt()>=0?'+':'').getServerTimeZoneInt();
|
$b=getServerTimeZoneInt('winter');
|
||||||
$a.=' ('.(getServerTimeZoneInt()>=0?'+':'').(getServerTimeZoneInt()*3600).')';
|
$c=getServerTimeZoneInt('summer');
|
||||||
print $form->textwithtooltip($a,$txt,2,1,img_info(''));
|
$daylight=round($b-$c);
|
||||||
|
$val=($a>=0?'+':'').$a;
|
||||||
|
$val.=' ('.($a>=0?'+':'').($a*3600).')';
|
||||||
|
$val.=' '.getServerTimeZoneString().' '.($b>=0?'+':'').$b.' ('.($b>=0?'+':'').($b*3600).')';
|
||||||
|
$val.=' '.$langs->trans("DaylingSavingTime").': '.yn($daylight);
|
||||||
|
print $form->textwithtooltip($val,$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;
|
||||||
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
|
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function getServerTimeZoneString()
|
|||||||
* Return server timezone int.
|
* Return server timezone int.
|
||||||
* If $conf->global->MAIN_NEW_DATE is set, we use new behaviour: All convertions take care of dayling saving time.
|
* If $conf->global->MAIN_NEW_DATE is set, we use new behaviour: All convertions take care of dayling saving time.
|
||||||
*
|
*
|
||||||
* @param string $refgmtdate Reference date for timezone (timezone differs on winter and summer)
|
* @param string $refgmtdate Reference period for timezone (timezone differs on winter and summer. May be 'now', 'winter' or 'summer')
|
||||||
* @return int An offset in hour (+1 for Europe/Paris on winter and +2 for Europe/Paris on summer)
|
* @return int An offset in hour (+1 for Europe/Paris on winter and +2 for Europe/Paris on summer)
|
||||||
*/
|
*/
|
||||||
function getServerTimeZoneInt($refgmtdate='now')
|
function getServerTimeZoneInt($refgmtdate='now')
|
||||||
@@ -92,8 +92,17 @@ function getServerTimeZoneInt($refgmtdate='now')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Method 2 (does not include daylight)
|
// Method 2 (does not include daylight, not supported by adodb)
|
||||||
$tmp=dol_mktime(0,0,0,1,1,1970);
|
if ($refgmtdate == 'now')
|
||||||
|
{
|
||||||
|
$gmtnow=dol_now('gmt');
|
||||||
|
$monthnow=dol_print_date($gmtnow,'%m'); $daynow=dol_print_date($gmtnow,'%d');
|
||||||
|
if (dol_stringtotime($_SESSION['dol_dst_first']) <= $gmtnow && $gmtnow < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||||
|
else $daylight=0;
|
||||||
|
$tmp=dol_mktime(0,0,0,$monthnow,$daynow,1970,false,0)-dol_mktime(0,0,0,$monthnow,$daynow,1970,true,0)-($daylight*3600);
|
||||||
|
}
|
||||||
|
else if ($refgmtdate == 'summer') $tmp=-1; // TODO
|
||||||
|
else $tmp=dol_mktime(0,0,0,1,1,1970);
|
||||||
}
|
}
|
||||||
$tz=($tmp<0?1:-1)*abs($tmp/3600);
|
$tz=($tmp<0?1:-1)*abs($tmp/3600);
|
||||||
return $tz;
|
return $tz;
|
||||||
|
|||||||
@@ -1007,7 +1007,7 @@ function dol_now($mode='gmt')
|
|||||||
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||||
$tzsecond=getServerTimeZoneInt(); // Contains tz+dayling saving time
|
$tzsecond=getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
||||||
$ret=dol_now('gmt')+($tzsecond*3600);
|
$ret=dol_now('gmt')+($tzsecond*3600);
|
||||||
}
|
}
|
||||||
/*else if ($mode == 'tzref') // Time for now with parent company timezone is added
|
/*else if ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||||
|
|||||||
@@ -140,8 +140,13 @@ function dol_print_object_info($object)
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|
||||||
$deltadateforuser=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||||
|
|
||||||
|
$deltadateforserver=getServerTimeZoneInt('now');
|
||||||
|
$deltadateforclient=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
||||||
//$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
//$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
||||||
|
$deltadateforuser=round($deltadateforclient-$deltadateforserver);
|
||||||
|
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
|
||||||
|
|
||||||
// Import key
|
// Import key
|
||||||
if (isset($object->import_key))
|
if (isset($object->import_key))
|
||||||
@@ -167,8 +172,8 @@ function dol_print_object_info($object)
|
|||||||
// Date creation
|
// Date creation
|
||||||
if (isset($object->date_creation))
|
if (isset($object->date_creation))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateCreation")." : " . dol_print_date($object->date_creation,"dayhourtext");
|
print $langs->trans("DateCreation")." : " . dol_print_date($object->date_creation,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_creation+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_creation+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +197,8 @@ function dol_print_object_info($object)
|
|||||||
// Date change
|
// Date change
|
||||||
if (isset($object->date_modification))
|
if (isset($object->date_modification))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateLastModification")." : " . dol_print_date($object->date_modification,"dayhourtext");
|
print $langs->trans("DateLastModification")." : " . dol_print_date($object->date_modification,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_modification+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_modification+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,8 +222,8 @@ function dol_print_object_info($object)
|
|||||||
// Date validation
|
// Date validation
|
||||||
if (isset($object->date_validation))
|
if (isset($object->date_validation))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateValidation")." : " . dol_print_date($object->date_validation,"dayhourtext");
|
print $langs->trans("DateValidation")." : " . dol_print_date($object->date_validation,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_validation+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_validation+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,8 +247,8 @@ function dol_print_object_info($object)
|
|||||||
// Date approve
|
// Date approve
|
||||||
if (isset($object->date_approve))
|
if (isset($object->date_approve))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateApprove")." : " . dol_print_date($object->date_approve,"dayhourtext");
|
print $langs->trans("DateApprove")." : " . dol_print_date($object->date_approve,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,8 +272,8 @@ function dol_print_object_info($object)
|
|||||||
// Date close
|
// Date close
|
||||||
if (isset($object->date_cloture))
|
if (isset($object->date_cloture))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateClosing")." : " . dol_print_date($object->date_cloture,"dayhourtext");
|
print $langs->trans("DateClosing")." : " . dol_print_date($object->date_cloture,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_cloture+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_cloture+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,16 +297,16 @@ function dol_print_object_info($object)
|
|||||||
// Date conciliate
|
// Date conciliate
|
||||||
if (isset($object->date_rappro))
|
if (isset($object->date_rappro))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateConciliating")." : " . dol_print_date($object->date_rappro,"dayhourtext");
|
print $langs->trans("DateConciliating")." : " . dol_print_date($object->date_rappro,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_rappro+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_rappro+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date send
|
// Date send
|
||||||
if (isset($object->date_envoi))
|
if (isset($object->date_envoi))
|
||||||
{
|
{
|
||||||
print $langs->trans("DateLastSend")." : " . dol_print_date($object->date_envoi,"dayhourtext");
|
print $langs->trans("DateLastSend")." : " . dol_print_date($object->date_envoi,"dayhour");
|
||||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_envoi+($deltadateforuser*3600),"dayhourtext").' '.$langs->trans("ClientHour");
|
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_envoi+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ OSTZ=Time Zone OS server
|
|||||||
PHPTZ=Time Zone PHP server
|
PHPTZ=Time Zone PHP server
|
||||||
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
|
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
|
||||||
ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds)
|
ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds)
|
||||||
DaylingSavingTime=Daylight saving time (user)
|
DaylingSavingTime=Daylight saving time
|
||||||
CurrentHour=Hour PHP (server)
|
CurrentHour=Hour PHP (server)
|
||||||
CompanyTZ= Time Zone company (main company)
|
CompanyTZ= Time Zone company (main company)
|
||||||
CompanyHour= Hour company (main company)
|
CompanyHour= Hour company (main company)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ BarCode=Barcode
|
|||||||
BarcodeType=Barcode type
|
BarcodeType=Barcode type
|
||||||
SetDefaultBarcodeType=Set barcode type
|
SetDefaultBarcodeType=Set barcode type
|
||||||
BarcodeValue=Barcode value
|
BarcodeValue=Barcode value
|
||||||
GenbarcodeLocation=Bar code generation command line tool (used by phpbarcode engine for some bar code types)
|
GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types)
|
||||||
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
|
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
|
||||||
CreateCopy=Create copy
|
CreateCopy=Create copy
|
||||||
ServiceLimitedDuration=If product is a service with limited duration:
|
ServiceLimitedDuration=If product is a service with limited duration:
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ OSTZ= Time Zone OS
|
|||||||
PHPTZ= Time Zone config PHP
|
PHPTZ= Time Zone config PHP
|
||||||
PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes)
|
PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes)
|
||||||
ClientOffsetWithGreenwich= Offset client/navigateur avec Greenwich (secondes)
|
ClientOffsetWithGreenwich= Offset client/navigateur avec Greenwich (secondes)
|
||||||
DaylingSavingTime=Heure d'été (utilisateur)
|
DaylingSavingTime=Heure d'été
|
||||||
CurrentHour= Heure PHP (serveur)
|
CurrentHour= Heure PHP (serveur)
|
||||||
CompanyTZ= Time Zone société (maison mère)
|
CompanyTZ= Time Zone société (maison mère)
|
||||||
CompanyHour= Heure société (maison mère)
|
CompanyHour= Heure société (maison mère)
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ if (in_array('date',$filter))
|
|||||||
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
|
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
|
||||||
else $sqlwhere.=" AND";
|
else $sqlwhere.=" AND";
|
||||||
$sqlwhere.= " f.fk_statut > 0";
|
$sqlwhere.= " f.fk_statut > 0";
|
||||||
$sqlwhere.= " AND f.datef >= ".$db->idate($dateafterdate);
|
$sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'";
|
||||||
$sqlwhere.= " AND f.datef <= ".$db->idate($datebeforedate);
|
$sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'";
|
||||||
$sqlorder = " ORDER BY f.datef ASC";
|
$sqlorder = " ORDER BY f.datef ASC";
|
||||||
}
|
}
|
||||||
if (in_array('nopayment',$filter))
|
if (in_array('nopayment',$filter))
|
||||||
@@ -202,8 +202,8 @@ if (in_array('payments',$filter))
|
|||||||
$sqlwhere.= " f.fk_statut > 0";
|
$sqlwhere.= " f.fk_statut > 0";
|
||||||
$sqlwhere.= " AND f.rowid = pf.fk_facture";
|
$sqlwhere.= " AND f.rowid = pf.fk_facture";
|
||||||
$sqlwhere.= " AND pf.fk_paiement = p.rowid";
|
$sqlwhere.= " AND pf.fk_paiement = p.rowid";
|
||||||
$sqlwhere.= " AND p.datep >= ".$db->idate($paymentdateafter);
|
$sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'";
|
||||||
$sqlwhere.= " AND p.datep <= ".$db->idate($paymentdatebefore);
|
$sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'";
|
||||||
$sqlorder = " ORDER BY p.datep ASC";
|
$sqlorder = " ORDER BY p.datep ASC";
|
||||||
}
|
}
|
||||||
if (in_array('nodeposit',$filter))
|
if (in_array('nodeposit',$filter))
|
||||||
|
|||||||
@@ -322,9 +322,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(7261,$result);
|
$this->assertEquals(7261,$result);
|
||||||
|
|
||||||
$result=dol_mktime(2,0,0,1,1,1970,0); // 1970-01-01 02:00:00 in local area Europe/Paris -> 3600 GMT
|
$result=dol_mktime(2,0,0,1,1,1970,0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$tz=getServerTimeZoneInt('1970-01-01 02:00:00'); // +1 in Europe/Paris at this time (this time is winter)
|
$tz=getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter)
|
||||||
$this->assertEquals(7200-($tz*3600),$result); // Should be 7200 if we are at greenwich winter
|
$this->assertEquals(7200-($tz*3600),$result); // Should be 7200 if we are at greenwich winter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,8 +337,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$now=dol_now('gmt');
|
$now=dol_now('gmt');
|
||||||
$nowtzserver=dol_now('tzserver');
|
$nowtzserver=dol_now('tzserver');
|
||||||
print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt()*3600)."\n";
|
print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt('now')*3600)."\n";
|
||||||
$this->assertEquals(getServerTimeZoneInt()*3600,($nowtzserver-$now));
|
$this->assertEquals(getServerTimeZoneInt('now')*3600,($nowtzserver-$now));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ global $conf,$user,$langs,$db;
|
|||||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||||
require_once 'PHPUnit/Autoload.php';
|
require_once 'PHPUnit/Autoload.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||||
|
require_once dirname(__FILE__).'/../../htdocs/core/db/pgsql.class.php';
|
||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
|
|||||||
Reference in New Issue
Block a user