From af7c1d8da17661a9a525521745d986f8f5c10e87 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 27 Mar 2018 18:39:18 +0200 Subject: [PATCH 1/3] fix error log --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8d08b828fd1..7fc131fbd82 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4787,6 +4787,7 @@ abstract class CommonObject if (! $resql) { $this->error=$this->db->lasterror(); + dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -5804,7 +5805,7 @@ abstract class CommonObject { $labeltoshow = ''.$labeltoshow.''; } - + if (empty($onetrtd)) $out .= ''; else $out .= ''; From 3dd9d47089271e26a20f9cb0a69375e37df4e64f Mon Sep 17 00:00:00 2001 From: Sean Wang Date: Thu, 29 Mar 2018 14:49:06 +0800 Subject: [PATCH 2/3] Fix wrong approve time in expense report The approve time showed was 8 hours more than the real time. Checking database turned out that it had the wrong data(+8 hours). After checking every timezone related settings were correct, I found that it do twice idate() in setApproved(). Since we have idate() in $sql, we don't need the idate() at the line 1249. --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9f51b04a1f1..c2eacf4aa76 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1246,7 +1246,7 @@ class ExpenseReport extends CommonObject $error = 0; // date approval - $this->date_approve = $this->db->idate($now); + $this->date_approve = $now; if ($this->fk_statut != 5) { $this->db->begin(); From 78812ef82687fa5ee9a0529ffb560879f896c50f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 29 Mar 2018 09:35:47 +0200 Subject: [PATCH 3/3] better error management --- htdocs/core/class/commonobject.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7fc131fbd82..44218f12dfd 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2307,11 +2307,13 @@ abstract class CommonObject if (! $this->table_element) { + $this->error='update_note was called on objet with property table_element not defined'; dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); return -1; } if (! in_array($suffix,array('','_public','_private'))) { + $this->error='update_note Parameter suffix must be empty, \'_private\' or \'_public\''; dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); return -2; }