瀏覽代碼

Fix error management

Laurent Destailleur 8 年之前
父節點
當前提交
cbc6684ea7
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      htdocs/expensereport/class/expensereport.class.php

+ 7 - 2
htdocs/expensereport/class/expensereport.class.php

@@ -129,6 +129,13 @@ class ExpenseReport extends CommonObject
 
         $error = 0;
 		
+        // Check parameters
+        if (empty($this->date_debut) || empty($this->date_fin)) 
+        {
+            $this->error='ErrorFieldRequired';
+            return -1;
+        }
+        
         $fuserid = $this->fk_user_author;       // Note fk_user_author is not the 'author' but the guy the expense report is for.
         if (empty($fuserid)) $fuserid = $user->id;
         
@@ -170,7 +177,6 @@ class ExpenseReport extends CommonObject
         $sql.= ", ".$conf->entity;
         $sql.= ")";
 
-        dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
         $result = $this->db->query($sql);
         if ($result)
         {
@@ -178,7 +184,6 @@ class ExpenseReport extends CommonObject
             $this->ref='(PROV'.$this->id.')';
 
             $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref='".$this->ref."' WHERE rowid=".$this->id;
-            dol_syslog(get_class($this)."::create sql=".$sql);
             $resql=$this->db->query($sql);
             if (!$resql) $error++;