[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4969] trunk/LedgerSMB



Revision: 4969
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4969&view=rev
Author:   einhverfr
Date:     2012-07-11 10:40:04 +0000 (Wed, 11 Jul 2012)
Log Message:
-----------
Moving all reports away from dedicated methods to prepare input types

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Report/Aging.pm
    trunk/LedgerSMB/DBObject/Report/Budget/Search.pm
    trunk/LedgerSMB/DBObject/Report/Budget/Variance.pm
    trunk/LedgerSMB/DBObject/Report/Contact/History.pm
    trunk/LedgerSMB/DBObject/Report/Contact/Purchase.pm
    trunk/LedgerSMB/DBObject/Report/Contact/Search.pm
    trunk/LedgerSMB/DBObject/Report/Unapproved/Batch_Overview.pm
    trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm
    trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm
    trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm
    trunk/LedgerSMB/Scripts/contact_reports.pm
    trunk/LedgerSMB/Scripts/journal.pm

Modified: trunk/LedgerSMB/DBObject/Report/Aging.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Aging.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Aging.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -235,7 +235,7 @@
 
 =cut
 
-has 'date_ref' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'date_ref' => (is => 'rw', builder => '_date');
 
 =item entity_class
 
@@ -251,18 +251,6 @@
 
 =over
 
-=item prepare_criteria($request)
-
-Instantiates the PGDate and PGNumber inputs.
-
-=cut
-
-sub prepare_criteria{
-    my ($self, $request) = @_;
-    $request->{to_date} = LedgerSMB::PGDate->from_input($request->{to_date});
-    $request->{accno} =~ s/--.*$//;
-}
-
 =item run_report()
 
 Runs the report, and assigns rows to $self->rows.

Modified: trunk/LedgerSMB/DBObject/Report/Budget/Search.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Budget/Search.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Budget/Search.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -156,7 +156,7 @@
 
 =cut
 
