[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6847] trunk/LedgerSMB/Report/File.pm
- Subject: SF.net SVN: ledger-smb:[6847] trunk/LedgerSMB/Report/File.pm
- From: ..hidden..
- Date: Wed, 12 Feb 2014 03:35:40 +0000
Revision: 6847
http://sourceforge.net/p/ledger-smb/code/6847
Author: einhverfr
Date: 2014-02-12 03:35:39 +0000 (Wed, 12 Feb 2014)
Log Message:
-----------
Basic role for making file-listing reports (for handling internal operational files and incoming files) added
Added Paths:
-----------
trunk/LedgerSMB/Report/File.pm
Added: trunk/LedgerSMB/Report/File.pm
===================================================================
--- trunk/LedgerSMB/Report/File.pm (rev 0)
+++ trunk/LedgerSMB/Report/File.pm 2014-02-12 03:35:39 UTC (rev 6847)
@@ -0,0 +1,95 @@
+=head1 NAME
+
+LedgerSMB::Report::File - File role for querying files for a report
+
+=head1 SYNPOSIS
+
+ use Moose;
+ with 'LedgerSMB::Report::File';
+
+=cut
+
+package LedgerSMB::Report::File;
+use Moose::Role;
+use LedgerSMB::File;
+with 'LedgerSMB::I18N';
+
+=head1 DESCRIPTION
+
+This role adds a consistent handling of file query inputs. The basic criteria
+are lazy and can be set by functions overridden by the reporting class or
+provided in the constructor.
+
+=head1 PROPERTIES ADDED
+
+=head2 ref_key
+
+Builder is _set_ref_key
+
+=cut
+
+has ref_key => (is => 'ro', lazy => '1', builder => '_set_ref_key',
+ isa => 'Int');
+
+sub _set_ref_key {
+ die text('No ref key set and no override provided');
+}
+
+=head2 file_class
+
+builder is _set_file_class
+
+=cut
+
+has file_class => (is => 'ro', lazy => '1', builder => '_set_file_class',
+ isa => 'Int');
+
+sub _set_file_class {
+ die text('No File Class Specified');
+}
+
+sub _set_lazy {
+ my ($self) = @_;
+ $self->file_class;
+ $self->ref_key;
+}
+
+=head1 METHODS ADDED
+
+=head2 list_files
+
+Returns a list of file entries for the report
+
+=cut
+
+sub list_files {
+ my ($self) = @_;
+ $self->_set_lazy;
+ my $fh = LedgerSMB::File->new(%$self);
+ return $fh->list($self);
+}
+
+=head2 list_links
+
+Returns a list of link entries for the report
+
+=cut
+
+sub list_links {
+ my ($self) = @_;
+ $self->_set_lazy;
+ my $fh = LedgerSMB::File->new(%$self);
+ return $fh->list_links($self);
+}
+
+=head1 COPYRIGHT
+
+Copyright (C) 2014 The LedgerSMB Core Team.
+
+This file may be reused under the terms of the GNU General Public License
+version 2, or at your option, any later version. Please see the included
+LICENSE.txt for details.
+
+=cut
+
+1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits