From 68afbc0d1e6aa111fe20340bfb7affbddac4c272 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Feb 2010 02:22:15 +0000 Subject: [PATCH] Debug reporting --- htdocs/compta/resultat/clientfourn.php | 34 ++++++++++++++++++-------- htdocs/compta/stats/cabyuser.php | 18 ++++++-------- htdocs/compta/stats/casoc.php | 18 ++++++-------- htdocs/compta/tva/clients.php | 14 +++++------ htdocs/compta/tva/quadri_detail.php | 18 ++++++-------- htdocs/html.form.class.php | 22 ++++++++--------- htdocs/lib/databases/mssql.lib.php | 12 ++++----- htdocs/lib/databases/pgsql.lib.php | 12 ++++----- htdocs/lib/date.lib.php | 12 ++++----- htdocs/lib/functions.lib.php | 16 ++++++------ 10 files changed, 91 insertions(+), 85 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 4f2dc556823..a2d33daacb3 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -50,21 +50,21 @@ if (empty($year)) $year_current = $year; $year_start = $year; } -$date_start=dol_mktime($_REQUEST["date_starthour"],$_REQUEST["date_startmin"],$_REQUEST["date_startsec"],$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"],1); -$date_end=dol_mktime($_REQUEST["date_endhour"],$_REQUEST["date_endmin"],$_REQUEST["date_endsec"],$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"],1); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); // Date for local PHP server // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; if ($q==0) { - if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"]); $date_end=dol_get_last_day($year_start,$_REQUEST["month"]); } - else { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,12); } + if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } + else { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,12,false); } } - if ($q==1) { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,3); } - if ($q==2) { $date_start=dol_get_first_day($year_start,4); $date_end=dol_get_last_day($year_start,6); } - if ($q==3) { $date_start=dol_get_first_day($year_start,7); $date_end=dol_get_last_day($year_start,9); } - if ($q==4) { $date_start=dol_get_first_day($year_start,10); $date_end=dol_get_last_day($year_start,12); } + if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } + if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } + if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } + if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } else { @@ -91,7 +91,6 @@ if ($modecompta=="CREANCES-DETTES") { $nom=$langs->trans("AnnualByCompaniesDueDebtMode"); $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - //$period=$langs->trans("Year")." ".$year; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesResultDue"); @@ -101,7 +100,7 @@ if ($modecompta=="CREANCES-DETTES") else { $nom=$langs->trans("AnnualByCompaniesInputOutputMode"); $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //$period=$langs->trans("Year")." ".$year; + //$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',1,1,0,'',1,0,1); $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesResultInOut"); @@ -150,6 +149,21 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY nom"; $sql.= " ORDER BY nom"; +/* +print dol_print_date($date_end,'dayhour',true).'
'; +print $db->idate($date_end).'
'; + +print adodb_get_gmt_diff(); +print adodb_date('Y-d-m H:i',$date_end,true).'
'; +print adodb_date('Y-d-m H:i',$date_end,false).'
'; + +$date_end=0; +print dol_print_date($date_end,'dayhour',true).'
'; +print $db->idate($date_end).'
'; +print adodb_gmstrftime('%Y-%d-%m %H:%M',$date_end).'
'; +print $sql; +*/ + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index bcfc96d4018..0ebe09c5728 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -54,21 +54,21 @@ if (empty($year)) $year_current = $year; $year_start = $year; } -$date_start=dol_mktime($_REQUEST["date_starthour"],$_REQUEST["date_startmin"],$_REQUEST["date_startsec"],$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"],1); -$date_end=dol_mktime($_REQUEST["date_endhour"],$_REQUEST["date_endmin"],$_REQUEST["date_endsec"],$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"],1); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; if ($q==0) { - if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"]); $date_end=dol_get_last_day($year_start,$_REQUEST["month"]); } - else { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,12); } + if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } + else { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,12,false); } } - if ($q==1) { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,3); } - if ($q==2) { $date_start=dol_get_first_day($year_start,4); $date_end=dol_get_last_day($year_start,6); } - if ($q==3) { $date_start=dol_get_first_day($year_start,7); $date_end=dol_get_last_day($year_start,9); } - if ($q==4) { $date_start=dol_get_first_day($year_start,10); $date_end=dol_get_last_day($year_start,12); } + if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } + if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } + if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } + if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } else { @@ -91,7 +91,6 @@ if ($modecompta=="CREANCES-DETTES") { $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - //$period=$langs->trans("Year")." $year"; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink="".img_previous()." ".img_next().""; $description=$langs->trans("RulesCADue"); @@ -101,7 +100,6 @@ if ($modecompta=="CREANCES-DETTES") else { $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //$period=$langs->trans("Year")." $year"; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink="".img_previous()." ".img_next().""; $description=$langs->trans("RulesCAIn"); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index eb451710388..5b67eec34bc 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -57,21 +57,21 @@ if (empty($year)) $year_current = $year; $year_start = $year; } -$date_start=dol_mktime($_REQUEST["date_starthour"],$_REQUEST["date_startmin"],$_REQUEST["date_startsec"],$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"],1); -$date_end=dol_mktime($_REQUEST["date_endhour"],$_REQUEST["date_endmin"],$_REQUEST["date_endsec"],$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"],1); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; if ($q==0) { - if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"]); $date_end=dol_get_last_day($year_start,$_REQUEST["month"]); } - else { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,12); } + if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } + else { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,12,false); } } - if ($q==1) { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,3); } - if ($q==2) { $date_start=dol_get_first_day($year_start,4); $date_end=dol_get_last_day($year_start,6); } - if ($q==3) { $date_start=dol_get_first_day($year_start,7); $date_end=dol_get_last_day($year_start,9); } - if ($q==4) { $date_start=dol_get_first_day($year_start,10); $date_end=dol_get_last_day($year_start,12); } + if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } + if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } + if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } + if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } else { @@ -94,7 +94,6 @@ if ($modecompta=="CREANCES-DETTES") { $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - //$period=$langs->trans("Year")." ".$year; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesCADue"); @@ -104,7 +103,6 @@ if ($modecompta=="CREANCES-DETTES") else { $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //$period=$langs->trans("Year")." ".$year; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesCAIn"); diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 18f328dfb26..e0a102706f1 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -47,21 +47,21 @@ if (empty($year)) $year_current = $year; $year_start = $year; } -$date_start=dol_mktime($_REQUEST["date_starthour"],$_REQUEST["date_startmin"],$_REQUEST["date_startsec"],$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"],1); -$date_end=dol_mktime($_REQUEST["date_endhour"],$_REQUEST["date_endmin"],$_REQUEST["date_endsec"],$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"],1); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; if ($q==0) { - if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"]); $date_end=dol_get_last_day($year_start,$_REQUEST["month"]); } + if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } else $q=1; } - if ($q==1) { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,3); } - if ($q==2) { $date_start=dol_get_first_day($year_start,4); $date_end=dol_get_last_day($year_start,6); } - if ($q==3) { $date_start=dol_get_first_day($year_start,7); $date_end=dol_get_last_day($year_start,9); } - if ($q==4) { $date_start=dol_get_first_day($year_start,10); $date_end=dol_get_last_day($year_start,12); } + if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } + if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } + if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } + if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } else { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index b90a4f81ac2..62b878834b5 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -53,21 +53,21 @@ if (empty($year)) $year_current = $year; $year_start = $year; } -$date_start=dol_mktime($_REQUEST["date_starthour"],$_REQUEST["date_startmin"],$_REQUEST["date_startsec"],$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"],1); -$date_end=dol_mktime($_REQUEST["date_endhour"],$_REQUEST["date_endmin"],$_REQUEST["date_endsec"],$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"],1); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; if ($q==0) { - if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"]); $date_end=dol_get_last_day($year_start,$_REQUEST["month"]); } + if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } else $q=1; } - if ($q==1) { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,3); } - if ($q==2) { $date_start=dol_get_first_day($year_start,4); $date_end=dol_get_last_day($year_start,6); } - if ($q==3) { $date_start=dol_get_first_day($year_start,7); $date_end=dol_get_last_day($year_start,9); } - if ($q==4) { $date_start=dol_get_first_day($year_start,10); $date_end=dol_get_last_day($year_start,12); } + if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } + if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } + if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } + if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } else { @@ -118,8 +118,6 @@ $fsearch.=' '; if ($modetax==1) // Calculate on invoice for goods and services { $nom=$langs->trans("VATReportByQuartersInDueDebtMode"); - //$nom.='
('.$langs->trans("SeeVATReportInInputOutputMode",'','').')'; - //$period=$year_start.' - '.$langs->trans("Quadri")." $q (".dol_print_date(dol_mktime(12,0,0,(($q-1)*3)+1,1,$year_start),"%b %Y").' - '.dol_print_date(dol_mktime(12,0,0,($q*3),1,$year_start),"%b %Y").")"; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); $prevyear=$year_start; $prevquarter=$q; if ($prevquarter > 1) $prevquarter--; @@ -149,8 +147,6 @@ if ($modetax==1) // Calculate on invoice for goods and services if ($modetax==0) // Invoice for goods, payment for services { $nom=$langs->trans("VATReportByQuartersInInputOutputMode"); - //$nom.='
('.$langs->trans("SeeVATReportInDueDebtMode",'','').')'; - //$period=$year_start.' - '.$langs->trans("Quadri")." $q (".dol_print_date(dol_mktime(12,0,0,(($q-1)*3)+1,1,$year_start),"%b %Y").' - '.dol_print_date(dol_mktime(12,0,0,($q*3),1,$year_start),"%b %Y").")"; $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); $prevyear=$year_start; $prevquarter=$q; if ($prevquarter > 1) $prevquarter--; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 50d17e0dd6f..89147086324 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -2251,10 +2251,10 @@ class Form * Affiche zone de selection de date * Liste deroulante pour les jours, mois, annee et eventuellement heurs et minutes * Les champs sont pre-selectionnes avec: - * - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM) - * - La date du jour si set_time vaut '' + * - La date set_time (Local PHP server timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM) + * - La date local du server PHP si set_time vaut '' * - Aucune date (champs vides) si set_time vaut -1 (dans ce cas empty doit valoir 1) - * @param set_time Date de pre-selection + * @param set_time Pre-selected date (must be a local PHP server timestamp) * @param prefix Prefix pour nom champ * @param h 1=Affiche aussi les heures * @param m 1=Affiche aussi les minutes @@ -2291,11 +2291,11 @@ class Form elseif (strval($set_time) != '' && $set_time != -1) { // set_time est un timestamps (0 possible) - $syear = dol_print_date($set_time, "%Y", true); - $smonth = dol_print_date($set_time, "%m", true); - $sday = dol_print_date($set_time, "%d", true); - $shour = dol_print_date($set_time, "%H", true); - $smin = dol_print_date($set_time, "%m", true); + $syear = dol_print_date($set_time, "%Y"); + $smonth = dol_print_date($set_time, "%m"); + $sday = dol_print_date($set_time, "%d"); + $shour = dol_print_date($set_time, "%H"); + $smin = dol_print_date($set_time, "%M"); } else { @@ -2402,16 +2402,16 @@ class Form $retstring.=''; } - // Mois + // Month for ($month = 1 ; $month <= 12 ; $month++) { $retstring.='"; } $retstring.=""; - // Ann�e + // Year if ($empty || $set_time == -1) { $retstring.=''; diff --git a/htdocs/lib/databases/mssql.lib.php b/htdocs/lib/databases/mssql.lib.php index 62be1119f55..c6f38fdd618 100644 --- a/htdocs/lib/databases/mssql.lib.php +++ b/htdocs/lib/databases/mssql.lib.php @@ -711,13 +711,13 @@ class DoliDb function encrypt($fieldorvalue, $withQuotes=0) { global $conf; - + // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); - + //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); - + $return = $fieldorvalue; return ($withQuotes?"'":"").$return.($withQuotes?"'":""); } @@ -730,13 +730,13 @@ class DoliDb function decrypt($value) { global $conf; - + // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); - + //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); - + $return = $value; return $return; } diff --git a/htdocs/lib/databases/pgsql.lib.php b/htdocs/lib/databases/pgsql.lib.php index 4b64115adfd..92eeb008d5c 100644 --- a/htdocs/lib/databases/pgsql.lib.php +++ b/htdocs/lib/databases/pgsql.lib.php @@ -805,13 +805,13 @@ class DoliDb function encrypt($fieldorvalue, $withQuotes=0) { global $conf; - + // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); - + //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); - + $return = $fieldorvalue; return ($withQuotes?"'":"").$return.($withQuotes?"'":""); } @@ -825,13 +825,13 @@ class DoliDb function decrypt($value) { global $conf; - + // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); - + //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); - + $return = $value; return $return; } diff --git a/htdocs/lib/date.lib.php b/htdocs/lib/date.lib.php index 7b7cd2ab186..31780d8ac46 100644 --- a/htdocs/lib/date.lib.php +++ b/htdocs/lib/date.lib.php @@ -125,23 +125,23 @@ function dol_get_next_month($month, $year) } -/** \brief Return GMT time with international string format for first day of a month or year +/** \brief Return GMT time for first day of a month or year * \param year Year * \param month Month * \return Timestamp Date for first day */ -function dol_get_first_day($year,$month=1) +function dol_get_first_day($year,$month=1,$gm=true) { - return dol_mktime(0,0,0,$month,1,$year,1); + return dol_mktime(0,0,0,$month,1,$year,$gm); } -/** \brief Return GMT time with international string format for last day of a month or year +/** \brief Return GMT time for last day of a month or year * \param year Year * \param month Month * \return Timestamp Date for first day */ -function dol_get_last_day($year,$month=12) +function dol_get_last_day($year,$month=12,$gm=true) { if ($month == 12) { @@ -154,7 +154,7 @@ function dol_get_last_day($year,$month=12) } // On se deplace au debut du mois suivant, et on retire un jour - $datelim=dol_mktime(23,59,59,$month,1,$year,1); + $datelim=dol_mktime(23,59,59,$month,1,$year,$gm); $datelim -= (3600 * 24); return $datelim; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index c7fc1557a3b..d9d4ebdd324 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -405,7 +405,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc /** * \brief Output date in a string format according to outputlangs (or langs if not defined). * Return charset is always UTF-8, except if encodetoouput is defined. In this cas charset is output charset. - * \param time GM Timestamps date (or 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' in server TZ) + * \param time GM Timestamps date (or 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS') * \param format Output date format * "%d %b %Y", * "%d/%m/%Y %H:%M", @@ -466,7 +466,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto $smin = $reg[5]; $ssec = $reg[6]; - $time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear); + $time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true); $ret=adodb_strftime($format,$time,$to_gmt); } else @@ -598,13 +598,13 @@ function dol_getdate($timestamp,$fast=false) } /* For backward compatibility */ -function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1) +function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) { return dol_mktime($hour,$minute,$second,$month,$day,$year,$gm,$check); } /** - * Return a GMT date built from detailed informations + * Return a timestamp date built from detailed informations (by default a local PHP server timestamp) * Replace function mktime not available under Windows if year < 1970 * PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows * @param hour Hour (can be -1 for undefined) @@ -613,12 +613,12 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1) * @param month Month * @param day Day * @param year Year - * @param gm 1=Input informations are GMT values, otherwise local to user + * @param gm 1=Input informations are GMT values, otherwise local to server TZ * @param check 0=No check on parameters (Can use day 32, etc...) * @return timestamp Date en timestamp, '' if error * @see dol_date, dol_stringtotime */ -function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1) +function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) { //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; @@ -664,7 +664,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1) /* For backward compatibility */ -function dolibarr_date($fmt, $timestamp, $gm=0) +function dolibarr_date($fmt, $timestamp, $gm=false) { return dol_date($fmt, $timestamp, $gm); } @@ -677,7 +677,7 @@ function dolibarr_date($fmt, $timestamp, $gm=0) * \return string Formated date * \see dol_mktime, dol_stringtotime */ -function dol_date($fmt, $timestamp, $gm=0) +function dol_date($fmt, $timestamp, $gm=false) { $usealternatemethod=false; if ($timestamp <= 0) $usealternatemethod=true;