[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4346] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb:[4346] trunk/LedgerSMB
- From: ..hidden..
- Date: Thu, 23 Feb 2012 02:05:30 +0000
Revision: 4346
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4346&view=rev
Author: einhverfr
Date: 2012-02-23 02:05:30 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
PGDate fixes for undef values
DBObject_Moose fixes for dates and timestamps
Modified Paths:
--------------
trunk/LedgerSMB/DBObject_Moose.pm
trunk/LedgerSMB/PGDate.pm
trunk/LedgerSMB/PGNumber.pm
Modified: trunk/LedgerSMB/DBObject_Moose.pm
===================================================================
--- trunk/LedgerSMB/DBObject_Moose.pm 2012-02-23 01:48:44 UTC (rev 4345)
+++ trunk/LedgerSMB/DBObject_Moose.pm 2012-02-23 02:05:30 UTC (rev 4346)
@@ -366,10 +366,14 @@
if ($types[$_] == 3 or $types[$_] == 2) {
$ref->{$names[$_]} = Math::BigFloat->new($ref->{$names[$_]});
}
- # DATE TIMESTAMP
- if ($types[$_] == 91 or $types[$_] == 11){
- $ref->{$names[$_]} = LedgerSMB::PGDate->from_db($ref->{$names[$_]});
+ # DATE
+ elsif ($types[$_] == 91){
+ $ref->{$names[$_]} = LedgerSMB::PGDate->from_db($ref->{$names[$_]}, 'date');
}
+ # TIMESTAMP
+ elsif ($types[$_] == 11){
+ $ref->{$names[$_]} = LedgerSMB::PGDate->from_db($ref->{$names[$_]}, 'datetime');
+ }
}
push @results, $ref;
}
Modified: trunk/LedgerSMB/PGDate.pm
===================================================================
--- trunk/LedgerSMB/PGDate.pm 2012-02-23 01:48:44 UTC (rev 4345)
+++ trunk/LedgerSMB/PGDate.pm 2012-02-23 02:05:30 UTC (rev 4346)
@@ -31,7 +31,7 @@
=cut
-has date => (isa => 'DateTime', is=> 'ro', required => '1');
+has date => (isa => 'Maybe[DateTime]', is=> 'ro', required => '1');
=back
@@ -147,7 +147,6 @@
}
}
}
- confess 'LedgerSMB::PGDate Invalid Date';
}
sub from_input{
@@ -215,6 +214,8 @@
return $formatter->format_datetime($self->date);
}
+__PACKAGE__->meta->make_immutable;
+
1;
=back
Modified: trunk/LedgerSMB/PGNumber.pm
===================================================================
--- trunk/LedgerSMB/PGNumber.pm 2012-02-23 01:48:44 UTC (rev 4345)
+++ trunk/LedgerSMB/PGNumber.pm 2012-02-23 02:05:30 UTC (rev 4346)
@@ -225,6 +225,7 @@
return $self->to_output({format => '1000.00'});
}
+
1;
=back
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.