[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1856] trunk/LedgerSMB/DBObject.pm
- Subject: SF.net SVN: ledger-smb: [1856] trunk/LedgerSMB/DBObject.pm
- From: ..hidden..
- Date: Tue, 06 Nov 2007 15:45:08 -0800
Revision: 1856
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1856&view=rev
Author: einhverfr
Date: 2007-11-06 15:45:06 -0800 (Tue, 06 Nov 2007)
Log Message:
-----------
Adding support for validation logic in DBObject modules
Modified Paths:
--------------
trunk/LedgerSMB/DBObject.pm
Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm 2007-11-05 19:38:27 UTC (rev 1855)
+++ trunk/LedgerSMB/DBObject.pm 2007-11-06 23:45:06 UTC (rev 1856)
@@ -26,6 +26,9 @@
Provides the basic mapping of parameters to the SQL stored procedure function
arguments.
+=item __validate__ is called on every new() invocation. It is blank in this
+module but can be overridden in decendant modules.
+
=back
=head1 Copyright (C) 2007, The LedgerSMB core team.
@@ -54,6 +57,8 @@
sub DESTROY {}
+sub __validate__ {}
+
sub new {
my $class = shift @_;
my %args = (ref($_[0]) eq 'HASH')? %{$_[0]}: @_;
@@ -83,7 +88,8 @@
else {
$self->merge($base);
}
- $self;
+ $self->__validate__();
+ return $self;
}
sub set_ordering {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.