X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=8d0ec94f24463d98577c022a0774172b7b45f07e;hb=b02735f55360e5a4e02dca40458b48cf057ecd7b;hp=1a2999bdee34f2c07d8ed48b74bfdeb90d23ffa5;hpb=b6dc5623d93c1be1c54248d4512e80f495af2899;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 1a2999bde..8d0ec94f2 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -14,8 +14,8 @@ # # Contributors: Antonio Gallardo # Benjamin Lee -# Philip Reetz -# Udo Spallek +# Philip Reetz +# Udo Spallek # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,14 +41,16 @@ use SL::PE; use SL::RP; use SL::Iconv; use SL::ReportGenerator; +use Data::Dumper; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; -1; - -# end of main +# note: this file was particularly hard to strictify. +# alot of the vars are passed carelessly between invocations +# should there be any missing vars, declare them globally +use strict; # this is for our long dates # $locale->text('January') @@ -83,6 +85,8 @@ require "bin/mozilla/reportgenerator.pl"; # $locale->text('Trial Balance') # $locale->text('AR Aging') # $locale->text('AP Aging') +# $locale->text('Search AR Aging') +# $locale->text('Search AP Aging') # $locale->text('Tax collected') # $locale->text('Tax paid') # $locale->text('Receipts') @@ -90,15 +94,46 @@ require "bin/mozilla/reportgenerator.pl"; # $locale->text('Project Transactions') # $locale->text('Non-taxable Sales') # $locale->text('Non-taxable Purchases') +# $locale->text('Business evaluation') + +# $form->parse_html_template('rp/html_report_susa') + +my $rp_access_map = { + 'projects' => 'report', + 'ar_aging' => 'general_ledger', + 'ap_aging' => 'general_ledger', + 'receipts' => 'cash', + 'payments' => 'cash', + 'trial_balance' => 'report', + 'income_statement' => 'report', + 'bwa' => 'report', + 'balance_sheet' => 'report', +}; + +sub check_rp_access { + my $form = $main::form; + + my $right = $rp_access_map->{$form->{report}}; + $right ||= 'DOES_NOT_EXIST'; + + $main::auth->assert($right); +} sub report { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - %title = ('balance_sheet' => 'Balance Sheet', + check_rp_access(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my %title = ( + 'balance_sheet' => 'Balance Sheet', 'income_statement' => 'Income Statement', 'trial_balance' => 'Trial Balance', - 'ar_aging' => 'AR Aging', - 'ap_aging' => 'Offene Verbindlichkeiten', + 'ar_aging' => 'Search AR Aging', + 'ap_aging' => 'Search AP Aging', 'tax_collected' => 'Tax collected', 'tax_paid' => 'Tax paid', 'nontaxable_sales' => 'Non-taxable Sales', @@ -106,31 +141,28 @@ sub report { 'receipts' => 'Receipts', 'payments' => 'Payments', 'projects' => 'Project Transactions', - 'bwa' => 'Betriebswirtschaftliche Auswertung',); + 'bwa' => 'Business evaluation', + ); $form->{title} = $locale->text($title{ $form->{report} }); - $accrual = ($eur) ? "" : "checked"; - $cash = ($eur) ? "checked" : ""; + my $accrual = $::instance_conf->get_accounting_method eq 'cash' ? "" : "checked"; + my $cash = $::instance_conf->get_accounting_method eq 'cash' ? "checked" : ""; - $year = (localtime)[5] + 1900; + my $year = (localtime)[5] + 1900; # get departments $form->all_departments(\%myconfig); - if (@{ $form->{all_departments} }) { + if (@{ $form->{all_departments} || [] }) { $form->{selectdepartment} = "