From f7f56132b292338661a6949a0c100f050c86fd92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Oct 2016 20:15:36 +0200 Subject: [PATCH] Fix sql errors --- htdocs/accountancy/class/bookkeeping.class.php | 5 ++--- htdocs/accountancy/journal/sellsjournal.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0e458edf202..9989c2567dd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -241,7 +241,7 @@ class BookKeeping extends CommonObject $sql .= ", piece_num"; $sql .= ', entity'; $sql .= ") VALUES ("; - $sql .= "'" . $this->doc_date . "'"; + $sql .= "'" . $this->db->idate($this->doc_date) . "'"; $sql .= ",'" . $this->doc_type . "'"; $sql .= ",'" . $this->doc_ref . "'"; $sql .= "," . $this->fk_doc; @@ -254,7 +254,7 @@ class BookKeeping extends CommonObject $sql .= "," . $this->montant; $sql .= ",'" . $this->sens . "'"; $sql .= ",'" . $this->fk_user_author . "'"; - $sql .= ",'" . $this->date_create . "'"; + $sql .= ",'" . $this->db->idate($this->date_create). "'"; $sql .= ",'" . $this->code_journal . "'"; $sql .= "," . $this->piece_num; $sql .= ", " . (! isset($this->entity) ? '1' : $this->entity); @@ -384,7 +384,6 @@ class BookKeeping extends CommonObject // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - $sql .= 'doc_date,'; $sql .= 'doc_type,'; $sql .= 'doc_ref,'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 8a1930af01c..5217d9261b1 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -89,7 +89,7 @@ $idpays = $p[0]; $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; -$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; +$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; $sql .= " fd.situation_percent,ct.accountancy_code_sell as account_tva"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; @@ -98,7 +98,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = $sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; -$sql .= " WHERE fd.fk_code_ventilation > 0 "; +$sql .= " WHERE fd.fk_code_ventilation > 0"; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; }