alxarafe /
alixar
| 1 | <?php |
||
| 2 | |||
| 3 | /* Copyright (C) 2013-2014 Olivier Geffroy <[email protected]> |
||
| 4 | * Copyright (C) 2013-2021 Alexandre Spangaro <[email protected]> |
||
| 5 | * Copyright (C) 2014 Ari Elbaz (elarifr) <[email protected]> |
||
| 6 | * Copyright (C) 2014 Florian Henry <[email protected]> |
||
| 7 | * Copyright (C) 2016-2017 Laurent Destailleur <[email protected]> |
||
| 8 | * Copyright (C) 2017-2021 Open-DSI <[email protected]> |
||
| 9 | * Copyright (C) 2024 Rafael San José <[email protected]> |
||
| 10 | * |
||
| 11 | * This program is free software; you can redistribute it and/or modify |
||
| 12 | * it under the terms of the GNU General Public License as published by |
||
| 13 | * the Free Software Foundation; either version 3 of the License, or |
||
| 14 | * (at your option) any later version. |
||
| 15 | * |
||
| 16 | * This program is distributed in the hope that it will be useful, |
||
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 19 | * GNU General Public License for more details. |
||
| 20 | * |
||
| 21 | * You should have received a copy of the GNU General Public License |
||
| 22 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
| 23 | */ |
||
| 24 | |||
| 25 | namespace Dolibarr\Modules; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * \file htdocs/core/modules/modAccounting.class.php |
||
| 29 | * \ingroup Double entry accounting |
||
| 30 | * \brief Module to activate the double entry accounting module |
||
| 31 | */ |
||
| 32 | |||
| 33 | use Dolibarr\Core\Base\DolibarrModules; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Class to describe and enable double entry accounting module |
||
| 37 | */ |
||
| 38 | class Accounting extends DolibarrModules |
||
| 39 | { |
||
| 40 | /** |
||
| 41 | * Constructor. Define names, constants, directories, boxes, permissions |
||
| 42 | * |
||
| 43 | * @param DoliDB $db Database handler |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 44 | */ |
||
| 45 | public function __construct($db) |
||
| 46 | { |
||
| 47 | $this->db = $db; |
||
| 48 | $this->numero = 50400; |
||
| 49 | |||
| 50 | $this->family = "financial"; |
||
| 51 | $this->module_position = '61'; |
||
| 52 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
||
| 53 | $this->name = preg_replace('/^mod/i', '', get_only_class($this)); |
||
| 54 | $this->description = "Double entry accounting management"; |
||
| 55 | |||
| 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
||
| 57 | $this->version = 'dolibarr'; |
||
| 58 | |||
| 59 | $this->const_name = 'MAIN_MODULE_' . static::getNameOf($this->name); // strtoupper($this->name); |
||
| 60 | $this->picto = 'accountancy'; |
||
| 61 | |||
| 62 | // Data directories to create when module is enabled |
||
| 63 | $this->dirs = array('/accounting/temp', '/accounting/export'); |
||
| 64 | |||
| 65 | // Config pages |
||
| 66 | $this->config_page_url = array('accounting.php?mainmenu=accountancy&leftmenu=accountancy_admin'); |
||
| 67 | |||
| 68 | // Dependencies |
||
| 69 | $this->depends = array("modFacture", "modBanque", "modTax"); // List of modules id that must be enabled if this module is enabled |
||
| 70 | $this->requiredby = array(); // List of modules id to disable if this one is disabled |
||
| 71 | $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module |
||
| 72 | $this->phpmin = array(7, 0); // Minimum version of PHP required by module |
||
| 73 | $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module |
||
| 74 | $this->langfiles = array("accountancy", "compta"); |
||
| 75 | |||
| 76 | // Constants |
||
| 77 | // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
||
| 78 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
||
| 79 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
||
| 80 | // ); |
||
| 81 | $this->const = array(); |
||
| 82 | $this->const[1] = array( |
||
| 83 | "MAIN_COMPANY_CODE_ALWAYS_REQUIRED", |
||
| 84 | "chaine", |
||
| 85 | "1", |
||
| 86 | "With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 1 |
||
| 87 | ); |
||
| 88 | $this->const[2] = array( |
||
| 89 | "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED", |
||
| 90 | "chaine", |
||
| 91 | "1", |
||
| 92 | "With this constants on, bank account number is always required", 0, 'current', 1 |
||
| 93 | ); |
||
| 94 | $this->const[3] = array( |
||
| 95 | "ACCOUNTING_ACCOUNT_SUSPENSE", |
||
| 96 | "chaine", |
||
| 97 | "471", |
||
| 98 | "", 0, 'current', 0 |
||
| 99 | ); |
||
| 100 | $this->const[4] = array( |
||
| 101 | "ACCOUNTING_ACCOUNT_TRANSFER_CASH", |
||
| 102 | "chaine", |
||
| 103 | "58", |
||
| 104 | "", 0, 'current', 0 |
||
| 105 | ); |
||
| 106 | $this->const[5] = array( |
||
| 107 | "CHARTOFACCOUNTS", |
||
| 108 | "chaine", |
||
| 109 | "2", |
||
| 110 | "", 0, 'current', 0 |
||
| 111 | ); |
||
| 112 | $this->const[6] = array( |
||
| 113 | "ACCOUNTING_EXPORT_MODELCSV", |
||
| 114 | "chaine", |
||
| 115 | "1", |
||
| 116 | "", 0, 'current', 0 |
||
| 117 | ); |
||
| 118 | $this->const[7] = array( |
||
| 119 | "ACCOUNTING_LENGTH_GACCOUNT", |
||
| 120 | "chaine", |
||
| 121 | "", |
||
| 122 | "", 0, 'current', 0 |
||
| 123 | ); |
||
| 124 | $this->const[8] = array( |
||
| 125 | "ACCOUNTING_LENGTH_AACCOUNT", |
||
| 126 | "chaine", |
||
| 127 | "", |
||
| 128 | "", 0, 'current', 0 |
||
| 129 | ); |
||
| 130 | $this->const[11] = array( |
||
| 131 | "ACCOUNTING_EXPORT_DATE", |
||
| 132 | "chaine", |
||
| 133 | "%Y-%m-%d", |
||
| 134 | "", 0, 'current', 0 |
||
| 135 | ); |
||
| 136 | $this->const[12] = array( |
||
| 137 | "ACCOUNTING_EXPORT_SEPARATORCSV", |
||
| 138 | "string", |
||
| 139 | ",", |
||
| 140 | "", 0, 'current', 0 |
||
| 141 | ); |
||
| 142 | $this->const[13] = array( |
||
| 143 | "ACCOUNTING_EXPORT_FORMAT", |
||
| 144 | "chaine", |
||
| 145 | "csv", |
||
| 146 | "", 0, 'current', 0 |
||
| 147 | ); |
||
| 148 | |||
| 149 | // Tabs |
||
| 150 | $this->tabs = array(); |
||
| 151 | |||
| 152 | // Css |
||
| 153 | $this->module_parts = array(); |
||
| 154 | |||
| 155 | // Boxes |
||
| 156 | $this->boxes = array( |
||
| 157 | 0 => array('file' => 'box_accountancy_last_manual_entries.php', 'enabledbydefaulton' => 'accountancyindex'), |
||
| 158 | 1 => array('file' => 'box_accountancy_suspense_account.php', 'enabledbydefaulton' => 'accountancyindex') |
||
| 159 | ); |
||
| 160 | |||
| 161 | // Permissions |
||
| 162 | $this->rights_class = 'accounting'; |
||
| 163 | |||
| 164 | $this->rights = array(); // Permission array used by this module |
||
| 165 | $r = 0; |
||
| 166 | |||
| 167 | $this->rights[$r][0] = 50440; |
||
| 168 | $this->rights[$r][1] = 'Manage chart of accounts, setup of accountancy'; |
||
| 169 | $this->rights[$r][2] = 'r'; |
||
| 170 | $this->rights[$r][3] = 0; |
||
| 171 | $this->rights[$r][4] = 'chartofaccount'; |
||
| 172 | $this->rights[$r][5] = ''; |
||
| 173 | $r++; |
||
| 174 | |||
| 175 | $this->rights[$r][0] = 50401; |
||
| 176 | $this->rights[$r][1] = 'Bind products and invoices with accounting accounts'; |
||
| 177 | $this->rights[$r][2] = 'r'; |
||
| 178 | $this->rights[$r][3] = 0; |
||
| 179 | $this->rights[$r][4] = 'bind'; |
||
| 180 | $this->rights[$r][5] = 'write'; |
||
| 181 | $r++; |
||
| 182 | |||
| 183 | $this->rights[$r][0] = 50411; |
||
| 184 | $this->rights[$r][1] = 'Read operations in Ledger'; |
||
| 185 | $this->rights[$r][2] = 'r'; |
||
| 186 | $this->rights[$r][3] = 0; |
||
| 187 | $this->rights[$r][4] = 'mouvements'; |
||
| 188 | $this->rights[$r][5] = 'lire'; |
||
| 189 | $r++; |
||
| 190 | |||
| 191 | $this->rights[$r][0] = 50412; |
||
| 192 | $this->rights[$r][1] = 'Write/Edit operations in Ledger'; |
||
| 193 | $this->rights[$r][2] = 'w'; |
||
| 194 | $this->rights[$r][3] = 0; |
||
| 195 | $this->rights[$r][4] = 'mouvements'; |
||
| 196 | $this->rights[$r][5] = 'creer'; |
||
| 197 | $r++; |
||
| 198 | |||
| 199 | $this->rights[$r][0] = 50414; |
||
| 200 | $this->rights[$r][1] = 'Delete operations in Ledger'; |
||
| 201 | $this->rights[$r][2] = 'd'; |
||
| 202 | $this->rights[$r][3] = 0; |
||
| 203 | $this->rights[$r][4] = 'mouvements'; |
||
| 204 | $this->rights[$r][5] = 'supprimer'; |
||
| 205 | $r++; |
||
| 206 | |||
| 207 | $this->rights[$r][0] = 50415; |
||
| 208 | $this->rights[$r][1] = 'Delete all operations by year and journal in Ledger'; |
||
| 209 | $this->rights[$r][2] = 'd'; |
||
| 210 | $this->rights[$r][3] = 0; |
||
| 211 | $this->rights[$r][4] = 'mouvements'; |
||
| 212 | $this->rights[$r][5] = 'supprimer_tous'; |
||
| 213 | $r++; |
||
| 214 | |||
| 215 | $this->rights[$r][0] = 50418; |
||
| 216 | $this->rights[$r][1] = 'Export operations of the Ledger'; |
||
| 217 | $this->rights[$r][2] = 'r'; |
||
| 218 | $this->rights[$r][3] = 0; |
||
| 219 | $this->rights[$r][4] = 'mouvements'; |
||
| 220 | $this->rights[$r][5] = 'export'; |
||
| 221 | $r++; |
||
| 222 | |||
| 223 | $this->rights[$r][0] = 50420; |
||
| 224 | $this->rights[$r][1] = 'Report and export reports (turnover, balance, journals, ledger)'; |
||
| 225 | $this->rights[$r][2] = 'r'; |
||
| 226 | $this->rights[$r][3] = 0; |
||
| 227 | $this->rights[$r][4] = 'comptarapport'; |
||
| 228 | $this->rights[$r][5] = 'lire'; |
||
| 229 | $r++; |
||
| 230 | |||
| 231 | $this->rights[$r][0] = 50430; |
||
| 232 | $this->rights[$r][1] = 'Manage fiscal periods, validate movements and close periods'; |
||
| 233 | $this->rights[$r][2] = 'r'; |
||
| 234 | $this->rights[$r][3] = 0; |
||
| 235 | $this->rights[$r][4] = 'fiscalyear'; |
||
| 236 | $this->rights[$r][5] = 'write'; |
||
| 237 | $r++; |
||
| 238 | |||
| 239 | // Menus |
||
| 240 | //------- |
||
| 241 | $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
||
| 242 | |||
| 243 | // Exports |
||
| 244 | //-------- |
||
| 245 | $r = 0; |
||
| 246 | |||
| 247 | $r++; |
||
| 248 | $this->export_code[$r] = $this->rights_class . '_' . $r; |
||
| 249 | $this->export_label[$r] = 'Chartofaccounts'; |
||
| 250 | $this->export_icon[$r] = $this->picto; |
||
| 251 | $this->export_permission[$r] = array(array("accounting", "chartofaccount")); |
||
| 252 | $this->export_fields_array[$r] = array('ac.rowid' => 'ChartofaccountsId', 'ac.pcg_version' => 'Chartofaccounts', 'aa.rowid' => 'ID', 'aa.account_number' => "AccountAccounting", 'aa.label' => "Label", 'aa2.account_number' => "Accountparent", 'aa.pcg_type' => "Pcgtype", 'aa.active' => 'Status'); |
||
| 253 | $this->export_TypeFields_array[$r] = array('ac.rowid' => 'List:accounting_system:pcg_version', 'ac.pcg_version' => 'Text', 'aa.rowid' => 'Numeric', 'aa.account_number' => "Text", 'aa.label' => "Text", 'aa2.account_number' => "Text", 'aa.pcg_type' => 'Text', 'aa.active' => 'Status'); |
||
| 254 | $this->export_entities_array[$r] = array(); // We define here only fields that use another picto |
||
| 255 | |||
| 256 | $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
||
| 257 | $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as aa'; |
||
| 258 | $this->export_sql_end[$r] .= ' ,' . MAIN_DB_PREFIX . 'accounting_system as ac'; |
||
| 259 | $this->export_sql_end[$r] .= ' ,' . MAIN_DB_PREFIX . 'accounting_account as aa2'; |
||
| 260 | $this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN (' . getEntity('accounting') . ')'; |
||
| 261 | $this->export_sql_end[$r] .= ' AND aa2.rowid = aa.account_parent AND aa2.active = 1 AND ac.pcg_version = aa2.fk_pcg_version AND aa2.entity IN (' . getEntity('accounting') . ')'; |
||
| 262 | |||
| 263 | |||
| 264 | // Imports |
||
| 265 | //-------- |
||
| 266 | $r = 0; |
||
| 267 | |||
| 268 | // Chart of accounts |
||
| 269 | $r++; |
||
| 270 | $this->import_code[$r] = $this->rights_class . '_' . $r; |
||
| 271 | $this->import_label[$r] = "Chartofaccounts"; // Translation key |
||
| 272 | $this->import_icon[$r] = $this->picto; |
||
| 273 | $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
||
| 274 | $this->import_tables_array[$r] = array('aa' => MAIN_DB_PREFIX . 'accounting_account'); |
||
| 275 | $this->import_tables_creator_array[$r] = array('aa' => 'fk_user_author'); // Fields to store import user id |
||
| 276 | $this->import_fields_array[$r] = array('aa.fk_pcg_version' => "Chartofaccounts*", 'aa.account_number' => "AccountAccounting*", 'aa.label' => "Label*", 'aa.account_parent' => "Accountparent", "aa.fk_accounting_category" => "AccountingCategory", "aa.pcg_type" => "Pcgtype*", 'aa.active' => 'Status*', 'aa.datec' => "DateCreation"); |
||
| 277 | $this->import_regex_array[$r] = array('aa.fk_pcg_version' => 'pcg_version@' . MAIN_DB_PREFIX . 'accounting_system', 'aa.account_number' => '^.{1,32}$', 'aa.label' => '^.{1,255}$', 'aa.account_parent' => '^.{0,32}$', 'aa.fk_accounting_category' => 'rowid@' . MAIN_DB_PREFIX . 'c_accounting_category', 'aa.pcg_type' => '^.{1,20}$', 'aa.active' => '^0|1$', 'aa.datec' => '^\d{4}-\d{2}-\d{2}$'); |
||
| 278 | $this->import_convertvalue_array[$r] = array( |
||
| 279 | 'aa.account_number' => array('rule' => 'accountingaccount'), |
||
| 280 | 'aa.account_parent' => array('rule' => 'fetchidfromref', 'classfile' => '/accountancy/class/accountingaccount.class.php', 'class' => 'AccountingAccount', 'method' => 'fetch', 'element' => 'AccountingAccount'), |
||
| 281 | 'aa.fk_accounting_category' => array('rule' => 'fetchidfromcodeorlabel', 'classfile' => '/accountancy/class/accountancycategory.class.php', 'class' => 'AccountancyCategory', 'method' => 'fetch', 'dict' => 'DictionaryAccountancyCategory'), |
||
| 282 | ); |
||
| 283 | $this->import_examplevalues_array[$r] = array('aa.fk_pcg_version' => "PCG99-ABREGE", 'aa.account_number' => "707", 'aa.label' => "Product sales", 'aa.account_parent' => "ref:7 or id:1407", "aa.fk_accounting_category" => "", "aa.pcg_type" => "PROD", 'aa.active' => '1', 'aa.datec' => "2017-04-28"); |
||
| 284 | $this->import_updatekeys_array[$r] = array('aa.fk_pcg_version' => 'Chartofaccounts', 'aa.account_number' => 'AccountAccounting'); |
||
| 285 | |||
| 286 | // General ledger |
||
| 287 | $r++; |
||
| 288 | $this->import_code[$r] = $this->rights_class . '_' . $r; |
||
| 289 | $this->import_label[$r] = 'ImportAccountingEntries'; |
||
| 290 | $this->import_icon[$r] = $this->picto; |
||
| 291 | $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
||
| 292 | $this->import_tables_array[$r] = array('b' => MAIN_DB_PREFIX . 'accounting_bookkeeping'); // List of tables to insert into (insert done in same order) |
||
| 293 | $this->import_fields_array[$r] = array( |
||
| 294 | 'b.piece_num' => "TransactionNumShort", |
||
| 295 | 'b.doc_date' => "Docdate", |
||
| 296 | //'b.doc_type'=>'Doctype', |
||
| 297 | 'b.doc_ref' => 'Piece', |
||
| 298 | 'b.code_journal' => 'Codejournal', |
||
| 299 | 'b.journal_label' => 'JournalLabel', |
||
| 300 | 'b.numero_compte' => 'AccountAccounting', |
||
| 301 | 'b.label_compte' => 'LabelAccount', |
||
| 302 | 'b.subledger_account' => 'SubledgerAccount', |
||
| 303 | 'b.subledger_label' => 'SubledgerAccountLabel', |
||
| 304 | 'b.label_operation' => 'LabelOperation', |
||
| 305 | 'b.debit' => "Debit", |
||
| 306 | 'b.credit' => "Credit", |
||
| 307 | 'b.sens' => 'Direction' // This field is still used by accounting export. We can remove it once it has been replaced into accountancyexport.class.php by a detection using ->debit and ->credit |
||
| 308 | ); |
||
| 309 | $this->import_fieldshidden_array[$r] = array('b.doc_type' => 'const-import_from_external', 'b.fk_doc' => 'const-0', 'b.fk_docdet' => 'const-0', 'b.fk_user_author' => 'user->id', 'b.date_creation' => 'const-' . dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
||
| 310 | $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]$'); |
||
| 311 | $this->import_convertvalue_array[$r] = array( |
||
| 312 | 'b.numero_compte' => array('rule' => 'accountingaccount'), |
||
| 313 | 'b.subledger_account' => array('rule' => 'accountingaccount') |
||
| 314 | ); |
||
| 315 | $this->import_examplevalues_array[$r] = array( |
||
| 316 | 'b.piece_num' => '123 (!!! use next value not already used)', |
||
| 317 | 'b.doc_date' => dol_print_date(dol_now(), "%Y-%m-%d"), |
||
| 318 | //'b.doc_type'=>'import', |
||
| 319 | 'b.doc_ref' => 'My document ABC', |
||
| 320 | 'b.code_journal' => "VTE", |
||
| 321 | 'b.journal_label' => "Sale journal", |
||
| 322 | 'b.numero_compte' => "707", |
||
| 323 | 'b.label_compte' => 'Product account 707', |
||
| 324 | 'b.subledger_account' => '', |
||
| 325 | 'b.subledger_label' => '', |
||
| 326 | 'b.label_operation' => "Sale of ABC", |
||
| 327 | 'b.debit' => "0", |
||
| 328 | 'b.credit' => "100", |
||
| 329 | 'b.sens' => 'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit |
||
| 330 | ); |
||
| 331 | |||
| 332 | // General ledger - File FEC |
||
| 333 | $r++; |
||
| 334 | $this->import_code[$r] = $this->rights_class . '_' . $r; |
||
| 335 | $this->import_label[$r] = 'ImportAccountingEntriesFECFormat'; |
||
| 336 | $this->import_icon[$r] = $this->picto; |
||
| 337 | $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
||
| 338 | $this->import_tables_array[$r] = array('b' => MAIN_DB_PREFIX . 'accounting_bookkeeping'); // List of tables to insert into (insert done in same order) |
||
| 339 | $this->import_fields_array[$r] = array( |
||
| 340 | 'b.code_journal' => 'FECFormatJournalCode*', |
||
| 341 | 'b.journal_label' => 'FECFormatJournalLabel', |
||
| 342 | 'b.piece_num' => 'FECFormatEntryNum', // not mandatory (keep empty to get next value of "piece_num" from "llx_accounting_bookkeeping" table) |
||
| 343 | 'b.doc_date' => 'FECFormatEntryDate*', |
||
| 344 | 'b.numero_compte' => 'FECFormatGeneralAccountNumber*', |
||
| 345 | 'b.label_compte' => 'FECFormatGeneralAccountLabel*', |
||
| 346 | 'b.subledger_account' => 'FECFormatSubledgerAccountNumber', |
||
| 347 | 'b.subledger_label' => 'FECFormatSubledgerAccountLabel', |
||
| 348 | 'b.doc_ref' => 'FECFormatPieceRef*', |
||
| 349 | 'b.date_creation' => 'FECFormatPieceDate', |
||
| 350 | 'b.label_operation' => 'FECFormatLabelOperation', |
||
| 351 | 'b.debit' => 'FECFormatDebit*', |
||
| 352 | 'b.credit' => 'FECFormatCredit*', |
||
| 353 | 'b.lettering_code' => 'FECFormatReconcilableCode', |
||
| 354 | 'b.date_lettering' => 'FECFormatReconcilableDate', |
||
| 355 | 'b.date_validated' => 'FECFormatValidateDate', |
||
| 356 | 'b.multicurrency_amount' => 'FECFormatMulticurrencyAmount', |
||
| 357 | 'b.multicurrency_code' => 'FECFormatMulticurrencyCode' |
||
| 358 | ); |
||
| 359 | $this->import_fieldshidden_array[$r] = array( |
||
| 360 | 'b.doc_type' => 'const-import_from_external', |
||
| 361 | 'b.fk_doc' => 'const-0', |
||
| 362 | 'b.fk_docdet' => 'const-0', |
||
| 363 | 'b.fk_user_author' => 'user->id', |
||
| 364 | 'b.montant' => 'rule-computeAmount', |
||
| 365 | 'b.sens' => 'rule-computeDirection' |
||
| 366 | ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
||
| 367 | $this->import_convertvalue_array[$r] = array( |
||
| 368 | 'b.piece_num' => array('rule' => 'compute', 'type' => 'int', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computePieceNum', 'element' => 'Accountancy'), |
||
| 369 | 'b.numero_compte' => array('rule' => 'accountingaccount'), |
||
| 370 | 'b.subledger_account' => array('rule' => 'accountingaccount'), |
||
| 371 | 'b.debit' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), |
||
| 372 | 'b.credit' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), |
||
| 373 | 'b.multicurrency_amount' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), |
||
| 374 | 'b.montant' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'), |
||
| 375 | 'b.sens' => array('rule' => 'compute', 'type' => 'varchar', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'), |
||
| 376 | ); |
||
| 377 | $this->import_regex_array[$r] = array( |
||
| 378 | //'b.doc_date'=>'^\d{4}\d{2}\d{2}$', |
||
| 379 | 'b.doc_ref' => '^.{1,300}$', |
||
| 380 | 'b.numero_compte' => '^.{1,32}$', |
||
| 381 | 'b.label_compte' => '^.{1,255}$', |
||
| 382 | 'b.subledger_compte' => '^.{1,32}$', |
||
| 383 | 'b.subledger_label' => '^.{1,255}$', |
||
| 384 | 'b.label_operation' => '^.{1,255}$', |
||
| 385 | //'b.sens'=>'^[D|C]$', |
||
| 386 | ); |
||
| 387 | $this->import_examplevalues_array[$r] = array( |
||
| 388 | 'b.code_journal' => "VT", |
||
| 389 | 'b.journal_label' => "Sale journal", |
||
| 390 | 'b.piece_num' => '123 (!!! use next value not already used)', |
||
| 391 | 'b.doc_date' => dol_print_date(dol_now(), "%Y%m%d"), |
||
| 392 | 'b.numero_compte' => "707", |
||
| 393 | 'b.label_compte' => 'Sale', |
||
| 394 | 'b.subledger_account' => '', |
||
| 395 | 'b.subledger_label' => '', |
||
| 396 | 'b.doc_ref' => 'My document ABC', |
||
| 397 | 'b.date_creation' => dol_print_date(dol_now(), "%Y%m%d"), |
||
| 398 | 'b.label_operation' => "Sale of ABC", |
||
| 399 | 'b.debit' => "0", |
||
| 400 | 'b.credit' => "100", |
||
| 401 | 'b.lettering_code' => 'ABC', |
||
| 402 | 'b.date_lettering' => dol_print_date(dol_now(), "%Y%m%d"), |
||
| 403 | 'b.date_validated' => dol_print_date(dol_now(), "%Y%m%d"), |
||
| 404 | 'b.multicurrency_amount' => "90 (Necessary if devise is different than EUR)", |
||
| 405 | 'b.multicurrency_code' => "US (Necessary if devise is different than EUR)", |
||
| 406 | ); |
||
| 407 | } |
||
| 408 | } |
||
| 409 |