freeside-upgrade fixes related to #14698 and #15017
authorMark Wells <mark@freeside.biz>
Sat, 17 Mar 2012 22:01:19 +0000 (15:01 -0700)
committerMark Wells <mark@freeside.biz>
Sat, 17 Mar 2012 22:01:19 +0000 (15:01 -0700)
FS/FS/part_export/sqlradius.pm
FS/FS/radius_attr.pm
FS/FS/svc_broadband.pm
httemplate/view/svc_broadband.cgi

index 752bf12..910346b 100644 (file)
@@ -1185,7 +1185,10 @@ SELECT groupname, attribute, op, value, \'R\' FROM radgroupreply';
         'priority'  => 1,
       };
       $error = $radius_group->insert;
-      return "error inserting group $groupname: $error" if $error;
+      if ( $error ) {
+        warn "error inserting group $groupname: $error";
+        next;#don't continue trying to insert the attribute
+      }
       $attrs_of{$groupname} = {};
       $groupnum_of{$groupname} = $radius_group->groupnum;
     }
@@ -1202,7 +1205,10 @@ SELECT groupname, attribute, op, value, \'R\' FROM radgroupreply';
         'value' => $value,
       };
       $error = $new->replace($old);
-      return "error modifying attr $attrname: $error" if $error;
+      if ( $error ) {
+        warn "error modifying attr $attrname: $error";
+        next;
+      }
     }
     else {
       $new = new FS::radius_attr {
@@ -1213,7 +1219,10 @@ SELECT groupname, attribute, op, value, \'R\' FROM radgroupreply';
         'value'    => $value,
       };
       $error = $new->insert;
-      return "error inserting attr $attrname: $error" if $error;
+      if ( $error ) {
+        warn "error inserting attr $attrname: $error" if $error;
+        next;
+      }
     }
     $attrs_of{$groupname}->{$attrname} = $new;
   } #foreach $row
index 51b1bab..cc03b4d 100644 (file)
@@ -195,7 +195,7 @@ check or R for reply.
 =cut
 
 my %ops = (
-  C => [ '==', ':=', '+=', '!=', '>', '>=', '<', '<=', '=~', '!~', '=*', '!*' ],
+  C => [ '=', '==', ':=', '+=', '!=', '>', '>=', '<', '<=', '=~', '!~', '=*', '!*' ],
   R => [ '=', ':=', '+=' ],
 );
 
index 212a4bf..e9917ff 100755 (executable)
@@ -421,7 +421,7 @@ sub check {
   
     my $router = $self->router;
     return "Router ".$self->routernum." does not serve this customer"
-      if $router->agentnum and $router->agentnum != $agentnum;
+      if $router->agentnum and $agentnum and $router->agentnum != $agentnum;
 
     if ( $router->manual_addr ) {
       $self->blocknum('');
@@ -599,7 +599,7 @@ sub allowed_routers {
   my $self = shift;
   my $svcpart = $self->svcnum ? $self->cust_svc->svcpart : $self->svcpart;
   my @r = map { $_->router } qsearch('part_svc_router', 
-    { svcpart => $self->cust_svc->svcpart });
+    { svcpart => $svcpart });
   if ( $self->cust_main ) {
     my $agentnum = $self->cust_main->agentnum;
     return grep { !$_->agentnum or $_->agentnum == $agentnum } @r;
index 131582f..75e673c 100644 (file)
@@ -47,10 +47,11 @@ push @fields,
 
 sub router {
   my $svc = shift;
-  my $router = $svc->router or return '';
+  my $router = $svc->router;
   my $block = $svc->addr_block;
+  $router = $router->routernum . ': ' . $router->routername if $router;
   $block = '; '.$block->cidr if $block;
-  $router->routernum . ': ' . $router->routername . $block
+  $router . $block
 }
 
 sub ip_addr {