diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-15 22:56:26 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-15 22:56:26 +0000 |
commit | 0443a9d4131bd15977a4bdb08eacabf13fcd105c (patch) | |
tree | 4de96d4e27672208e1a4f0c15e8b3c71c6c922d9 | |
parent | b798ff2ec93407edf42881352ac25a438675774f (diff) | |
download | mgatres-0443a9d4131bd15977a4bdb08eacabf13fcd105c.tar mgatres-0443a9d4131bd15977a4bdb08eacabf13fcd105c.tar.gz mgatres-0443a9d4131bd15977a4bdb08eacabf13fcd105c.tar.bz2 mgatres-0443a9d4131bd15977a4bdb08eacabf13fcd105c.tar.xz mgatres-0443a9d4131bd15977a4bdb08eacabf13fcd105c.zip |
add per person donation pages
git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8262 5b7c3c08-40e5-403b-9995-ace06908e4af
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | mktreasurer | 20 | ||||
-rw-r--r-- | tmpl/donations.html | 2 | ||||
-rw-r--r-- | tmpl/donations_by_month.html | 2 | ||||
-rw-r--r-- | tmpl/donations_by_pa.html | 27 | ||||
-rw-r--r-- | tmpl/index.html | 2 |
6 files changed, 48 insertions, 6 deletions
@@ -1,4 +1,5 @@ +- add per person donation pages - index.html: add something about treasurer-commits ML Version 0.1 diff --git a/mktreasurer b/mktreasurer index d12217a..9f89b6a 100755 --- a/mktreasurer +++ b/mktreasurer @@ -50,6 +50,7 @@ sub donations_list { 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}, $don_cat), $don->{No} ne '(null)' ? (notes => $don->{No}) : (), @@ -65,6 +66,7 @@ sub donations_infos { donations => donations_list($r), by_month => {}, by_year => {}, + by_pa => {}, total_30 => 0, ); foreach my $don (@{$res{donations}}) { @@ -76,11 +78,13 @@ sub donations_infos { $res{by_month}->{$month}->{month} = $dt->month; push @{$res{by_year}->{$year}->{donations}}, $don; push @{$res{by_year}->{$year}->{months}}, $month; + push @{$res{by_pa}->{$don->{pa}}->{donations}}, $don; if (time - $don->{date} < '2592000') { # last 30 days $res{total_30} += $don->{amount}; } } - foreach my $d ((values %{$res{by_month}}), (values %{$res{by_year}})) { + foreach my $d ((values %{$res{by_month}}), (values %{$res{by_year}}), + (values %{$res{by_pa}})) { foreach my $don (@{$d->{donations}}) { $d->{total} += $don->{amount}; $d->{type}->{$don->{type}} += $don->{amount}; @@ -98,7 +102,7 @@ sub process_template { } sub output_pages { - my ($donations) = @_; + my ($r, $donations) = @_; my $template = Template->new( INCLUDE_PATH => $config->{tmpl_dir}, OUTPUT_PATH => $config->{out_dir}, @@ -123,6 +127,16 @@ sub output_pages { process_template($template, 'donations_by_year', $vars, "donations_y_$year"); } + foreach my $pa (keys %{$donations->{by_pa}}) { + my $vars = { + config => $config, + pa => $pa, + who => party_name($r, $pa), + donations => $donations, + }; + process_template($template, 'donations_by_pa', $vars, "donations_p_$pa"); + } + my $vars = { config => $config, donations => $donations, @@ -135,5 +149,5 @@ sub output_pages { my $r = XMLin($config->{grisbi_file}); my $donations = donations_infos($r); -output_pages($donations); +output_pages($r, $donations); diff --git a/tmpl/donations.html b/tmpl/donations.html index 1508a78..fef42b4 100644 --- a/tmpl/donations.html +++ b/tmpl/donations.html @@ -15,7 +15,7 @@ [%- FOR don IN donations.donations.sort('date').reverse -%] [%- i = i + 1 -%] [%- LAST IF i > l -%] - <li><b>[% don.who %]</b> donated <b>[% don.amount %]</b> Euros on [% date.format(don.date) %]</li> + <li><b><a href="donations_p_[% don.pa %].html">[% don.who %]</a></b> donated <b>[% don.amount %]</b> Euros on [% date.format(don.date) %]</li> [%- END -%] </ul> diff --git a/tmpl/donations_by_month.html b/tmpl/donations_by_month.html index 2fc79c3..ed4af7f 100644 --- a/tmpl/donations_by_month.html +++ b/tmpl/donations_by_month.html @@ -20,7 +20,7 @@ <ul> [%- USE date(format='%Y/%m/%d') -%] [% FOR don IN donations.by_month.$month.donations %] - <li><b>[% don.who %]</b> donated <b>[% don.amount %]</b> Euros on [% date.format(don.date) %] ([% don.type %])</li> + <li><b><a href="donations_p_[% don.pa %].html">[% don.who %]</a></b> donated <b>[% don.amount %]</b> Euros on [% date.format(don.date) %] ([% don.type %])</li> [%- END -%] </ul> </body> diff --git a/tmpl/donations_by_pa.html b/tmpl/donations_by_pa.html new file mode 100644 index 0000000..585250e --- /dev/null +++ b/tmpl/donations_by_pa.html @@ -0,0 +1,27 @@ +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>[% config.sitename %]: Donations received from [% who %]</title> + </head> + <body> + <h1>Mageia.Org donations received from [% who %]</h1> + <h3>Summary</h3> + <ul> + <li> + <b>Total</b>: [% donations.by_pa.$pa.total %] Euros + </li> + [% FOR type IN donations.by_pa.$pa.type.keys %] + <li> + <b>[% type %]</b>: [% donations.by_pa.$pa.type.$type %] Euros + </li> + [%- END -%] + </ul> + <h3>Donations list</h3> + <ul> + [%- USE date(format='%Y/%m/%d') -%] + [% FOR don IN donations.by_pa.$pa.donations %] + <li><b>[% don.amount %]</b> Euros on [% date.format(don.date) %] ([% don.type %])</li> + [%- END -%] + </ul> + </body> +</html> diff --git a/tmpl/index.html b/tmpl/index.html index 32fdb1b..ac87349 100644 --- a/tmpl/index.html +++ b/tmpl/index.html @@ -19,7 +19,7 @@ [%- FOR don IN donations.donations.sort('date').reverse -%] [%- i = i + 1 -%] [%- LAST IF i > l -%] - <li><b>[% don.who %]</b> donated <b>[% don.amount %]</b> Euros on [% date.format(don.date) %]</li> + <li><b><a href="donations_p_[% don.pa %].html">[% don.who %]</a></b> donated <b>[% don.amount %]</b> Euros on [% date.format(don.date) %]</li> [%- END -%] </ul> |