From 7dd909091c252e29e1f6b65cef19019733563c52 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Wed, 15 May 2013 22:56:29 +0000 Subject: Move donation_category selection outside donations_list git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8263 5b7c3c08-40e5-403b-9995-ace06908e4af --- mktreasurer | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'mktreasurer') diff --git a/mktreasurer b/mktreasurer index 9f89b6a..e818e3c 100755 --- a/mktreasurer +++ b/mktreasurer @@ -41,10 +41,9 @@ sub epoch_date { } sub donations_list { - my $r = shift; + my ($r, $cat) = @_; my @res; - my $don_cat = donation_category($r); - my @donations = grep { $_->{Ca} == $don_cat } @{$r->{Transaction}}; + my @donations = grep { $_->{Ca} == $cat } @{$r->{Transaction}}; foreach my $don (@donations) { my %d = ( nb => $don->{Nb}, @@ -52,7 +51,7 @@ sub donations_list { date => epoch_date($don->{Dt}), pa => $don->{Pa}, who => party_name($r, $don->{Pa}), - type => subcat_name($r, $don->{Sca}, $don_cat), + type => subcat_name($r, $don->{Sca}, $cat), $don->{No} ne '(null)' ? (notes => $don->{No}) : (), ); push @res, \%d; @@ -63,7 +62,7 @@ sub donations_list { sub donations_infos { my $r = shift; my %res = ( - donations => donations_list($r), + donations => donations_list($r, donation_category($r)), by_month => {}, by_year => {}, by_pa => {}, -- cgit v1.2.1