[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5217] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb:[5217] trunk/LedgerSMB
- From: ..hidden..
- Date: Tue, 20 Nov 2012 07:14:25 +0000
Revision: 5217
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5217&view=rev
Author: einhverfr
Date: 2012-11-20 07:14:25 +0000 (Tue, 20 Nov 2012)
Log Message:
-----------
Refactoring button handling on reports.
Modified Paths:
--------------
trunk/LedgerSMB/Report/Unapproved/Drafts.pm
trunk/LedgerSMB/Report.pm
Modified: trunk/LedgerSMB/Report/Unapproved/Drafts.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Drafts.pm 2012-11-20 06:49:15 UTC (rev 5216)
+++ trunk/LedgerSMB/Report/Unapproved/Drafts.pm 2012-11-20 07:14:25 UTC (rev 5217)
@@ -188,6 +188,26 @@
=over
+=item set_buttons
+
+=cut
+
+sub set_buttons {
+return [
+ {name => 'action',
+ type => 'submit',
+ text => LedgerSMB::Report::text('Approve'),
+ value => 'approve',
+ class => 'submit', },
+
+ {name => 'action',
+ type => 'submit',
+ text => LedgerSMB::Report::text('Delete'),
+ value => 'approve',
+ class => 'submit', },
+ ];
+}
+
=item run_report()
Runs the report, and assigns rows to $self->rows.
@@ -206,19 +226,6 @@
}
$ref->{reference_href_suffix} = "$script.pl?action=edit&id=$ref->{id}";
}
- $self->buttons([
- {name => 'action',
- type => 'submit',
- text => LedgerSMB::Report::text('Approve'),
- value => 'approve',
- class => 'submit', },
-
- {name => 'action',
- type => 'submit',
- text => LedgerSMB::Report::text('Delete'),
- value => 'approve',
- class => 'submit', },
- ]);
$self->rows(..hidden..);
}
Modified: trunk/LedgerSMB/Report.pm
===================================================================
--- trunk/LedgerSMB/Report.pm 2012-11-20 06:49:15 UTC (rev 5216)
+++ trunk/LedgerSMB/Report.pm 2012-11-20 07:14:25 UTC (rev 5217)
@@ -146,7 +146,8 @@
=cut
-has buttons => (is => 'rw', isa => 'ArrayRef[Any]');
+has buttons => (is => 'rw', isa => 'ArrayRef[Any]',
+ lazy => 1, builder => 'set_buttons');
=back
@@ -154,6 +155,17 @@
=over
+=item set_buttons
+
+This returns an empty arrayref here but can be overridden by individual
+reports.
+
+=cut
+
+sub set_buttons {
+ return [];
+}
+
=item render
This takes no arguments and simply renders the report as is.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.