From 1b675ba0b61f0273458e8992e31fb6ac928d7ef4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 30 Jan 2019 09:51:29 +0100 Subject: [PATCH 1/2] FIX: FEC Compatibility for import in ledger --- htdocs/core/modules/modAccounting.class.php | 35 ++++++++++++++++----- htdocs/langs/en_US/accountancy.lang | 4 ++- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index c47e8d310f1..c2f9459c49b 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -262,15 +262,34 @@ class modAccounting extends DolibarrModules $this->import_icon[$r]=$this->picto; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('b'=>MAIN_DB_PREFIX.'accounting_bookkeeping'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('b.doc_date'=>"Docdate",'b.code_journal'=>'Codejournal','b.numero_compte'=>'AccountAccountingShort','b.label_operation'=>'LabelOperation','b.debit'=>"Debit",'b.credit'=>"Credit",'b.date_creation'=>"DateCreation"); - $this->import_fieldshidden_array[$r]=array('b.fk_user'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_convertvalue_array[$r]=array( - 't.fk_projet'=>array('rule'=>'fetchidfromref','classfile'=>'/projet/class/project.class.php','class'=>'Project','method'=>'fetch','element'=>'Project'), - 't.ref'=>array('rule'=>'getrefifauto') - ); - //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); + $this->import_fields_array[$r]=array( + 'b.doc_date'=>"Docdate", + 'b.piece_num'=>"TransactionNumShort", + 'b.code_journal'=>'Codejournal', + 'b.journal_label'=>'JournalLabel', + 'b.numero_compte'=>'AccountAccounting', + 'b.label_compte'=>'LabelAccount', + 'b.subledger_account'=>'SubledgerAccount', + 'b.subledger_label'=>'SubledgerAccountLabel', + 'b.label_operation'=>'LabelOperation', + 'b.debit'=>"Debit", + 'b.credit'=>"Credit" + ); + $this->import_fieldshidden_array[$r]=array('b.fk_user_author'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - //$this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note"); + $this->import_examplevalues_array[$r]=array( + 'b.doc_date'=>'2019-01-01', + 'b.piece_num'=>'1', + 'b.code_journal'=>"VTE", + 'b.journal_label'=>"Journal des ventes", + 'b.numero_compte'=>"707", + 'b.label_compte'=>'Ventes', + 'b.subledger_account'=>'', + 'b.subledger_label'=>'', + 'b.label_operation'=>"Ventes services", + 'b.debit'=>"0,00", + 'b.credit'=>"100,00" + ); // Chart of accounts $r++; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 144caf49dde..a118151355c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -84,7 +84,8 @@ ChangeAndLoad=Change and load Addanaccount=Add an accounting account AccountAccounting=Accounting account AccountAccountingShort=Account -SubledgerAccount=Subledger Account +SubledgerAccount=Subledger account +SubledgerAccountLabel=Subledger account label ShowAccountingAccount=Show accounting account ShowAccountingJournal=Show accounting journal AccountAccountingSuggest=Accounting account suggested @@ -166,6 +167,7 @@ LabelOperation=Label operation Sens=Sens LetteringCode=Lettering code Codejournal=Journal +JournalLabel=Journal label NumPiece=Piece number TransactionNumShort=Num. transaction AccountingCategory=Personalized groups From 84ecfd96fb74a72226161f5cba7336669c37ea00 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 30 Jan 2019 11:22:01 +0100 Subject: [PATCH 2/2] Update example --- htdocs/core/modules/modAccounting.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index c2f9459c49b..1ebb4b0f2d3 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -278,7 +278,7 @@ class modAccounting extends DolibarrModules $this->import_fieldshidden_array[$r]=array('b.fk_user_author'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r]=array( - 'b.doc_date'=>'2019-01-01', + 'b.doc_date'=>'formatted as \'.dol_print_date(dol_now(),\'%Y-%m-%d\')', 'b.piece_num'=>'1', 'b.code_journal'=>"VTE", 'b.journal_label'=>"Journal des ventes",