aboutsummaryrefslogtreecommitdiffstats
path: root/mktreasurer
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-05-15 22:56:32 +0000
committerNicolas Vigier <boklm@mageia.org>2013-05-15 22:56:32 +0000
commit3ea8e95cfe821384d3669d4c32ab7ee3556e0c30 (patch)
tree992acece1fb51f6527918c67ebda0b4a4f6df50f /mktreasurer
parent7dd909091c252e29e1f6b65cef19019733563c52 (diff)
downloadmgatres-3ea8e95cfe821384d3669d4c32ab7ee3556e0c30.tar
mgatres-3ea8e95cfe821384d3669d4c32ab7ee3556e0c30.tar.gz
mgatres-3ea8e95cfe821384d3669d4c32ab7ee3556e0c30.tar.bz2
mgatres-3ea8e95cfe821384d3669d4c32ab7ee3556e0c30.tar.xz
mgatres-3ea8e95cfe821384d3669d4c32ab7ee3556e0c30.zip
Rename donations_list sub to transactions_list
And handle case where no category is selected. git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8264 5b7c3c08-40e5-403b-9995-ace06908e4af
Diffstat (limited to 'mktreasurer')
-rwxr-xr-xmktreasurer23
1 files changed, 12 insertions, 11 deletions
diff --git a/mktreasurer b/mktreasurer
index e818e3c..f46cc0c 100755
--- a/mktreasurer
+++ b/mktreasurer
@@ -40,19 +40,20 @@ sub epoch_date {
DateTime->new(day => $d, month => $m, year => $y)->epoch;
}
-sub donations_list {
+sub transactions_list {
my ($r, $cat) = @_;
my @res;
- my @donations = grep { $_->{Ca} == $cat } @{$r->{Transaction}};
- foreach my $don (@donations) {
+ my @transactions = $cat ? grep { $_->{Ca} == $cat } @{$r->{Transaction}}
+ : @{$r->{Transaction}};
+ foreach my $tra (@transactions) {
my %d = (
- nb => $don->{Nb},
- amount => $don->{Am},
- date => epoch_date($don->{Dt}),
- pa => $don->{Pa},
- who => party_name($r, $don->{Pa}),
- type => subcat_name($r, $don->{Sca}, $cat),
- $don->{No} ne '(null)' ? (notes => $don->{No}) : (),
+ nb => $tra->{Nb},
+ amount => $tra->{Am},
+ date => epoch_date($tra->{Dt}),
+ pa => $tra->{Pa},
+ who => party_name($r, $tra->{Pa}),
+ type => subcat_name($r, $tra->{Sca}, $tra->{Ca}),
+ $tra->{No} ne '(null)' ? (notes => $tra->{No}) : (),
);
push @res, \%d;
}
@@ -62,7 +63,7 @@ sub donations_list {
sub donations_infos {
my $r = shift;
my %res = (
- donations => donations_list($r, donation_category($r)),
+ donations => transactions_list($r, donation_category($r)),
by_month => {},
by_year => {},
by_pa => {},