[freeside-commits] freeside/FS/FS Schema.pm, 1.249, 1.250 dsl_note.pm, 1.1, 1.2 geocode_Mixin.pm, 1.2, 1.3 qual.pm, 1.3, 1.4 svc_Common.pm, 1.59, 1.60 svc_dsl.pm, 1.6, 1.7

Erik Levinson levinse at wavetail.420.am
Tue Nov 30 21:56:12 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv14495/FS/FS

Modified Files:
	Schema.pm dsl_note.pm geocode_Mixin.pm qual.pm svc_Common.pm 
	svc_dsl.pm 
Log Message:
-ikano, svc_dsl, dsl_note, and qual on-going implementation, RT7111
-add predelete_hook_first and predelete_hook into svc_Common (don't use yet, might change or be removed 
soon)
-add new cust_location fields into geocode_Mixin location_hash


Index: qual.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/qual.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- qual.pm	28 Nov 2010 20:08:50 -0000	1.3
+++ qual.pm	1 Dec 2010 05:56:09 -0000	1.4
@@ -38,10 +38,6 @@
 
 =item locationnum
 
-Either one of these cases must be true:
--locationnum is non-null and prospectnum is null and custnum is null
--locationnum is null and (prospectnum is non-null or custnum is non-null, but not both non-null)
-
 =item phonenum - Service Telephone Number
 
 =item exportnum - export instance providing service-qualification capabilities,
@@ -117,25 +113,40 @@
     || $self->ut_foreign_keyn('prospectnum', 'prospect_main', 'prospectnum')
     || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
     || $self->ut_numbern('phonenum')
-    || $self->ut_foreign_key('exportnum', 'part_export', 'exportnum')
+    || $self->ut_foreign_keyn('exportnum', 'part_export', 'exportnum')
     || $self->ut_textn('vendor_qual_id')
     || $self->ut_alpha('status')
   ;
   return $error if $error;
 
-#Either one of these cases must be true:
-#1. locationnum is non-null and prospectnum is null and custnum is null
-#2. locationnum is null and (prospectnum is non-null or custnum is non-null, but not both non-null)
-  return "Invalid prospect/customer/location combination" unless (
-    ( $self->locationnum && !$self->prospectcnum && !$self->custnum  ) #1
- ||
-    ( !$self->locationnum && ( $self->prospectnum || $self->custnum ) 
-	&& !( $self->custnum && $self->prospectnum )  ) #2
+  return "Invalid prospect/customer/location combination" if (
+   ( $self->locationnum && $self->prospectnum && $self->custnum ) ||
+   ( !$self->locationnum && !$self->prospectnum && !$self->custnum )
   );
 
   $self->SUPER::check;
 }
 
+sub location {
+    my $self = shift;
+    if ( $self->locationnum ) {
+	my $l = qsearchs( 'cust_location', 
+		    { 'locationnum' => $self->locationnum });
+	return $l->location_hash if $l;
+    }
+    if ( $self->custnum ) {
+	my $c = qsearchs( 'cust_main', { 'custnum' => $self->custnum });
+	return $c->location_hash if $c;
+    }
+  # prospectnum does not imply any particular address! must specify locationnum
+
+    '';
+}
+
+sub status_long {
+    
+}
+
 =back
 
 =head1 SEE ALSO

Index: svc_dsl.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_dsl.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -d -r1.6 -r1.7
--- svc_dsl.pm	29 Nov 2010 22:11:00 -0000	1.6
+++ svc_dsl.pm	1 Dec 2010 05:56:09 -0000	1.7
@@ -263,6 +263,27 @@
   $self->SUPER::check;
 }
 
+sub predelete_hook_first {
+    my $self = shift;
+    my @exports = $self->part_svc->part_export_dsl_pull;
+    return 'More than one DSL-pulling export attached' if scalar(@exports) > 1;
+    if ( scalar(@exports) == 1 ) {
+	my $export = $exports[0];
+	return $export->dsl_pull($self);
+    }
+    '';
+}
+
+sub predelete_hook {
+    my $self = shift;
+    my @notes = $self->notes;
+    foreach my $note ( @notes ) {
+	my $error = $note->delete;
+	return $error if $error;
+    }
+    '';
+}
+
 =back
 
 =head1 SEE ALSO

