diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index aeaa42154d8..f7eaebe1d78 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -729,7 +729,10 @@ class BookKeeping extends CommonObject $sql .= " t.journal_label,"; $sql .= " t.piece_num,"; $sql .= " t.date_creation,"; - $sql .= " t.date_export,"; + // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist + if ($mode <> "_tmp") { + $sql .= " t.date_export,"; + } $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; $sql .= ' WHERE 1 = 1'; @@ -1622,7 +1625,11 @@ class BookKeeping extends CommonObject global $conf; $sql = "SELECT piece_num, doc_date,code_journal, journal_label, doc_ref, doc_type,"; - $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation"; + $sql .= " date_creation, tms as date_modification, date_validated as date_validation"; + // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist + if ($mode <> "_tmp") { + $sql .= ", date_export"; + } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -1699,7 +1706,11 @@ class BookKeeping extends CommonObject $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num,"; - $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation"; + $sql .= " date_creation, tms as date_modification, date_validated as date_validation"; + // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist + if ($mode <> "_tmp") { + $sql .= ", date_export"; + } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")";