[freeside-commits] freeside/FS/FS svc_Common.pm,1.27,1.28
Ivan,,,
ivan at wavetail.420.am
Tue Nov 22 08:39:07 PST 2005
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv27242
Modified Files:
svc_Common.pm
Log Message:
set default fields in new method, mostly for svc_acct.seconds
Index: svc_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_Common.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- svc_Common.pm 14 Jul 2005 11:46:25 -0000 1.27
+++ svc_Common.pm 22 Nov 2005 16:39:05 -0000 1.28
@@ -34,6 +34,38 @@
=cut
+sub new {
+ my $proto = shift;
+ my $class = ref($proto) || $proto;
+ my $self = {};
+ bless ($self, $class);
+
+ unless ( defined ( $self->table ) ) {
+ $self->{'Table'} = shift;
+ carp "warning: FS::Record::new called with table name ". $self->{'Table'};
+ }
+
+ #$self->{'Hash'} = shift;
+ my $newhash = shift;
+ $self->{'Hash'} = { map { $_ => $newhash->{$_} } qw(svcnum svcpart) };
+ $self->setdefault;
+ $self->{'Hash'}{$_} = $newhash->{$_}
+ foreach #grep length($newhash->{$_}),
+ keys %$newhash;
+
+ foreach my $field ( grep !defined($self->{'Hash'}{$_}), $self->fields ) {
+ $self->{'Hash'}{$field}='';
+ }
+
+ $self->_rebless if $self->can('_rebless');
+
+ $self->{'modified'} = 0;
+
+ $self->_cache($self->{'Hash'}, shift) if $self->can('_cache') && @_;
+
+ $self;
+}
+
sub virtual_fields {
# This restricts the fields based on part_svc_column and the svcpart of
More information about the freeside-commits
mailing list