Index: dsl_note.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/dsl_note.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- dsl_note.pm	29 Nov 2010 02:30:39 -0000	1.1
+++ dsl_note.pm	1 Dec 2010 05:56:09 -0000	1.2
@@ -34,11 +34,11 @@
 
 =item svcnum - the DSL for this note, see L<FS::svc_dsl>
 
-=item by - export-specific, e.g. note's author or ISP vs. telco/vendor
+=item user - export-specific, e.g. note's author or ISP vs. telco/vendor
 
 =item priority - export-specific, e.g. high priority or not; not used by most
 
-=item date - note date
+=item _date - note date
 
 =item note - the note
 
@@ -105,9 +105,9 @@
   my $error = 
     $self->ut_numbern('notenum')
     || $self->ut_foreign_key('svcnum', 'svc_dsl', 'svcnum')
-    || $self->ut_textn('by')
+    || $self->ut_textn('user')
     || $self->ut_alphasn('priority')
-    || $self->ut_numbern('date')
+    || $self->ut_numbern('_date')
     || $self->ut_text('note')
   ;
   return $error if $error;

Index: svc_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_Common.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -w -d -r1.59 -r1.60
--- svc_Common.pm	28 Oct 2010 07:47:13 -0000	1.59
+++ svc_Common.pm	1 Dec 2010 05:56:09 -0000	1.60
@@ -330,6 +330,8 @@
 sub _check_duplcate { ''; }
 sub preinsert_hook { ''; }
 sub table_dupcheck_fields { (); }
+sub predelete_hook { ''; }
+sub predelete_hook_first { ''; }
 
 =item delete [ , OPTION => VALUE ... ]
 
@@ -356,9 +358,11 @@
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
 
-  my $error =    $self->SUPER::delete
+  my $error = 	$self->predelete_hook_first 
+	      || $self->SUPER::delete
               || $self->export('delete', @$export_args)
 	      || $self->return_inventory
+	      || $self->predelete_hook
 	      || $self->cust_svc->delete
   ;
   if ( $error ) {

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -w -d -r1.249 -r1.250
--- Schema.pm	29 Nov 2010 22:11:00 -0000	1.249
+++ Schema.pm	1 Dec 2010 05:56:09 -0000	1.250
@@ -1685,7 +1685,7 @@
         'prospectnum',    'int',     'NULL',     '', '', '',
         'locationnum',    'int',     'NULL',     '', '', '',
 	'phonenum',     'varchar', 'NULL',       24, '', '',
-        'exportnum',      'int', '', '', '', '', 
+        'exportnum',      'int', 'NULL', '', '', '', 
         'vendor_qual_id',      'varchar', 'NULL', $char_d, '', '', 
         'status',      'char', '', 1, '', '', 
       ],
@@ -1871,9 +1871,9 @@
       'columns' => [
         'notenum',           'serial',    '',        '', '', '',
 	'svcnum',     'int', '',       '', '', '',
-        'by',              'varchar', 'NULL', $char_d,  '', '',
+        'user',     'varchar', 'NULL', $char_d,  '', '',
         'priority',   'char', 'NULL',       1,  '', '', 
-	'date',     'int', 'NULL',       '', '', '',
+	'_date',     'int', 'NULL',       '', '', '',
 	'note',     'text', '',       '', '', '',
       ],
       'primary_key' => 'notenum',

Index: geocode_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/geocode_Mixin.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- geocode_Mixin.pm	31 Oct 2010 01:07:52 -0000	1.2
+++ geocode_Mixin.pm	1 Dec 2010 05:56:09 -0000	1.3
@@ -51,7 +51,8 @@
   map { my $method = ($_ eq 'geocode') ? $_ : $prefix.$_;
         $_ => $self->get($method);
       }
-      qw( address1 address2 city county state zip country geocode );
+      qw( address1 address2 city county state zip country geocode 
+	location_type location_number location_kind );
 }
 
 =item location_label [ OPTION => VALUE ... ]



More information about the freeside-commits mailing list