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

SF.net SVN: ledger-smb:[5956] trunk



Revision: 5956
          http://sourceforge.net/p/ledger-smb/code/5956
Author:   einhverfr
Date:     2013-08-22 09:40:40 +0000 (Thu, 22 Aug 2013)
Log Message:
-----------
Added default min and max dates for empty data sets

Modified Paths:
--------------
    trunk/LedgerSMB/PGDate.pm
    trunk/LedgerSMB/Report/Dates.pm
    trunk/bin/oe.pl

Modified: trunk/LedgerSMB/PGDate.pm
===================================================================
--- trunk/LedgerSMB/PGDate.pm	2013-08-22 08:56:56 UTC (rev 5955)
+++ trunk/LedgerSMB/PGDate.pm	2013-08-22 09:40:40 UTC (rev 5956)
@@ -23,7 +23,7 @@
 
 =cut
 
-has date => (isa => 'Maybe[DateTime]', is=> 'ro', required => '1');
+has date => (isa => 'DateTime', is=> 'ro', required => '0');
 
 =back
 
@@ -147,12 +147,9 @@
     my ($self, $input, $has_time) = @_;
     return $input if eval {$input->isa(__PACKAGE__)};
     $input = undef if $input eq '';
-    return undef if !defined $input;
     my $format = $LedgerSMB::App_State::User->{dateformat};
     $format ||= 'yyyy-mm-dd';
     my $dt =  _parse_string($self, $input, uc($format), $has_time);
-    die $LedgerSMB::App_State::Locale->text("Invalid date/date: [_1]", $input)
-        unless $dt;
     return $self->new({date => $dt});
 }
 

Modified: trunk/LedgerSMB/Report/Dates.pm
===================================================================
--- trunk/LedgerSMB/Report/Dates.pm	2013-08-22 08:56:56 UTC (rev 5955)
+++ trunk/LedgerSMB/Report/Dates.pm	2013-08-22 09:40:40 UTC (rev 5956)
@@ -68,7 +68,12 @@
         return LedgerSMB::PGDate->from_db($date_string, 'date');
     } else {
         my ($ref) = $self->exec_method({funcname => 'lsmb__min_date'});
-        return $ref->{lsmb__min_date};
+        if ($ref->{lsmb__min_date}){
+            return LedgerSMB::PGDate->from_db($ref->{lsmb__min_date}, 'date');
+        } else {
+            return LedgerSMB::PGDate->from_db('1900-01-01', 'date');
+        }
+               
     }
 }
 
@@ -76,7 +81,11 @@
     my ($self) = @_;
     if (!$self->from_month or !$self->from_year or $self->interval eq 'none'){
         my ($ref) = $self->exec_method({funcname => 'lsmb__max_date'});
-        return $ref->{lsmb__max_date};
+        if ($ref->{lsmb__max_date}){
+            return LedgerSMB::PGDate->from_db($ref->{lsmb__max_date}, 'date');
+        } else {
+            return LedgerSMB::PGDate->from_db('2300-01-01', 'date');
+        }
     }
     my $dateobj = $self->from_date;
     my $date = $dateobj->from_db($dateobj->to_db, 'date'); # copy, round trip

Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2013-08-22 08:56:56 UTC (rev 5955)
+++ trunk/bin/oe.pl	2013-08-22 09:40:40 UTC (rev 5956)
@@ -1326,7 +1326,6 @@
        &update;
        $form->finalize_request();
     }
-
  
     if ( OE->save( \%myconfig, \%$form ) ) {
        edit(); 

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


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits