[freeside-commits] branch FREESIDE_3_BRANCH updated. 37fa9b067e286bc5f0abe693ec7c3aec4fd0b0b8

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


The branch, FREESIDE_3_BRANCH has been updated
       via  37fa9b067e286bc5f0abe693ec7c3aec4fd0b0b8 (commit)
      from  6ddb8c85f963358bbb1797308df95465b4c2b160 (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 37fa9b067e286bc5f0abe693ec7c3aec4fd0b0b8
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Mar 20 19:11:42 2016 -0700

    allow null serial and mac, RT#31388

diff --git a/FS/FS/svc_cable.pm b/FS/FS/svc_cable.pm
index 944f781..6b4c55b 100644
--- a/FS/FS/svc_cable.pm
+++ b/FS/FS/svc_cable.pm
@@ -163,8 +163,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;
 
@@ -177,16 +177,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