From 35703cff99ee56d82ee4d89e3fc86d8fcd470c7d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 6 Mar 2018 13:23:00 +0100 Subject: [PATCH 1/2] Fix: wrong entity id, already value 1 ! --- htdocs/accountancy/class/bookkeeping.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index b59258f6cd7..83e7bd8ede3 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -48,7 +48,7 @@ class BookKeeping extends CommonObject */ public $table_element = 'accounting_bookkeeping'; - public $entity = 1; + public $entity; /** * @var BookKeepingLine[] Lines @@ -295,7 +295,7 @@ class BookKeeping extends CommonObject $sql .= ",'" . $this->db->escape($this->code_journal) . "'"; $sql .= ",'" . $this->db->escape($this->journal_label) . "'"; $sql .= "," . $this->db->escape($this->piece_num); - $sql .= ", " . (! isset($this->entity) ? '1' : $this->entity); + $sql .= ", " . (! isset($this->entity) ? $conf->entity : $this->entity); $sql .= ")"; dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); @@ -486,7 +486,7 @@ class BookKeeping extends CommonObject $sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ','; $sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).','; - $sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity); + $sql .= ' ' . (! isset($this->entity) ? $conf->entity : $this->entity); $sql .= ')'; $this->db->begin(); From 1807bb36e254047b53e1fda168bf1686b1eec02e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 6 Mar 2018 13:31:13 +0100 Subject: [PATCH 2/2] Fix: missing global $conf --- htdocs/accountancy/class/bookkeeping.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 83e7bd8ede3..16f40139a38 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -363,6 +363,8 @@ class BookKeeping extends CommonObject * @return int <0 if KO, Id of created object if OK */ public function createStd(User $user, $notrigger = false, $mode='') { + global $conf; + dol_syslog(__METHOD__, LOG_DEBUG); $error = 0;