[freeside-commits] freeside/FS/FS svc_acct.pm, 1.197,
1.198 svc_Common.pm, 1.33, 1.34
Ivan,,,
ivan at wavetail.420.am
Sun Aug 6 02:10:09 PDT 2006
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv1316/FS/FS
Modified Files:
svc_acct.pm svc_Common.pm
Log Message:
this should process default usergroup as well as fixed now
Index: svc_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_Common.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- svc_Common.pm 14 Jul 2006 03:27:48 -0000 1.33
+++ svc_Common.pm 6 Aug 2006 09:10:07 -0000 1.34
@@ -51,7 +51,9 @@
#$self->{'Hash'} = shift;
my $newhash = shift;
$self->{'Hash'} = { map { $_ => $newhash->{$_} } qw(svcnum svcpart) };
- $self->setdefault;
+
+ $self->setdefault( $self->_fieldhandlers );
+
$self->{'Hash'}{$_} = $newhash->{$_}
foreach grep { defined($newhash->{$_}) && length($newhash->{$_}) }
keys %$newhash;
@@ -69,6 +71,9 @@
$self;
}
+#empty default
+sub _fieldhandlers { (); }
+
sub virtual_fields {
# This restricts the fields based on part_svc_column and the svcpart of
@@ -490,11 +495,9 @@
my $columnname = $part_svc_column->columnname;
my $columnvalue = $part_svc_column->columnvalue;
- if ( exists( $coderef->{$columnname} ) ) {
- &{ $coderef->{$columnname} }( $self, $columnvalue);
- } else {
- $self->setfield( $columnname, $columnvalue );
- }
+ $columnvalue = &{ $coderef->{$columnname} }( $self, $columnvalue )
+ if exists( $coderef->{$columnname} );
+ $self->setfield( $columnname, $columnvalue );
}
Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- svc_acct.pm 6 Aug 2006 08:43:40 -0000 1.197
+++ svc_acct.pm 6 Aug 2006 09:10:07 -0000 1.198
@@ -188,6 +188,20 @@
sub table { 'svc_acct'; }
+sub _fieldhandlers {
+ #false laziness with edit/svc_acct.cgi
+ 'usergroup' => sub {
+ my $usergroup = shift;
+ if ( ref($usergroup) eq 'ARRAY' ) {
+ $usergroup;
+ } elsif ( length($usergroup) ) {
+ [ split(/\s*,\s*/, $usergroup) ];
+ } else {
+ [];
+ }
+ },
+}
+
=item insert [ , OPTION => VALUE ... ]
Adds this account to the database. If there is an error, returns the error,
More information about the freeside-commits
mailing list