diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-11-06 23:45:06 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-11-06 23:45:06 +0000 |
commit | 6d79290353692e1f1947edb1f3092ecd02000acc (patch) | |
tree | 842bd23f0698b5966094d6c4faa285f3761c2bfb /LedgerSMB | |
parent | 299774140c2c1852e0ac20556c6226510f4ec6d3 (diff) |
Adding support for validation logic in DBObject modules
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1856 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/DBObject.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 4c96c82e..3451d823 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -26,6 +26,9 @@ this way as is any information that is needed. 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 AUTOLOAD { sub DESTROY {} +sub __validate__ {} + sub new { my $class = shift @_; my %args = (ref($_[0]) eq 'HASH')? %{$_[0]}: @_; @@ -83,7 +88,8 @@ sub new { else { $self->merge($base); } - $self; + $self->__validate__(); + return $self; } sub set_ordering { |