X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/daeddeff192fb0242813ed9288b92a25de755d5a..76592c8a3:/bin/mozilla/ar.pl diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index d29a33747..1bfe969dc 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -24,7 +24,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # Accounts Receivables @@ -38,7 +39,6 @@ use List::UtilsBy qw(sort_by); use SL::AR; use SL::FU; use SL::IS; -use SL::PE; use SL::DB::Default; use SL::DB::Invoice; use SL::ReportGenerator; @@ -81,7 +81,7 @@ use strict; sub add { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -108,7 +108,7 @@ sub add { sub edit { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; @@ -127,7 +127,7 @@ sub edit { sub display_form { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; @@ -146,7 +146,7 @@ sub _retrieve_invoice_object { sub create_links { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my %params = @_; my $form = $main::form; @@ -216,7 +216,7 @@ sub create_links { sub form_header { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -476,7 +476,7 @@ sub form_header { sub form_footer { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -513,7 +513,7 @@ sub form_footer { sub mark_as_paid { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -526,7 +526,7 @@ sub mark_as_paid { sub update { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -616,7 +616,7 @@ sub update { sub post_payment { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -666,7 +666,7 @@ sub post_payment { sub _post { - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; @@ -677,7 +677,7 @@ sub _post { sub post { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -767,7 +767,7 @@ sub post { sub post_as_new { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -789,7 +789,7 @@ sub post_as_new { sub use_as_new { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -806,7 +806,7 @@ sub use_as_new { sub delete { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my $locale = $main::locale; @@ -845,7 +845,7 @@ sub delete { sub yes { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -950,7 +950,8 @@ sub ar_transactions { @columns = qw(ids transdate id type invnumber ordnumber cusordnumber name netamount tax amount paid datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia - marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype direct_debit dunning_description); + marge_total marge_percent globalprojectnumber customernumber country ustid taxzone + payment_terms charts customertype direct_debit dunning_description department); my $ct_cvar_configs = CVar->get_configs('module' => 'CT'); my @ct_includeable_custom_variables = grep { $_->{includeable} } @{ $ct_cvar_configs }; @@ -999,6 +1000,7 @@ sub ar_transactions { 'charts' => { 'text' => $locale->text('Buchungskonto'), }, 'customertype' => { 'text' => $locale->text('Customer type'), }, 'direct_debit' => { 'text' => $locale->text('direct debit'), }, + 'department' => { 'text' => $locale->text('Department'), }, dunning_description => { 'text' => $locale->text('Dunning level'), }, %column_defs_cvars, ); @@ -1035,12 +1037,22 @@ sub ar_transactions { if ($form->{cp_name}) { push @options, $locale->text('Contact Person') . " : $form->{cp_name}"; } + + # $form->{department} seems to never be filled, and showing the department_id + # at the top of the report doesn't make much sense. + # So determine the department name from the id whenever we have a filter for + # department if ($form->{department}) { my ($department) = split /--/, $form->{department}; push @options, $locale->text('Department') . " : $department"; } if ($form->{department_id}) { - push @options, $locale->text('Department Id') . " : $form->{department_id}"; + # push @options, $locale->text('Department Id') . " : $form->{department_id}"; + unless ($form->{department}) { + require SL::DB::Department; + my $department = SL::DB::Manager::Department->find_by(id => $::form->{department_id}); + push @options, $locale->text('Department') . " : " . $department->description if $department; + } } if ($form->{invnumber}) { push @options, $locale->text('Invoice Number') . " : $form->{invnumber}"; @@ -1175,7 +1187,7 @@ sub ar_transactions { sub storno { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger'); + $main::auth->assert('ar_transactions'); my $form = $main::form; my %myconfig = %main::myconfig;