-has 'start_date' => (is=> 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'start_date' => (is=> 'rw', builder => '_date');
 
 =item end_date
 
@@ -164,7 +164,7 @@
 
 =cut
 
-has 'end_date' => (is=> 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'end_date' => (is=> 'rw', builder => '_date');
 
 =item buisness_units
 
@@ -188,12 +188,6 @@
 
 sub prepare_criteria {
     my ($self, $request) = @_;
-    $request->{start_date} = LedgerSMB::PGDate->from_input(
-                               $request->{start_date}
-    );
-    $request->{end_date} = LedgerSMB::PGDate->from_input(
-                               $request->{end_date}
-    );
     my @business_units;
     for my $count(1 .. $request->{bclass_count}){
        push @business_units, $request->{"business_unit_$count"} 

Modified: trunk/LedgerSMB/DBObject/Report/Budget/Variance.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Budget/Variance.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Budget/Variance.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -156,13 +156,13 @@
 
 =cut
 
-has start_date => (is => 'ro', isa => 'LedgerSMB::PGDate');
+has start_date => (is => 'ro', builder => '_date');
 
 =item end_date
 
 =cut
 
-has end_date => (is => 'ro', isa => 'LedgerSMB::PGDate');
+has end_date => (is => 'ro', builder => '_date');
 
 =back 
 

Modified: trunk/LedgerSMB/DBObject/Report/Contact/History.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Contact/History.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Contact/History.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -237,7 +237,7 @@
 
 =cut
 
-has from_date => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has from_date => (is => 'ro', builder => '_date');
 
 =item to_date
 
@@ -245,7 +245,7 @@
 
 =cut
 
-has to_date => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has to_date => (is => 'ro', builder => '_date');
 
 =item type
 
@@ -277,7 +277,7 @@
 
 =cut
 
-has start_from => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has start_from => (is => 'ro', builder => '_date');
 
 =item start_to
 
@@ -285,7 +285,7 @@
 
 =cut
 
-has start_to => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has start_to => (is => 'ro', builder => '_date');
 
 =item inc_open
 
@@ -318,28 +318,6 @@
 
 =over 
 
-=item prepare_criteria
-
-Converts inputs to PgDate where needed
-
-=cut
-
-sub prepare_criteria {
-    my ($self, $request) = @_;
-    $request->{start_from} = LedgerSMB::PGDate->from_input(
-               $request->{start_from}
-    );
-    $request->{start_to} = LedgerSMB::PGDate->from_input(
-               $request->{start_to}
-    );
-    $request->{from_date} = LedgerSMB::PGDate->from_input(
-               $request->{from_date}
-    );
-    $request->{to_date} = LedgerSMB::PGDate->from_input(
-               $request->{to_date}
-    );
-}
-
 =item run_report
 
 Runs the report, populates rows.

Modified: trunk/LedgerSMB/DBObject/Report/Contact/Purchase.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Contact/Purchase.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Contact/Purchase.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -30,7 +30,6 @@
 use Moose;
 extends 'LedgerSMB::DBObject::Report';
 use LedgerSMB::App_State;
-use LedgerSMB::PGDate;
 
 my $locale = $LedgerSMB::App_State::Locale;
 
@@ -245,7 +244,7 @@
 
 =cut
 
-has from_date => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has from_date => (is => 'ro', builder => '_date');
 
 =item to_date
 
@@ -253,7 +252,7 @@
 
 =cut
 
-has to_date => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has to_date => (is => 'ro', builder => '_date');
 
 =item as_of
 
@@ -261,7 +260,7 @@
 
 =cut
 
-has as_of => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has as_of => (is => 'ro', builder => '_date');
 
 =item summarize
 
@@ -278,20 +277,6 @@
 
 =over 
 
-=item prepare_criteria
-
-Converts inputs to PgDate where needed
-
-=cut
-
-sub prepare_criteria {
-    my ($self, $request) = @_;
-    $request->{as_of} = LedgerSMB::PGDate->from_input(
-               $request->{as_of}
-    );
-    $self->prepare_input($request);
-}
-
 =item run_report
 
 Runs the report, populates rows.

Modified: trunk/LedgerSMB/DBObject/Report/Contact/Search.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Contact/Search.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Contact/Search.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -29,7 +29,6 @@
 use Moose;
 extends 'LedgerSMB::DBObject::Report';
 use LedgerSMB::App_State;
-use LedgerSMB::PGDate;
 
 my $locale = $LedgerSMB::App_State::Locale;
 
@@ -223,8 +222,8 @@
 
 =cut
 
-has active_date_from => (is => 'ro', isa => 'Maybe[LedgerSMB::PgDate]');   
-has active_date_to => (is => 'ro', isa => 'Maybe[LedgerSMB::PGDate]');
+has active_date_from => (is => 'ro', builder => '_date');
+has active_date_to => (is => 'ro', builder => '_date');
 
 =back
 
@@ -232,22 +231,6 @@
 
 =over 
 
-=item prepare_criteria
-
-Converts inputs to PgDate where needed
-
-=cut
-
-sub prepare_criteria {
-    my ($self, $request) = @_;
-    $request->{active_date_from} = LedgerSMB::PGDate->from_input(
-               $request->{active_date_from}
-    );
-    $request->{active_date_to} = LedgerSMB::PGDate->from_input(
-               $request->{active_date_to}
-    );
-}
-
 =item run_report
 
 Runs the report, populates rows.

Modified: trunk/LedgerSMB/DBObject/Report/Unapproved/Batch_Overview.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Unapproved/Batch_Overview.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Unapproved/Batch_Overview.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -207,16 +207,6 @@
 
 =over
 
-=item prepare_criteria($request)
-
-Instantiates the PGDate and PGNumber inputs.
-
-=cut
-
-sub prepare_criteria{
-    my ($self, $request) = @_;
-}
-
 =item run_report()
 
 Runs the report, and assigns rows to $self->rows.

Modified: trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -194,16 +194,6 @@
 
 =over
 
-=item prepare_criteria($request)
-
-Instantiates the PGDate and PGNumber inputs.
-
-=cut
-
-sub prepare_criteria{
-    my ($self, $request) = @_;
-}
-
 =item run_report()
 
 Runs the report, and assigns rows to $self->rows.

Modified: trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -145,7 +145,7 @@
 
 =cut
 
-has 'date_from' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'date_from' => (is => 'rw', builder => '_date');
 
 =item date_to
 
@@ -153,7 +153,7 @@
 
 =cut
 
-has 'date_to'  => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'date_to'  => (is => 'rw', builder => '_date');
 
 =back
 
@@ -161,20 +161,6 @@
 
 =over
 
-=item prepare_criteria($request)
-
-Instantiates the PGDate and PGNumber inputs.
-
-=cut
-
-sub prepare_criteria{
-    my ($self, $request) = @_;
-    $request->{date_from} = LedgerSMB::PGDate->from_input(
-                               $request->{date_from}
-    );
-    $request->{date_to} = LedgerSMB::PGDate->from_input($request->{date_to});
-}
-
 =item run_report()
 
 Runs the report, and assigns rows to $self->rows.

Modified: trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -146,7 +146,7 @@
 
 =cut
 
-has 'date_from' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'date_from' => (is => 'rw', builder => '_date');
 
 =item date_to
 
@@ -154,7 +154,7 @@
 
 =cut
 
-has 'date_to'  => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+has 'date_to'  => (is => 'rw', builder => '_date');
 
 
 =item from_accno
@@ -176,20 +176,6 @@
 
 =over
 
-=item prepare_criteria($request)
-
-Instantiates the PGDate and PGNumber inputs.
-
-=cut
-
-sub prepare_criteria{
-    my ($self, $request) = @_;
-    $request->{date_from} = LedgerSMB::PGDate->from_input(
-                               $request->{date_from}
-    );
-    $request->{date_to} = LedgerSMB::PGDate->from_input($request->{date_to});
-}
-
 =item run_report()
 
 Runs the report, and assigns rows to $self->rows.

Modified: trunk/LedgerSMB/Scripts/contact_reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact_reports.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/Scripts/contact_reports.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -30,7 +30,6 @@
 sub search{
     my ($request) = @_;
 
-    LedgerSMB::DBObject::Report::Contact::Search->prepare_criteria($request);
     my $report = LedgerSMB::DBObject::Report::Contact::Search->new(%$request);
     $report->run_report;
     $report->render($request);
@@ -45,7 +44,6 @@
 sub history {
     my ($request) = @_;
 
-    LedgerSMB::DBObject::Report::Contact::History->prepare_criteria($request);
     my $report = LedgerSMB::DBObject::Report::Contact::History->new(%$request);
     $report->run_report;
     $report->render($request);

Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm	2012-07-11 10:27:36 UTC (rev 4968)
+++ trunk/LedgerSMB/Scripts/journal.pm	2012-07-11 10:40:04 UTC (rev 4969)
@@ -111,7 +111,6 @@
          push @{$request->{business_units}}, $request->{"business_unit_$count"}
                if $request->{"business_unit_$count"};
     }
-    #LedgerSMB::DBObject::Report::GL->prepare_criteria($request);
     my $report = LedgerSMB::DBObject::Report::GL->new(%$request);
     $report->run_report;
     $report->render($request);
@@ -131,7 +130,6 @@
          push @{$request->{business_units}}, $request->{"business_unit_$count"}
                if $request->{"business_unit_$count"};
     }
-    LedgerSMB::DBObject::Report::Contact::Purchase->prepare_criteria($request);
     my $report = LedgerSMB::DBObject::Report::Contact::Purchase->new(%$request);
     $report->run_report;
     $report->render($request);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.