From d4ca08db00fa50fa146b65f9f320bc741b04d5cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 May 2012 21:27:29 +0200 Subject: [PATCH 01/21] Fix: Bug #402 --- htdocs/master.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index f6582df07fd..591a4aabccf 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -267,6 +267,6 @@ if (! defined('NOREQUIRETRAN')) if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); // We force feature to help debug -$conf->global->MAIN_JS_ON_PAYMENT=1; +//$conf->global->MAIN_JS_ON_PAYMENT=0; // We disable this. See bug #402 on doliforge ?> From be85c5c381bb9a446dddf73773d8922380470a08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 May 2012 12:32:24 +0200 Subject: [PATCH 02/21] Fix: [ bug #404 ] Impossible d'ajouter un contact lorsque le module LDAP est actif (erreur Array 1) --- htdocs/contact/class/contact.class.php | 4 ++-- htdocs/contact/fiche.php | 12 ++++++------ htdocs/contact/ldap.php | 6 ++++-- htdocs/core/class/ldap.class.php | 7 ++++--- .../interface_50_modLdap_Ldapsynchro.class.php | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a1c9418ef8a..d35526b1f13 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -131,7 +131,7 @@ class Contact extends CommonObject $sql.= "'".$this->db->idate($now)."',"; if ($this->socid > 0) $sql.= " ".$this->socid.","; else $sql.= "null,"; - $sql.= "'".$this->db->escape($this->name)."',"; + $sql.= "'".$this->db->escape($this->lastname)."',"; $sql.= "'".$this->db->escape($this->firstname)."',"; $sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").","; $sql.= " ".$this->priv.","; @@ -330,7 +330,7 @@ class Contact extends CommonObject // Fields if ($this->fullname && $conf->global->LDAP_CONTACT_FIELD_FULLNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FULLNAME] = $this->fullname; - if ($this->name && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->name; + if ($this->lastname && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->lastname; if ($this->firstname && $conf->global->LDAP_CONTACT_FIELD_FIRSTNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname; if ($this->poste) $info["title"] = $this->poste; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index c3f307f6b34..0f8f82b6507 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -159,13 +159,13 @@ if (empty($reshook)) $error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")); $action = 'create'; } - + if (! $error) { $id = $object->create($user); if ($id <= 0) { - $error++; $errors[]=($object->error?array($object->error):$object->errors); + $error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors)); $action = 'create'; } } @@ -199,7 +199,7 @@ if (empty($reshook)) } else { - $error=$object->error; $errors[]=$object->errors; + $error=$object->error; $errors=$object->errors; } } @@ -355,7 +355,7 @@ else print_fiche_titre($title); // Affiche les erreurs - dol_htmloutput_errors($error,$errors); + dol_htmloutput_errors(is_numeric($error)?'':$error,$errors); if ($conf->use_javascript_ajax) { @@ -689,7 +689,7 @@ else } } - if (! empty($id) && $action != 'edit') + if (! empty($id) && $action != 'edit' && $action != 'create') { $objsoc = new Societe($db); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 15b359c8ff5..e8ed38b57cb 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -32,6 +32,8 @@ $langs->load("companies"); $langs->load("ldap"); $langs->load("admin"); +$action=GETPOST('action'); + // Security check $contactid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id) $socid=$user->societe_id; @@ -45,7 +47,7 @@ $contact->fetch($_GET["id"], $user); * Actions */ -if ($_GET["action"] == 'dolibarr2ldap') +if ($action == 'dolibarr2ldap') { $message=""; @@ -133,7 +135,7 @@ print ''; print ''; -if ($message) { print $message; } +dol_htmloutput_mesg($message); /* diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index dbb26219f2f..9ca0b596792 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -411,7 +411,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::add dn=".$dn." info=".join(',',$info)); + dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',',$info)); // Check parameters if (! $this->connection) @@ -439,13 +439,14 @@ class Ldap if ($result) { - dol_syslog("Ldap::add successfull", LOG_DEBUG); + dol_syslog(get_class($this)."::add successfull", LOG_DEBUG); return 1; } else { $this->error=@ldap_error($this->connection); - dol_syslog("Ldap::add failed: ".$this->error, LOG_ERR); + $this->errno=@ldap_errno($this->connection); + dol_syslog(get_class($this)."::add failed: ".$this->errno." ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index ccc7d65af6d..3d6c7b01333 100755 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2012 Laurent Destailleur * * 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 From e94b20f684cc465cc166e03d4b2c6cc95f74353f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 May 2012 15:27:22 +0200 Subject: [PATCH 03/21] Fix: SQL error --- htdocs/comm/action/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index d9d7b2fb550..84067085528 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -741,7 +741,7 @@ if ($id) // Contact print ''.$langs->trans("Contact").''; - print $form->selectarray("contactid", $act->societe->contact_array(), $act->contact->id, 1); + print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1); print ''; // Project From da0dc3472b6a73d9b4e744c7dc55f6d6aead6cde Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 May 2012 15:59:28 +0200 Subject: [PATCH 04/21] Fix: Pb with backtopage Conflicts: htdocs/adherents/fiche.php --- htdocs/comm/action/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 84067085528..2efad0d3cf4 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -420,7 +420,7 @@ if ($action == 'create') print '
'; print ''; print ''; - print ''; + if ($backtopage) print ''; if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); else print_fiche_titre($langs->trans("AddAnAction")); @@ -673,7 +673,7 @@ if ($id) print ''; print ''; print ''; - print ''; + if ($backtopage) print ''; print ''; From 4278a113a0963bf8f42a8affd32456ef6b3c8235 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 May 2012 16:31:51 +0200 Subject: [PATCH 05/21] Fix: hour reported is not user hour. To fix this, we show both hour "server and user" but only if it differs. Conflicts: htdocs/core/lib/functions2.lib.php --- htdocs/core/lib/functions2.lib.php | 65 +++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 459adc66517..d459ffb2a6a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -91,6 +91,7 @@ function dol_print_file($langs,$filename,$searchalt=0) /** * Show informations on an object + * TODO Move this into html.formother * * @param Object $object Objet to show * @return void @@ -100,6 +101,9 @@ function dol_print_object_info($object) global $langs,$db; $langs->load("other"); + $deltadateforuser=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']); + //$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']); + // Import key if (isset($object->import_key)) print $langs->trans("ImportedWithSet")." : " . $object->import_key . '
'; @@ -123,7 +127,11 @@ function dol_print_object_info($object) // Date 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,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_creation+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } // User change if (isset($object->user_modification)) @@ -144,7 +152,11 @@ function dol_print_object_info($object) // Date 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,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_modification+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } // User validation if (isset($object->user_validation)) @@ -165,7 +177,36 @@ function dol_print_object_info($object) // Date 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,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_validation+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } + + // User approve + if (isset($object->user_approve)) + { + print $langs->trans("ApprovedBy")." : "; + if (is_object($object->user_approve)) + { + print $object->user_approve->getNomUrl(1); + } + else + { + $userstatic=new User($db); + $userstatic->fetch($object->user_approve); + print $userstatic->getNomUrl(1); + } + print '
'; + } + + // Date approve + if (isset($object->date_approve)) + { + print $langs->trans("DateApprove")." : " . dol_print_date($object->date_approve,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_approve+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } // User close if (isset($object->user_cloture)) @@ -186,7 +227,11 @@ function dol_print_object_info($object) // Date 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,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_cloture+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } // User conciliate if (isset($object->user_rappro)) @@ -207,11 +252,19 @@ function dol_print_object_info($object) // Date 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,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_rappro+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } //Date send 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,"dayhourtext"); + if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_envoi+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + print '
'; + } } /** From 230f4f8f57f7658440f222855525728e5c2c526b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 May 2012 18:31:04 +0200 Subject: [PATCH 06/21] Fix: Missing lang --- htdocs/core/lib/functions2.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index d459ffb2a6a..a7e870d5da9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -100,6 +100,7 @@ function dol_print_object_info($object) { global $langs,$db; $langs->load("other"); + $langs->load("admin"); $deltadateforuser=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']); //$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']); From ee31359488e74224e92d359ceed70894f24d3253 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 May 2012 14:33:46 +0200 Subject: [PATCH 07/21] Fix: pgsql compatibility not complete. --- htdocs/core/db/pgsql.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index cf087ec072c..75e84845744 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -231,7 +231,7 @@ class DoliDBPgsql } // We remove end of requests "AFTER fieldxxx" - $line=preg_replace('/AFTER [a-z0-9_]+/i','',$line); + $line=preg_replace('/\sAFTER [a-z0-9_]+/i','',$line); // We remove start of requests "ALTER TABLE tablexxx" if this is a DROP INDEX $line=preg_replace('/ALTER TABLE [a-z0-9_]+ DROP INDEX/i','DROP INDEX',$line); @@ -258,7 +258,7 @@ class DoliDBPgsql } // alter table add primary key (field1, field2 ...) -> We remove the primary key name not accepted by PostGreSQL - // ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity); + // ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity) if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+PRIMARY\s+KEY\s*(.*)\s*\((.*)$/i',$line,$reg)) { $line = "-- ".$line." replaced by --\n"; @@ -266,14 +266,21 @@ class DoliDBPgsql } // Translate order to drop foreign keys - // ALTER TABLE llx_dolibarr_modules DROP FOREIGN KEY fk_xxx; + // ALTER TABLE llx_dolibarr_modules DROP FOREIGN KEY fk_xxx if (preg_match('/ALTER\s+TABLE\s*(.*)\s*DROP\s+FOREIGN\s+KEY\s*(.*)$/i',$line,$reg)) { $line = "-- ".$line." replaced by --\n"; $line.= "ALTER TABLE ".$reg[1]." DROP CONSTRAINT ".$reg[2]; } - // alter table add [unique] [index] (field1, field2 ...) + // Translate order to add foreign keys + // ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid) + if (preg_match('/ALTER\s+TABLE\s+(.*)\s*ADD CONSTRAINT\s+(.*)\s*FOREIGN\s+KEY\s*(.*)$/i',$line,$reg)) + { + $line.=" DEFERRABLE INITIALLY IMMEDIATE"; + } + + // alter table add [unique] [index] (field1, field2 ...) // ALTER TABLE llx_accountingaccount ADD INDEX idx_accountingaccount_fk_pcg_version (fk_pcg_version) if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+(UNIQUE INDEX|INDEX|UNIQUE)\s+(.*)\s*\(([\w,\s]+)\)/i',$line,$reg)) { From 4a4cdc0839a18669c3db254563f63d533901ec8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 May 2012 20:58:36 +0200 Subject: [PATCH 08/21] Fix: Style --- htdocs/theme/bureau2crea/style.css.php | 49 +++++++++----------------- htdocs/theme/cameleo/style.css.php | 2 +- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 365367f33b1..374cc0ed24f 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -296,6 +296,8 @@ div.tmenu { margin: 5px 0px 10px 0px; font-size: 13px; background-image : url(); + background-repeat: no-repeat; + background-color: #996644; height: 22px; border-bottom: 2px solid #842F00; @@ -452,14 +454,12 @@ li.tmenu span, li.tmenusel span { margin: 0px 10px 0px 10px; } -li.tmenu { - } .tmenuimage { -margin: 0 !important; -padding: 0 !important; + margin: 0 !important; + padding: 0 !important; } -li.tmenu a { +li.tmenu a, li.tmenusel a { position: relative; display: block; height: 22px; @@ -469,53 +469,36 @@ li.tmenu a { color: #FFF; font-weight: normal; float: ; - } +} li.tmenu a:hover { color: #FFFFFF; background-color: #D45416; - } +} -li.tmenu a.tmenusel, -li.tmenu a.tmenusel:hover { +li.tmenu a.tmenusel, li.tmenu a.tmenusel:hover, li.tmenusel a.tmenusel, li.tmenusel a.tmenusel:hover { color: #842F00; font-weight: bold; background-color: #FFF; - } + font-weight: normal; +} -li.tmenu .tmenusel { +li.tmenu .tmenusel, li.tmenusel .tmenusel { background: #FFFFFF; - } - +} li.tmenusel { background-image : url(); background-position: right; - } - -li.tmenusel a.tmenusel { - position: relative; - display: block; - width: 100%; - height: 22px; - background-image : url(); - background-position: left; - background-repeat: no-repeat; - font-size: 12px; - font-family: Geneva, Verdana, sans-serif; - line-height: 25px; - color: #303030; - font-weight: normal; - float: left; - } +} li.tmenusel a:hover { color: #474747; - } +} li.tmenu a.tmenudisabled { color: #CCC; - } +} /* --- end nav --- */ @@ -1261,7 +1244,7 @@ padding: 0px; } .boxhandle { - margin: 1px 4px 0px 0px; + margin: 1px 1px 0px 0px; } .notopnoleft { diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 4e09c1c61c0..63ee093b245 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -357,7 +357,7 @@ ul.tmenu { /* t r b l */ margin: 0px 0px 0px 6px; list-style: none; } -li.tmenu { +li.tmenu, li.tmenusel { text-align: center; vertical-align: top; float: ; From 06679ede7ca8c06c2d437cd2d139f016a7a5b3b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 May 2012 14:43:41 +0200 Subject: [PATCH 09/21] Fix: style --- htdocs/theme/bureau2crea/style.css.php | 47 ++++++++++++++++++-------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 374cc0ed24f..df90863d786 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -296,8 +296,6 @@ div.tmenu { margin: 5px 0px 10px 0px; font-size: 13px; background-image : url(); - background-repeat: no-repeat; - background-color: #996644; height: 22px; border-bottom: 2px solid #842F00; @@ -454,12 +452,14 @@ li.tmenu span, li.tmenusel span { margin: 0px 10px 0px 10px; } +li.tmenu { + } .tmenuimage { - margin: 0 !important; - padding: 0 !important; +margin: 0 !important; +padding: 0 !important; } -li.tmenu a, li.tmenusel a { +li.tmenu a { position: relative; display: block; height: 22px; @@ -469,36 +469,53 @@ li.tmenu a, li.tmenusel a { color: #FFF; font-weight: normal; float: ; -} + } li.tmenu a:hover { color: #FFFFFF; background-color: #D45416; -} + } -li.tmenu a.tmenusel, li.tmenu a.tmenusel:hover, li.tmenusel a.tmenusel, li.tmenusel a.tmenusel:hover { +li.tmenu a.tmenusel, +li.tmenu a.tmenusel:hover { color: #842F00; font-weight: bold; background-color: #FFF; - font-weight: normal; -} + } -li.tmenu .tmenusel, li.tmenusel .tmenusel { +li.tmenu .tmenusel { background: #FFFFFF; -} + } + li.tmenusel { background-image : url(); background-position: right; -} + } + +li.tmenusel a.tmenusel { + position: relative; + display: block; + width: 100%; + height: 22px; + background-image : url(); + background-position: left; + background-repeat: no-repeat; + font-size: 12px; + font-family: Geneva, Verdana, sans-serif; + line-height: 25px; + color: #303030; + font-weight: normal; + float: left; + } li.tmenusel a:hover { color: #474747; -} + } li.tmenu a.tmenudisabled { color: #CCC; -} + } /* --- end nav --- */ From 91faac4c8733f5f83c442d13c56e6216c97700b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 May 2012 14:26:25 +0200 Subject: [PATCH 10/21] Fix: Bad phpunit test --- test/phpunit/ContactTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index cd2c0c1f18e..00c5c99985a 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -181,6 +181,8 @@ class ContactTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; + $localobject->oldcopy=dol_clone($localobject); + $localobject->note='New note after update'; //$localobject->note_public='New note public after update'; $localobject->lastname='New name'; @@ -304,7 +306,7 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject=new Contact($this->savdb); $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $result=$localobject->delete(0); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0); From 964bb0968fe2a6886548cf7b6e73e72557871916 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 May 2012 14:27:51 +0200 Subject: [PATCH 11/21] Fix: Missing log when error --- htdocs/contact/class/contact.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d35526b1f13..e9b7067853b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -744,6 +744,7 @@ class Contact extends CommonObject else { $this->db->rollback(); + dol_syslog("Error ".$this->error,LOG_ERR); return -1; } } From e13696db55286a2671b62ec5e39a3b4a5a04bba6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 May 2012 16:41:45 +0200 Subject: [PATCH 12/21] Fix: syntax error in name of pgsql util proc. Fix: Add a proc to fix pgsql problems. --- htdocs/install/pgsql/functions/functions.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index b5609136087..ede2a5145d0 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -49,8 +49,11 @@ CREATE OR REPLACE FUNCTION DAY(DATE) RETURNS INTEGER AS $$ SELECT EXTRACT(DAY FR CREATE OR REPLACE FUNCTION update_modified_column() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE 'PLPGSQL'; - -CREATE OR REPLACE FUNCTION rebuilt_sequences() RETURNS integer as $body$ DECLARE sequencedefs RECORD; c integer ; BEGIN FOR sequencedefs IN SELECT DISTINCT constraint_column_usage.table_name as tablename, constraint_column_usage.table_name as tablename, constraint_column_usage.column_name as columnname, replace(replace(columns.column_default,'''::regclass)',''),'nextval(''','') as sequencename from information_schema.constraint_column_usage, information_schema.columns where constraint_column_usage.table_schema ='public' AND columns.table_schema = 'public' AND columns.table_name=constraint_column_usage.table_name AND constraint_column_usage.column_name IN ('rowid','id') AND constraint_column_usage.column_name = columns.column_name AND columns.column_default is not null LOOP EXECUTE 'select max('||sequencedefs.columnname||') from ' || sequencedefs.tablename INTO c; IF c is null THEN c = 0; END IF; IF c is not null THEN c = c+ 1; END IF; EXECUTE 'alter sequence ' || sequencedefs.sequencename ||' restart with ' || c; END LOOP; RETURN 1; END; $body$ LANGUAGE 'PLPGSQL'; + + +CREATE OR REPLACE FUNCTION dol_util_rebuild_sequences() RETURNS integer as $body$ DECLARE sequencedefs RECORD; c integer ; BEGIN FOR sequencedefs IN SELECT DISTINCT constraint_column_usage.table_name as tablename, constraint_column_usage.table_name as tablename, constraint_column_usage.column_name as columnname, replace(replace(columns.column_default,'''::regclass)',''),'nextval(''','') as sequencename from information_schema.constraint_column_usage, information_schema.columns where constraint_column_usage.table_schema ='public' AND columns.table_schema = 'public' AND columns.table_name=constraint_column_usage.table_name AND constraint_column_usage.column_name IN ('rowid','id') AND constraint_column_usage.column_name = columns.column_name AND columns.column_default is not null LOOP EXECUTE 'select max('||sequencedefs.columnname||') from ' || sequencedefs.tablename INTO c; IF c is null THEN c = 0; END IF; IF c is not null THEN c = c+ 1; END IF; EXECUTE 'alter sequence ' || sequencedefs.sequencename ||' restart with ' || c; END LOOP; RETURN 1; END; $body$ LANGUAGE 'PLPGSQL'; + +CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer AS $BODY$ DECLARE mytables RECORD; BEGIN FOR mytables IN SELECT relname FROM pg_class WHERE relhastriggers IS TRUE AND relkind = 'r' AND NOT relname LIKE 'pg_%' LOOP IF DoEnable THEN EXECUTE 'ALTER TABLE ' || mytables.relname || ' ENABLE TRIGGER ALL'; ELSE EXECUTE 'ALTER TABLE ' || mytables.relname || ' DISABLE TRIGGER ALL'; END IF; END LOOP; RETURN 1; END; $BODY$ LANGUAGE 'PLPGSQL'; -- Add triggers From 5c62e8865acb4ab7ccca2cbb2ec069661b428143 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 May 2012 17:11:31 +0200 Subject: [PATCH 13/21] Fix: W3C --- htdocs/admin/syslog.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index c56bdf347e7..aa835cdd96e 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * @@ -178,14 +178,14 @@ $var=true; $var=!$var; print '
'; -print ''; print "'; $var=!$var; print ''; -print ''; print "'; @@ -202,7 +202,7 @@ try if (! class_exists('FirePHP')) print ' disabled="disabled"'; else print ($syslog_firephp_on?' checked="checked"':""); print '> '.$langs->trans("FirePHP").''; - print ''; print "'; @@ -232,7 +232,7 @@ print ''; +print ''; print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php $var=!$var; print ''."\n"; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index f535ab2ae29..5eebb0de99d 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -77,7 +77,7 @@ function getServerTimeZoneString() * Return server timezone int. * 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) */ function getServerTimeZoneInt($refgmtdate='now') @@ -92,8 +92,17 @@ function getServerTimeZoneInt($refgmtdate='now') } else { - // Method 2 (does not include daylight) - $tmp=dol_mktime(0,0,0,1,1,1970); + // Method 2 (does not include daylight, not supported by adodb) + 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); return $tz; @@ -781,4 +790,4 @@ function monthArray($outputlangs) return $montharray; } -?> \ No newline at end of file +?> diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a745e8e10a3..897fc62383b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1007,7 +1007,7 @@ function dol_now($mode='gmt') else if ($mode == 'tzserver') // Time for now with PHP server timezone added { 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); } /*else if ($mode == 'tzref') // Time for now with parent company timezone is added diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index a7e870d5da9..d028322987a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -102,8 +102,13 @@ function dol_print_object_info($object) $langs->load("other"); $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']); + $deltadateforuser=round($deltadateforclient-$deltadateforserver); + //print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser; // Import key if (isset($object->import_key)) @@ -129,8 +134,8 @@ function dol_print_object_info($object) // Date if (isset($object->date_creation)) { - print $langs->trans("DateCreation")." : " . dol_print_date($object->date_creation,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_creation+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } @@ -154,8 +159,8 @@ function dol_print_object_info($object) // Date if (isset($object->date_modification)) { - print $langs->trans("DateLastModification")." : " . dol_print_date($object->date_modification,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_modification+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } @@ -179,8 +184,8 @@ function dol_print_object_info($object) // Date if (isset($object->date_validation)) { - print $langs->trans("DateValidation")." : " . dol_print_date($object->date_validation,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_validation+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } @@ -204,8 +209,8 @@ function dol_print_object_info($object) // Date approve if (isset($object->date_approve)) { - print $langs->trans("DateApprove")." : " . dol_print_date($object->date_approve,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_approve+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } @@ -229,8 +234,8 @@ function dol_print_object_info($object) // Date if (isset($object->date_cloture)) { - print $langs->trans("DateClosing")." : " . dol_print_date($object->date_cloture,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_cloture+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } @@ -254,16 +259,16 @@ function dol_print_object_info($object) // Date if (isset($object->date_rappro)) { - print $langs->trans("DateConciliating")." : " . dol_print_date($object->date_rappro,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_rappro+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } //Date send if (isset($object->date_envoi)) { - print $langs->trans("DateLastSend")." : " . dol_print_date($object->date_envoi,"dayhourtext"); - if ($deltadateforuser) print '  '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_envoi+($deltadateforuser*3600),"dayhourtext").'  '.$langs->trans("ClientHour"); + 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),"dayhour").'  '.$langs->trans("ClientHour"); print '
'; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 38b3fe7728e..46bdacba818 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -107,7 +107,7 @@ OSTZ=Time Zone OS server PHPTZ=Time Zone PHP server PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds) ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds) -DaylingSavingTime=Daylight saving time (user) +DaylingSavingTime=Daylight saving time CurrentHour=Hour PHP (server) CompanyTZ= Time Zone company (main company) CompanyHour= Hour company (main company) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6561c3b9749..860ed1816c1 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -108,7 +108,7 @@ OSTZ= Time Zone OS PHPTZ= Time Zone config PHP PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes) ClientOffsetWithGreenwich= Offset client/navigateur avec Greenwich (secondes) -DaylingSavingTime=Heure d'été (utilisateur) +DaylingSavingTime=Heure d'été CurrentHour= Heure PHP (serveur) CompanyTZ= Time Zone société (maison mère) CompanyHour= Heure société (maison mère) diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php index 2a81b2e6d4e..2952389ba76 100755 --- a/test/phpunit/FunctionsTest.php +++ b/test/phpunit/FunctionsTest.php @@ -322,9 +322,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $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"; - $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 } @@ -337,8 +337,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $now=dol_now('gmt'); $nowtzserver=dol_now('tzserver'); - print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt()*3600)."\n"; - $this->assertEquals(getServerTimeZoneInt()*3600,($nowtzserver-$now)); + print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt('now')*3600)."\n"; + $this->assertEquals(getServerTimeZoneInt('now')*3600,($nowtzserver-$now)); } /** @@ -395,4 +395,4 @@ class FunctionsTest extends PHPUnit_Framework_TestCase $this->assertEquals($arraytotest,$decoded); } } -?> \ No newline at end of file +?> From 0ade601a1195f912d91236b253b1fbc62ec51d75 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 14 May 2012 20:05:39 +0200 Subject: [PATCH 19/21] Fix: add quote with date --- scripts/invoices/rebuild_merge_pdf.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 842bf467e2f..45f112e071b 100644 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -181,8 +181,8 @@ if (in_array('date',$filter)) if (empty($sqlwhere)) $sqlwhere=' WHERE '; else $sqlwhere.=" AND"; $sqlwhere.= " f.fk_statut > 0"; - $sqlwhere.= " AND f.datef >= ".$db->idate($dateafterdate); - $sqlwhere.= " AND f.datef <= ".$db->idate($datebeforedate); + $sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'"; + $sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'"; $sqlorder = " ORDER BY f.datef ASC"; } if (in_array('nopayment',$filter)) @@ -202,8 +202,8 @@ if (in_array('payments',$filter)) $sqlwhere.= " f.fk_statut > 0"; $sqlwhere.= " AND f.rowid = pf.fk_facture"; $sqlwhere.= " AND pf.fk_paiement = p.rowid"; - $sqlwhere.= " AND p.datep >= ".$db->idate($paymentdateafter); - $sqlwhere.= " AND p.datep <= ".$db->idate($paymentdatebefore); + $sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'"; + $sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'"; $sqlorder = " ORDER BY p.datep ASC"; } if (in_array('nodeposit',$filter)) From 94f9fb2e2fd093c088c3a9f8d55386e1263a1245 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 May 2012 00:48:59 +0200 Subject: [PATCH 20/21] Fix: daylight depends also on year (not only month and day) --- htdocs/admin/system/dolibarr.php | 7 ++++--- htdocs/core/lib/date.lib.php | 26 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 1dfe1eb03e7..e6c2f1f88f7 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -160,11 +160,12 @@ print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php $var=!$var; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 5eebb0de99d..cdf8cc1b9b8 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -86,25 +86,39 @@ function getServerTimeZoneInt($refgmtdate='now') if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE)) { // Method 1 (include daylight) + $gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d'); + if ($refgmtdate == 'now') $newrefgmtdate=$yearref.'-'.$monthref.'-'.$dayref; + elseif ($refgmtdate == 'summer') $newrefgmtdate=$yearref.'-05-15'; + else $newrefgmtdate=$yearref.'-01-01'; $localtz = new DateTimeZone(getServerTimeZoneString()); - $localdt = new DateTime($refgmtdate, $localtz); + $localdt = new DateTime($newrefgmtdate, $localtz); $tmp=-1*$localtz->getOffset($localdt); + //print $refgmtdate.'='.$tmp; } else { // Method 2 (does not include daylight, not supported by adodb) if ($refgmtdate == 'now') { - $gmtnow=dol_now('gmt'); - $monthnow=dol_print_date($gmtnow,'%m'); $daynow=dol_print_date($gmtnow,'%d'); + // We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE. + $gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=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); + $tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600); + return 'unknown'; + } + elseif ($refgmtdate == 'summer') + { + // We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE. + $gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref='08'; $dayref='01'; + if (dol_stringtotime($_SESSION['dol_dst_first']) <= dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) && dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1; + else $daylight=0; + $tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600); + return 'unknown'; } - 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=round(($tmp<0?1:-1)*abs($tmp/3600)); return $tz; } From 68c1fa6c3451aa27c5876f44f476f5c4d0c91294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Mon, 14 May 2012 11:46:42 +0200 Subject: [PATCH 21/21] Fix: error in syslog call --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 27dca55e1e4..64dc2ec393e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1519,7 +1519,7 @@ class Facture extends CommonObject $now=dol_now(); $error=0; - dol_syslog(get_class($this).'::validate force_number='.$force_number,' idwarehouse='.$idwarehouse, LOG_WARNING); + dol_syslog(get_class($this).'::validate force_number='.$force_number.', idwarehouse='.$idwarehouse, LOG_WARNING); // Check parameters if (! $this->brouillon)
'.$langs->trans("SyslogSimpleFile").''.$langs->trans("SyslogFilename").': '; +print ''.$langs->trans("SyslogFilename").': '; print '".$form->textwithpicto('',$langs->trans("YouCanUseDOL_DATA_ROOT")); print '
'.$langs->trans("SyslogSyslog").''.$langs->trans("SyslogFacility").': '; +print ''.$langs->trans("SyslogFacility").': '; print '".$form->textwithpicto('','Only LOG_USER supported on Windows'); print '
'; + print ''; print '".$form->textwithpicto('','FirePHP must be installed onto PHP and FirePHP plugin for Firefox must also be installed'); print '
\n"; $var=true; $var=!$var; -print '
'.$langs->trans("SyslogLevel").'
'.$langs->trans("SyslogLevel").'
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP -$a=getServerTimeZoneString(); -$a.=' '.(getServerTimeZoneInt()>=0?'+':'').getServerTimeZoneInt(); -$a.=' ('.(getServerTimeZoneInt()>=0?'+':'').(getServerTimeZoneInt()*3600).')'; -print $form->textwithtooltip($a,$txt,2,1,img_info('')); +$a=getServerTimeZoneInt('now'); +$b=getServerTimeZoneInt('winter'); +$c=getServerTimeZoneInt('summer'); +$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 '
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(),'dayhour','tzserver').'
'.$langs->trans("CurrentTimeZone").'=0?'+':'').$a; -$val.=' ('.($a>=0?'+':'').($a*3600).')'; +$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')'; $val.='       '.getServerTimeZoneString().' '.($b>=0?'+':'').$b.' ('.($b>=0?'+':'').($b*3600).')'; -$val.='       '.$langs->trans("DaylingSavingTime").': '.yn($daylight); +$val.='       '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight)); print $form->textwithtooltip($val,$txt,2,1,img_info('')); print '