[freeside-commits] branch master updated. 99670c0a0b72b05d09f948027b50cd8e9850ad37

Ivan ivan at 420.am
Sun Mar 20 19:11:40 PDT 2016


The branch, master has been updated
       via  99670c0a0b72b05d09f948027b50cd8e9850ad37 (commit)
      from  e2927d0905e5941f0b18fef38f4692eebaa579b7 (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 99670c0a0b72b05d09f948027b50cd8e9850ad37
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Mar 20 19:11:39 2016 -0700

    allow null serial and mac, RT#31388

diff --git a/FS/FS/svc_cable.pm b/FS/FS/svc_cable.pm
index 122d8c6..01c5de7 100644
--- a/FS/FS/svc_cable.pm
+++ b/FS/FS/svc_cable.pm
@@ -160,8 +160,8 @@ sub check {
     || $self->ut_foreign_keyn('providernum', 'cable_provider', 'providernum')
     || $self->ut_alphan('ordernum')
     || $self->ut_foreign_key('modelnum', 'cable_model', 'modelnum')
-    || $self->ut_alpha('serialnum')
-    || $self->ut_mac_addr('mac_addr')
+    || $self->ut_alphan('serialnum')
+    || $self->ut_mac_addrn('mac_addr')
   ;
   return $error if $error;
 
@@ -174,16 +174,20 @@ sub _check_duplicate {
   # Not reliable checks because the table isn't locked, but that's why we have
   # unique indices.  These are just to give friendlier error messages.
 
-  my @dup_mac;
-  @dup_mac = $self->find_duplicates('global', 'mac_addr');
-  if ( @dup_mac ) {
-    return "MAC address in use (svcnum ".$dup_mac[0]->svcnum.")";
+  if ( $self->mac_addr ) {
+    my @dup_mac;
+    @dup_mac = $self->find_duplicates('global', 'mac_addr');
+    if ( @dup_mac ) {
+      return "MAC address in use (svcnum ".$dup_mac[0]->svcnum.")";
+    }
   }
 
-  my @dup_serial;
-  @dup_serial = $self->find_duplicates('global', 'serialnum');
-  if ( @dup_serial ) {
-    return "Serial number in use (svcnum ".$dup_serial[0]->svcnum.")";
+  if ( $self->serialnum ) {
+    my @dup_serial;
+    @dup_serial = $self->find_duplicates('global', 'serialnum');
+    if ( @dup_serial ) {
+      return "Serial number in use (svcnum ".$dup_serial[0]->svcnum.")";
+    }
   }
 
   '';

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

Summary of changes:
 FS/FS/svc_cable.pm |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list