fix cust_main-require_address2 vs cust_location, RT#41184
authorIvan Kohler <ivan@freeside.biz>
Tue, 26 Apr 2016 00:42:01 +0000 (17:42 -0700)
committerIvan Kohler <ivan@freeside.biz>
Tue, 26 Apr 2016 00:42:01 +0000 (17:42 -0700)
FS/FS/Conf.pm
FS/FS/cust_location.pm

index 6042cae..1097ef4 100644 (file)
@@ -3498,7 +3498,7 @@ and customer address. Include units.',
   {
     'key'         => 'cust_main-require_address2',
     'section'     => 'UI',
-    'description' => 'Second address field is required (on service address only, if billing and service addresses differ).  Also enables "Unit" labeling of address2 on customer view and edit pages.  Useful for multi-tenant applications.  See also: address2-search',
+    'description' => 'Second address field is required.  Also enables "Unit" labeling of address2 on customer view and edit pages.  Useful for multi-tenant applications.  See also: address2-search', # service address only part not working in the modern world, see #41184  (on service address only, if billing and service addresses differ)
     'type'        => 'checkbox',
   },
 
index 818838e..cbb4565 100644 (file)
@@ -375,10 +375,12 @@ sub check {
     $self->censustract("$1.$2");
   }
 
-  if ( $conf->exists('cust_main-require_address2') and 
-       !$self->ship_address2 =~ /\S/ ) {
-    return "Unit # is required";
-  }
+  #yikes... this is ancient, pre-dates cust_location and will be harder to
+  # implement now... how do we know this location is a service location from
+  # here and not a billing? we can't just check locationnums, we might be new :/
+  return "Unit # is required"
+    if $conf->exists('cust_main-require_address2')
+    && ! $self->address2 =~ /\S/;
 
   # tricky...we have to allow for the customer to not be inserted yet
   return "No prospect or customer!" unless $self->prospectnum