[freeside-commits] branch master updated. 712864e9372891cc3773d01e546103c23c10ff03

Mark Wells mark at 420.am
Fri Mar 2 13:06:51 PST 2012


The branch, master has been updated
       via  712864e9372891cc3773d01e546103c23c10ff03 (commit)
      from  fec48523d3cf056da08813f9b2b7d633b27aaf8d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 712864e9372891cc3773d01e546103c23c10ff03
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Mar 2 13:05:52 2012 -0800

    fix svc_broadband upgrade issues, #14698

diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm
index 7606ad7..18b7036 100755
--- a/FS/FS/svc_broadband.pm
+++ b/FS/FS/svc_broadband.pm
@@ -101,15 +101,15 @@ sub table_info {
       'description' => 'Descriptive label for this particular device',
       'speed_down'  => 'Maximum download speed for this service in Kbps.  0 denotes unlimited.',
       'speed_up'    => 'Maximum upload speed for this service in Kbps.  0 denotes unlimited.',
-      #'ip_addr'     => 'IP address.  Leave blank for automatic assignment.',
-      #'blocknum'    => 
-      #{ 'label' => 'Address block',
-      #                   'type'  => 'select',
-      #                   'select_table' => 'addr_block',
-      #                    'select_key'   => 'blocknum',
-      #                   'select_label' => 'cidr',
-      #                   'disable_inventory' => 1,
-      #                 },
+      'ip_addr'     => 'IP address.  Leave blank for automatic assignment.',
+      'blocknum'    => 
+      { 'label' => 'Address block',
+                         'type'  => 'select',
+                         'select_table' => 'addr_block',
+                          'select_key'   => 'blocknum',
+                         'select_label' => 'cidr',
+                         'disable_inventory' => 1,
+                       },
      'plan_id' => 'Service Plan Id',
      'performance_profile' => 'Peformance Profile',
      'authkey'      => 'Authentication key',
@@ -418,8 +418,11 @@ sub check {
       if $router->agentnum and $router->agentnum != $agentnum;
 
     if ( $router->auto_addr ) {
-      my $error = $self->assign_ip_addr;
-      return $error if $error;
+      my $addr_block = $self->addr_block;
+      unless ( $addr_block and $addr_block->manual_flag ) {
+        my $error = $self->assign_ip_addr;
+        return $error if $error;
+      }
     }
     else {
       $self->blocknum('');
@@ -578,9 +581,6 @@ sub mac_addr_formatted {
   join( $delim || '', $addr =~ /../g );
 }
 
-=back
-
-
 #class method
 sub _upgrade_data {
   my $class = shift;
@@ -591,9 +591,20 @@ sub _upgrade_data {
       routernum => ''
     })) {
     my $addr_block = $self->addr_block;
-    if ( my $routernum = $addr_block->routernum ) {
+    my $ip_addr = $self->ip_addr;
+    my $routernum = $addr_block->routernum;
+    if ( $routernum ) {
       $self->set(routernum => $routernum);
-      my $error = $self->replace;
+      my $error = $self->check;
+      # sanity check: don't allow this to change IP address or block
+      # (other than setting blocknum to null for a non-auto-assigned router)
+      if ( $self->ip_addr ne $ip_addr 
+        or ($self->blocknum and $self->blocknum != $addr_block->blocknum)) {
+        die "Upgrading service ".$self->svcnum." would change its block/address.\n\nCheck your router and address block configuration.\n";
+        next;
+      }
+
+      $error ||= $self->replace;
       die "error assigning routernum $routernum to service ".$self->svcnum.
           ":\n$error\n"
         if $error;
@@ -606,6 +617,8 @@ sub _upgrade_data {
   '';
 }
 
+=back
+
 =head1 BUGS
 
 The business with sb_field has been 'fixed', in a manner of speaking.
diff --git a/httemplate/docs/man/FS/part_export/.cvs_is_on_crack b/httemplate/docs/man/FS/part_export/.cvs_is_on_crack
deleted file mode 100644
index e69de29..0000000

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/svc_broadband.pm                             |   45 +++++++++++++-------
 1 files changed, 29 insertions(+), 16 deletions(-)
 delete mode 100644 httemplate/docs/man/FS/part_export/.cvs_is_on_crack




More information about the freeside-commits mailing list