[freeside-commits] freeside/FS/FS part_svc.pm, 1.26,
1.27 part_svc_column.pm, 1.3, 1.4
Ivan,,,
ivan at wavetail.420.am
Sat Jun 24 09:41:46 PDT 2006
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv19993/FS/FS
Modified Files:
part_svc.pm part_svc_column.pm
Log Message:
Add the ability to link customer service definition fields to inventory
classes, with an "automatic/manual" flag. Add the ability for the web
interface to maintain these links. Start prettying up the service def.
edit in preparation for Bigger Changes.
Index: part_svc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_svc.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- part_svc.pm 21 Nov 2005 15:24:39 -0000 1.26
+++ part_svc.pm 24 Jun 2006 16:41:44 -0000 1.27
@@ -11,7 +11,7 @@
@ISA = qw(FS::Record);
-$DEBUG = 0;
+$DEBUG = 1;
=head1 NAME
@@ -79,7 +79,7 @@
=item I<svcdb>__I<field> - Default or fixed value for I<field> in I<svcdb>.
-=item I<svcdb>__I<field>_flag - defines I<svcdb>__I<field> action: null, `D' for default, or `F' for fixed. For virtual fields, can also be 'X' for excluded.
+=item I<svcdb>__I<field>_flag - defines I<svcdb>__I<field> action: null or empty (no default), `D' for default, `F' for fixed (unchangeable), `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded.
=back
@@ -142,7 +142,8 @@
} );
my $flag = $self->getfield($svcdb.'__'.$field.'_flag');
- if ( uc($flag) =~ /^([DFX])$/ ) {
+ #if ( uc($flag) =~ /^([DFMAX])$/ ) {
+ if ( uc($flag) =~ /^([A-Z])$/ ) { #part_svc_column will test it
$part_svc_column->setfield('columnflag', $1);
$part_svc_column->setfield('columnvalue',
$self->getfield($svcdb.'__'.$field)
@@ -260,7 +261,8 @@
} );
my $flag = $new->getfield($svcdb.'__'.$field.'_flag');
- if ( uc($flag) =~ /^([DFX])$/ ) {
+ #if ( uc($flag) =~ /^([DFMAX])$/ ) {
+ if ( uc($flag) =~ /^([A-Z])$/ ) { #part_svc_column will test it
$part_svc_column->setfield('columnflag', $1);
$part_svc_column->setfield('columnvalue',
$new->getfield($svcdb.'__'.$field)
@@ -536,7 +538,16 @@
map { my $svcdb = $_;
my @fields = fields($svcdb);
push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
- map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields;
+
+ map {
+ if ( $param->{ $svcdb.'__'.$_.'_flag' } =~ /^[MA]$/ ) {
+ $param->{ $svcdb.'__'.$_ } =
+ delete( $param->{ $svcdb.'__'.$_.'_classnum' } );
+ }
+ ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' );
+ }
+ @fields;
+
} grep defined( dbdef->table($_) ),
qw( svc_acct svc_domain svc_forward svc_www svc_broadband )
)
Index: part_svc_column.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_svc_column.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- part_svc_column.pm 26 Nov 2004 09:39:52 -0000 1.3
+++ part_svc_column.pm 24 Jun 2006 16:41:44 -0000 1.4
@@ -41,7 +41,7 @@
=item columnvalue - default or fixed value for the column
-=item columnflag - null, D, F, X (virtual fields)
+=item columnflag - null or empty (no default), `D' for default, `F' for fixed (unchangeable), `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded.
=back
@@ -91,10 +91,16 @@
;
return $error if $error;
- $self->columnflag =~ /^([DFX])$/
+ $self->columnflag =~ /^([DFMAX])$/
or return "illegal columnflag ". $self->columnflag;
$self->columnflag(uc($1));
+ if ( $self->columnflag =~ /^[MA]$/ ) {
+ $error =
+ $self->ut_foreign_key( 'columnvalue', 'inventory_class', 'classnum' );
+ return $error if $error;
+ }
+
$self->SUPER::check;
}
More information about the freeside-commits
mailing list