From 9a2259c6811e76cc0771a52c18980ddefeba0c1f Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 26 Nov 2015 06:19:24 +0100 Subject: [PATCH] Correct button 'Export' and 'Write bookkeeping' on finance journal --- htdocs/accountancy/journal/bankjournal.php | 52 +++++++++++----------- htdocs/core/lib/report.lib.php | 9 ++-- htdocs/langs/en_US/accountancy.lang | 6 +-- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index bed5376064f..db3dc3a0aae 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -55,7 +55,7 @@ $langs->load("bank"); $langs->load('bills'); $langs->load("accountancy"); -$id_accountancy_journal = GETPOST('id_account'); +$id_accountancy_journal = GETPOST('id_account','int'); $date_startmonth = GETPOST('date_startmonth'); $date_startday = GETPOST('date_startday'); @@ -66,17 +66,12 @@ $date_endyear = GETPOST('date_endyear'); $action = GETPOST('action'); // Security check -if ($user->societe_id > 0) +if ($user->societe_id > 0 && empty($id_accountancy_journal)) accessforbidden(); /* * View */ -if (empty($id_accountancy_journal)) -{ - accessforbidden(); -} - $year_current = strftime("%Y", dol_now()); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; @@ -431,7 +426,7 @@ if ($action == 'export_csv') { dol_print_error($this->db); return -1; } - //$journal = $conf->global->ACCOUNTING_BANK_JOURNAL; + $journal = $conf->global->ACCOUNTING_BANK_JOURNAL; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_banque.csv'); @@ -559,14 +554,15 @@ if ($action == 'export_csv') { } else { $form = new Form($db); - llxHeader('', $langs->trans("BankJournal")); + llxHeader('', $langs->trans("FinanceJournal")); - $namereport = $langs->trans("BankJournal"); - $namereport.= " " . $journal; - $description = $langs->trans("DescBankJournal"); + $nom = $langs->trans("FinanceJournal"); + $builddate = time(); + $description = $langs->trans("DescFinanceJournal") . '
'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); - - // Report + //report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), ''); + + // Report header $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal; $head[$h][1] = $langs->trans("Report"); @@ -575,33 +571,37 @@ if ($action == 'export_csv') { dol_fiche_head($head, 'report'); print '
'; - print ''; - print ''; - // Title + // Ligne de titre print ''; print ''; - print ''; + print ''; print ''; - // Period report + // Ligne de la periode d'analyse du rapport print ''; print ''; - if (! $periodlink) print ''; print ''; - // Description + // Ligne de description print ''; print ''; print ''; print ''; + // Ligne d'export + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -611,8 +611,8 @@ if ($action == 'export_csv') { print ''; print ''; - // End report - + //End Report header + print ''; print ''; diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index dc509384335..533ae7434d6 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -35,22 +35,25 @@ * @param string $exportlink Link for export or '' * @param array $moreparam Array with list of params to add into form * @param string $calcmode Calculation mode +* @param string $varlink Add a variable into the address of the page * @return void */ -function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='') +function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='') { global $langs; print "\n\n\n"; + + if(! empty($varlink)) $varlink = '?'.$varlink; $h=0; - $head[$h][0] = $_SERVER["PHP_SELF"]; + $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; $head[$h][1] = $langs->trans("Report"); $head[$h][2] = 'report'; dol_fiche_head($head, 'report'); - print ''; + print ''; foreach($moreparam as $key => $value) { print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 57ce6b09201..e55f6d667f1 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -112,10 +112,8 @@ SellsJournal=Sells journal PurchasesJournal=Purchases journal DescSellsJournal=Sells journal DescPurchasesJournal=Purchases journal -BankJournal=Bank journal -DescBankJournal=Bank journal including all the types of payments other than cash -CashJournal=Cash journal -DescCashJournal=Cash journal including the type of payment cash +FinanceJournal=Finance journal +DescFinanceJournal=Finance journal including all the types of payments by bank account CashPayment=Cash Payment
'.$langs->trans("ReportName").''.$namereport.''; + print $nom; print '
'.$langs->trans("ReportPeriod").''; - else print ''; - if ($period) print $period; - if ($periodlink) print ''.$periodlink; + print ''; + print $period; print '
'.$langs->trans("ReportDescription").''.$description.'
'.$langs->trans("GeneratedOn").''; + print dol_print_date($builddate); + print '