From 741a14993af554176fa0d9bbea057392d8446d04 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 7 Apr 2018 06:21:49 +0200 Subject: [PATCH] NEW Add file number in accountant card and update export filename --- htdocs/accountancy/bookkeeping/balance.php | 3 +-- .../class/accountancyexport.class.php | 20 +++++++++---------- htdocs/accountancy/journal/bankjournal.php | 1 + .../journal/expensereportsjournal.php | 3 ++- .../accountancy/journal/purchasesjournal.php | 3 ++- htdocs/accountancy/journal/sellsjournal.php | 4 ++-- htdocs/accountancy/tpl/export_journal.tpl.php | 8 ++++---- htdocs/admin/accountant.php | 9 +++++++-- htdocs/langs/en_US/admin.lang | 1 + 9 files changed, 30 insertions(+), 22 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 15e7acd7deb..fda67985883 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -138,8 +138,7 @@ if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; - $journal = 'balance'; - + $filename = 'balance'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; $result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 3a12d606fdd..52b5f1c411f 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1,14 +1,14 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Florian Henry - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2017 Alexandre Spangaro - * Copyright (C) 2013-2017 Olivier Geffroy - * Copyright (C) 2017 Elarifr. Ari Elbaz - * Copyright (C) 2017 Frédéric France + * Copyright (C) 2007-2012 Laurent Destailleur + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Pierre-Henry Favre + * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2013-2017 Olivier Geffroy + * Copyright (C) 2017 Elarifr. Ari Elbaz + * Copyright (C) 2017 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -177,7 +177,7 @@ class AccountancyExport */ public static function downloadFile() { global $conf; - $journal = 'bookkepping'; + $filename = 'general_ledger'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 030140b7f11..be299471708 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -702,6 +702,7 @@ if (! $error && $action == 'writebookkeeping') { if ($action == 'exportcsv') { // ISO and not UTF8 ! $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $filename = 'journal'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; // CSV header line diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 1b140c0bb40..27b627b4b98 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -412,9 +412,10 @@ $form = new Form($db); $userstatic = new User($db); // Export -/*if ($action == 'exportcsv') { +/*if ($action == 'exportcsv') { // ISO and not UTF8 ! $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $filename = 'journal'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; // Model Cegid Expert Export diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index ac4a0e89e0b..5eb20c8eecb 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -575,9 +575,10 @@ if ($action == 'writebookkeeping') { $form = new Form($db); // Export -if ($action == 'exportcsv') { +if ($action == 'exportcsv') { // ISO and not UTF8 ! $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $filename = 'journal'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; $companystatic = new Fournisseur($db); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 373bc81c4c6..9575bc3c13c 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -527,10 +527,10 @@ if ($action == 'writebookkeeping') { $form = new Form($db); // Export -if ($action == 'exportcsv') { - +if ($action == 'exportcsv') { // ISO and not UTF8 ! $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $filename = 'journal'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; $companystatic = new Client($db); diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index d9d158607b6..95ac52f2884 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -23,15 +23,15 @@ if (empty($conf) || ! is_object($conf)) exit; } - +$code = $conf->global->MAIN_INFO_ACCOUNTANT_CODE; $prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; $format = $conf->global->ACCOUNTING_EXPORT_FORMAT; $nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; -$date_export = dol_print_date($now, '%Y%m%d%H%M%S'); +$date_export = "_" . dol_print_date($now, '%Y%m%d%H%M%S'); header('Content-Type: text/csv'); -$filename = ($prefix?$prefix . "_":""). "journal_" . $journal . ($nodateexport?"":$date_export) . "." . $format; +$completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format; -header('Content-Disposition: attachment;filename=' . $filename); +header('Content-Disposition: attachment;filename=' . $completefilename); diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 11fa5d68e64..73d6be66ed7 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -61,6 +61,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha')) dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity); if ($action != 'updateedit' && ! $error) @@ -155,6 +156,10 @@ if ($action == 'edit' || $action == 'updateedit') print ''; print ''."\n"; + // Code + print ''; + print ''."\n"; + // Note print ''; print ''; @@ -224,10 +229,10 @@ else print ''.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL,0,0,0,80) . ''; - // Web - print ''.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB,'_blank',80) . ''; + print ''.$langs->trans("AccountantFileNumber").'' . $conf->global->MAIN_INFO_ACCOUNTANT_CODE . ''; + print ''.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . ''; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 655e5d46884..aef32c1b653 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1055,6 +1055,7 @@ SystemInfoDesc=System information is miscellaneous technical information you get SystemAreaForAdminOnly=This area is available for administrator users only. None of the Dolibarr permissions can reduce this limit. CompanyFundationDesc=Edit on this page all known information of the company or foundation you need to manage (For this, click on "Modify" or "Save" button at bottom of page) AccountantDesc=Edit on this page all known information of your accountant/auditor to manage (For this, click on "Modify" or "Save" button at bottom of page) +AccountantFileNumber=File number DisplayDesc=You can choose each parameter related to the Dolibarr look and feel here AvailableModules=Available app/modules ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules).