From 6c55bfc0f75e3f2fb0312cf9b3a1a76aba7fc1e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 19:45:26 +0200 Subject: [PATCH] Fix export and remove duplicate csv export. --- htdocs/accountancy/admin/export.php | 5 ++- htdocs/accountancy/bookkeeping/balance.php | 21 ++++++----- .../class/accountancyexport.class.php | 35 ++++++++++--------- htdocs/langs/en_US/accountancy.lang | 2 +- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 3be285674b5..eccb9b0c06f 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -79,6 +79,7 @@ $model_option = array ( /* * Actions */ + if ($action == 'update') { $error = 0; @@ -124,6 +125,8 @@ if ($action == 'update') { } } + + /* * View */ @@ -267,7 +270,7 @@ if ($num2) { } else { print ''; } - + print ''; } diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e3290f1e542..2b263ca166c 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -130,11 +130,6 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $filter = array(); } - -/* - * View - */ - if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; @@ -156,13 +151,23 @@ if ($action == 'export_csv') { print price($line->credit - $line->debit) . $sep; print "\n"; } + + exit; } -else { - $title_page = $langs->trans("AccountBalance"); - llxHeader('', $title_page); +/* + * View + */ + +$title_page = $langs->trans("AccountBalance"); + +llxHeader('', $title_page); + + +if ($action != 'export_csv') +{ // List $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 39954743251..ca040c2d51a 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -44,7 +44,8 @@ class AccountancyExport /** * @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV */ - public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV + public static $EXPORT_TYPE_NORMAL = 1; // CSV + public static $EXPORT_TYPE_CONFIGURABLE = 10; // CSV public static $EXPORT_TYPE_CEGID = 2; public static $EXPORT_TYPE_COALA = 3; public static $EXPORT_TYPE_BOB50 = 4; @@ -53,7 +54,6 @@ class AccountancyExport public static $EXPORT_TYPE_EBP = 7; public static $EXPORT_TYPE_COGILOG = 8; public static $EXPORT_TYPE_AGIRIS = 9; - public static $EXPORT_TYPE_CONFIGURABLE = 10; public static $EXPORT_TYPE_FEC = 11; @@ -98,7 +98,8 @@ class AccountancyExport global $langs; return array ( - self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'), + //self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'), + self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'), self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'), self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'), self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'), @@ -107,7 +108,6 @@ class AccountancyExport self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), - self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), ); } @@ -123,13 +123,13 @@ class AccountancyExport return array ( 'param' => array( - self::$EXPORT_TYPE_NORMAL => array( + /*self::$EXPORT_TYPE_NORMAL => array( 'label' => $langs->trans('Modelcsv_normal'), 'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT, 'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV, 'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE, 'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE, - ), + ),*/ self::$EXPORT_TYPE_CEGID => array( 'label' => $langs->trans('Modelcsv_CEGID'), ), @@ -205,8 +205,12 @@ class AccountancyExport switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) { case self::$EXPORT_TYPE_NORMAL : - $this->exportNormal($TData); + /*$this->exportNormal($TData); + break;*/ + case self::$EXPORT_TYPE_CONFIGURABLE : + $this->exportConfigurable($TData); break; + case self::$EXPORT_TYPE_NORMAL : case self::$EXPORT_TYPE_CEGID : $this->exportCegid($TData); break; @@ -231,9 +235,6 @@ class AccountancyExport case self::$EXPORT_TYPE_AGIRIS : $this->exportAgiris($TData); break; - case self::$EXPORT_TYPE_CONFIGURABLE : - $this->exportConfigurable($TData); - break; case self::$EXPORT_TYPE_FEC : $this->exportFEC($TData); break; @@ -250,6 +251,7 @@ class AccountancyExport * * @return void */ + /* Use $EXPORT_TYPE_CONFIGURABLE instead public function exportNormal($objectLines) { global $conf; @@ -267,6 +269,7 @@ class AccountancyExport print $this->end_line; } } + */ /** * Export format : CEGID @@ -610,12 +613,12 @@ class AccountancyExport $tab[] = $date; $tab[] = $line->doc_ref; $tab[] = $line->label_operation; - $tab[] = length_accountg($line->numero_compte); - $tab[] = length_accounta($line->subledger_account); - $tab[] = price($line->debit); - $tab[] = price($line->credit); - $tab[] = price($line->montant); - $tab[] = $line->code_journal; + $tab[] = length_accountg($line->numero_compte); + $tab[] = length_accounta($line->subledger_account); + $tab[] = price($line->debit); + $tab[] = price($line->credit); + $tab[] = price($line->montant); + $tab[] = $line->code_journal; $separator = $this->separator; print implode($separator, $tab) . $this->end_line; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 83608fb4be8..7475c1640e6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -266,7 +266,7 @@ Modelcsv_quadratus=Export towards Quadratus QuadraCompta Modelcsv_ebp=Export towards EBP Modelcsv_cogilog=Export towards Cogilog Modelcsv_agiris=Export towards Agiris -Modelcsv_configurable=Export Configurable +Modelcsv_configurable=Export CSV Configurable Modelcsv_FEC=Export FEC (Art. L47 A) (Test) ChartofaccountsId=Chart of accounts Id