[freeside-commits] branch FREESIDE_3_BRANCH updated. 47079c956fde5d5e85e1300dd7a6a600137f4fb9

Ivan Kohler ivan at freeside.biz
Sun Oct 28 15:14:37 PDT 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  47079c956fde5d5e85e1300dd7a6a600137f4fb9 (commit)
       via  513d1c3cbbcb536acda260ffe121610fc9c1ed81 (commit)
       via  74cdc73b9f0e6e1cdd7fd68e7fb2830bba4fdba0 (commit)
      from  03581a2d9d8cc76d3fb88cbc78da3128b137157a (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 47079c956fde5d5e85e1300dd7a6a600137f4fb9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Oct 28 15:14:30 2018 -0700

    config for svc_hardware dup checking, RT#81534

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 7f3231367..5c0fdffa4 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3345,6 +3345,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'global_unique-svc_hardware',
+    'section'     => '',
+    'description' => 'Turn on duplicate checking for svc_hardware services.  Unique fields are IP address, hardware address, and serial number (per device type).',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'svc_external-skip_manual',
     'section'     => 'UI',
     'description' => 'When provisioning svc_external services, skip manual entry of id and title fields in the UI.  Usually used in conjunction with an export that populates these fields (i.e. artera_turbo).',
diff --git a/FS/FS/svc_hardware.pm b/FS/FS/svc_hardware.pm
index 62556ba6a..f260502f5 100644
--- a/FS/FS/svc_hardware.pm
+++ b/FS/FS/svc_hardware.pm
@@ -215,6 +215,40 @@ sub check {
   $self->SUPER::check;
 }
 
+sub _check_duplicate {
+  my $self = shift;
+
+  return '' unless $conf->exists('global_unique-svc_hardware');
+
+  $self->lock_table;
+
+  if ( $self->hw_addr ) {
+    my @dup_mac;
+    @dup_mac = $self->find_duplicates('global', 'hw_addr');
+    if ( @dup_mac ) {
+      return "MAC address in use (svcnum ".$dup_mac[0]->svcnum.")";
+    }
+  }
+
+  if ( $self->ip_addr ) {
+    my @dup_ip;
+    @dup_ip = $self->find_duplicates('global', 'ip_addr');
+    if ( @dup_ip ) {
+      return "IP address in use (svcnum ".$dup_ip[0]->svcnum.")";
+    }
+  }
+
+  if ( $self->serialnum ) {
+    my @dup_serial;
+    @dup_serial = $self->find_duplicates('global', 'typenum', 'serialnum');
+    if ( @dup_serial ) {
+      return "Serial number in use (svcnum ".$dup_serial[0]->svcnum.")";
+    }
+  }
+
+  '';
+}
+
 =item hardware_type
 
 Returns the L<FS::hardware_type> object associated with this installation.

commit 513d1c3cbbcb536acda260ffe121610fc9c1ed81
Merge: 74cdc73b9 03581a2d9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Oct 28 13:23:32 2018 -0700

    Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_3_BRANCH


commit 74cdc73b9f0e6e1cdd7fd68e7fb2830bba4fdba0
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Oct 23 17:30:37 2018 -0700

    fix upgrade: clear bad cust_refund.source_paynum before encrypting, RT#81508

diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index bbd1ee12b..e901a7f1d 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -332,11 +332,14 @@ sub upgrade_data {
 
   tie my %hash, 'Tie::IxHash', 
 
+    #remap log levels
+    'log' => [],
+
     #fix whitespace - before cust_main
     'cust_location' => [],
 
-    #remap log levels
-    'log' => [],
+    #remove bad source_paynum before cust_main
+    'cust_refund' => [],
 
     #cust_main (tokenizes cards, remove paycvv from history, locations, cust_payby, etc)
     # (handles payinfo encryption/tokenization across all relevant tables)
@@ -401,7 +404,7 @@ sub upgrade_data {
     'cust_pkg' => [],
     #'cust_pkg_reason' => [],
     'cust_pkg_discount' => [],
-    'cust_refund' => [],
+    #'cust_refund' => [],
     'banned_pay' => [],
 
     #default namespace

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

Summary of changes:
 FS/FS/Conf.pm         |  7 +++++++
 FS/FS/Upgrade.pm      |  9 ++++++---
 FS/FS/svc_hardware.pm | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list