From 20fba8f4d24efb84e58cb221143a35056b2a5d8d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Jan 2021 05:46:24 +0100 Subject: [PATCH 1/3] FIX : Accountancy - FEC Export - Add trans & unaccent on journal label --- .../class/accountancyexport.class.php | 40 ++++++++++--------- .../class/accountingjournal.class.php | 2 +- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 1bcc4129821..28c049609f3 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -820,6 +820,8 @@ class AccountancyExport */ public function exportFEC($objectLines) { + global $langs; + $separator = "\t"; $end_line = "\r\n"; @@ -853,55 +855,55 @@ class AccountancyExport $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode - print $line->code_journal.$separator; + print $line->code_journal . $separator; // FEC:JournalLib - print $line->journal_label.$separator; + print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator; // FEC:EcritureNum - print $line->piece_num.$separator; + print $line->piece_num . $separator; // FEC:EcritureDate - print $date_document.$separator; + print $date_document . $separator; // FEC:CompteNum - print $line->numero_compte.$separator; + print $line->numero_compte . $separator; // FEC:CompteLib - print dol_string_unaccent($line->label_compte).$separator; + print dol_string_unaccent($line->label_compte) . $separator; // FEC:CompAuxNum - print $line->subledger_account.$separator; + print $line->subledger_account . $separator; // FEC:CompAuxLib - print dol_string_unaccent($line->subledger_label).$separator; + print dol_string_unaccent($line->subledger_label) . $separator; // FEC:PieceRef - print $line->doc_ref.$separator; + print $line->doc_ref . $separator; // FEC:PieceDate - print dol_string_unaccent($date_creation).$separator; + print dol_string_unaccent($date_creation) . $separator; // FEC:EcritureLib - print dol_string_unaccent($line->label_operation).$separator; + print dol_string_unaccent($line->label_operation) . $separator; // FEC:Debit - print price2fec($line->debit).$separator; + print price2fec($line->debit) . $separator; // FEC:Credit - print price2fec($line->credit).$separator; + print price2fec($line->credit) . $separator; // FEC:EcritureLet - print $line->lettering_code.$separator; + print $line->lettering_code . $separator; // FEC:DateLet - print $date_lettering.$separator; + print $date_lettering . $separator; // FEC:ValidDate - print $date_validation.$separator; + print $date_validation . $separator; // FEC:Montantdevise - print $line->multicurrency_amount.$separator; + print $line->multicurrency_amount . $separator; // FEC:Idevise print $line->multicurrency_code; @@ -919,6 +921,8 @@ class AccountancyExport */ public function exportFEC2($objectLines) { + global $langs; + $separator = "\t"; $end_line = "\r\n"; @@ -955,7 +959,7 @@ class AccountancyExport print $line->code_journal . $separator; // FEC:JournalLib - print $line->journal_label . $separator; + print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator; // FEC:EcritureNum print $line->piece_num . $separator; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index a76be081471..6ee8a03d8ff 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -126,7 +126,7 @@ class AccountingJournal extends CommonObject $this->rowid = $obj->rowid; $this->code = $obj->code; - $this->ref = $obj->code; + $this->ref = $obj->code; $this->label = $obj->label; $this->nature = $obj->nature; $this->active = $obj->active; From 5d6ca5c6362e4c95ba1280476a8a790f024a582c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Jan 2021 05:52:47 +0100 Subject: [PATCH 2/3] FIX: Accountancy - Add translation when journal label data is record --- htdocs/accountancy/journal/bankjournal.php | 6 +++--- htdocs/accountancy/journal/expensereportsjournal.php | 6 +++--- htdocs/accountancy/journal/purchasesjournal.php | 8 ++++---- htdocs/accountancy/journal/sellsjournal.php | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d353041234f..c47255647cb 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -549,7 +549,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->credit = ($mt < 0 ? -$mt : 0); $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_creation = $now; @@ -605,7 +605,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0 ? -$mt : 0); $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_creation = $now; @@ -737,7 +737,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0 ? -$mt : 0); $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_creation = $now; $bookkeeping->label_compte = ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 26e2b4cdf77..70ec097cd27 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -223,7 +223,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -271,7 +271,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -329,7 +329,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 94f878527dd..611dde36af5 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -322,7 +322,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -372,7 +372,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -433,7 +433,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -484,7 +484,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 9f44e02aafa..62d2238a116 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -333,7 +333,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt < 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -383,7 +383,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -443,7 +443,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; From 19ac498f4e96861764afd9120b1b923fa8ccdfa2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Jan 2021 06:03:57 +0100 Subject: [PATCH 3/3] FIX: Accountancy - Piece is a required field for FEC compatibility --- htdocs/accountancy/bookkeeping/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index d0f43cfe3dd..d9da5b02aef 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -224,9 +224,10 @@ if ($action == "confirm_update") { $action = 'create'; $error++; } - if (!GETPOST('next_num_mvt', 'alpha')) + if (!GETPOST('doc_ref', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); + $action = 'create'; $error++; } @@ -371,7 +372,7 @@ if ($action == 'create') print ''; print ''; - print ''.$langs->trans("Piece").''; + print ''.$langs->trans("Piece").''; print ''; print '';