Setup the use_billing flag. for updating billing data
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Jul 2018 19:37:07 +0000 (15:37 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Jul 2018 19:37:07 +0000 (15:37 -0400)
So if non of the boxes are checked then no update insert is done and the
fields aren't required.

classes/billingSupport.php

index d8870fa..023280e 100644 (file)
@@ -1583,8 +1583,9 @@ class GlmBillingSupport
             }
         }
         // Check to see if using contact or business address for billing
-        $contact_use_billing = filter_var( $_REQUEST['contact_use_billing'], FILTER_VALIDATE_BOOLEAN );
+        $contact_use_billing  = filter_var( $_REQUEST['contact_use_billing'], FILTER_VALIDATE_BOOLEAN );
         $business_use_billing = filter_var( $_REQUEST['business_use_billing'], FILTER_VALIDATE_BOOLEAN );
+        $use_billing          = filter_var( $_REQUEST['use_billing'], FILTER_VALIDATE_BOOLEAN );
         if ( $contact_use_billing ) {
             // Need to convert city to String
             $city_id = filter_var( $_REQUEST['city'], FILTER_VALIDATE_INT );
@@ -1645,7 +1646,7 @@ class GlmBillingSupport
                 '%s', // country
                 '%s', // zip
             );
-        } else if ( !$contact_use_billing && !$business_use_billing ) {
+        } else if ( $use_billing ) {
             $billing_updated = array(
                 'email'            => filter_var( $_REQUEST['billing_email'] ),
                 'billing_company'  => filter_var( $_REQUEST['billing_company'] ),