[freeside-commits] branch FREESIDE_4_BRANCH updated. 9f77e815ac02d6d35973c4bfe3974f509b3aad33

Ivan Kohler ivan at freeside.biz
Tue Aug 11 11:13:00 PDT 2020


The branch, FREESIDE_4_BRANCH has been updated
       via  9f77e815ac02d6d35973c4bfe3974f509b3aad33 (commit)
      from  6089ce5111d50813cf40194a2f36dab1343b4484 (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 9f77e815ac02d6d35973c4bfe3974f509b3aad33
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Aug 11 11:12:59 2020 -0700

    svc_hardware: better error messages for bad hw_addr when not validating as a MAC address, improve label display, RT#84773

diff --git a/FS/FS/svc_hardware.pm b/FS/FS/svc_hardware.pm
index aa411e039..7159f6dda 100644
--- a/FS/FS/svc_hardware.pm
+++ b/FS/FS/svc_hardware.pm
@@ -138,18 +138,18 @@ sub label {
   my @label = ();
   if (my $type = $self->hardware_type) {
     my $typenum_label = $part_svc->part_svc_column('typenum');
-    push @label, ( $typenum_label && $typenum_label->columnlabel || 'Type:' ).
-                 $type->description;
+    push @label, ( $typenum_label && $typenum_label->columnlabel || 'Type' ).
+                 ':'. $type->description;
   }
   if (my $ser = $self->serial) {
     my $serial_label = $part_svc->part_svc_column('serial');
-    push @label, ( $serial_label && $serial_label->columnlabel || 'Serial#' ).
-                 $ser;
+    push @label, ( $serial_label && $serial_label->columnlabel || 'Serial' ).
+                 '#'. $ser;
   }
   if (my $mac = $self->display_hw_addr) {
     my $hw_addr_label = $part_svc->part_svc_column('hw_addr');
-    push @label, ( $hw_addr_label && $hw_addr_label->columnlabel || 'MAC:').
-    $mac;
+    push @label, ( $hw_addr_label && $hw_addr_label->columnlabel || 'MAC').
+                 ':'. $mac;
   }
   return join(', ', @label);
 }
@@ -191,6 +191,10 @@ sub check {
     $hw_addr = uc($hw_addr);
     $hw_addr =~ /^[0-9A-F]{12}$/ 
       or return "Illegal (MAC address) '".$self->getfield('hw_addr')."'";
+  } else {
+    return "Illegal (hardware address) '".$self->getfield('hw_addr')."': ".
+           "12 alphanumeric characters maximum"
+      if length($hw_addr) > 12;
   }
   $self->setfield('hw_addr', $hw_addr);
 

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

Summary of changes:
 FS/FS/svc_hardware.pm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list