From adbe832826a026f95823fdcc0723cde3a14c0221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Apr 2021 19:02:17 +0200 Subject: [PATCH] Update bookkeeping.class.php --- htdocs/accountancy/class/bookkeeping.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a2cbf12da3d..e7c5d106ddf 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -295,7 +295,10 @@ class BookKeeping extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; $sql .= " AND fk_doc = ".$this->fk_doc; - if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines + if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) { + // DO NOT USE THIS IN PRPDUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries. + $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines + } $sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'"; $sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'"; $sql .= " AND entity IN (".getEntity('accountancy').")";