Update for php notices
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 2 Aug 2018 17:45:05 +0000 (13:45 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 2 Aug 2018 17:45:05 +0000 (13:45 -0400)
update code to get rid of notices.

classes/billingSupport.php

index 023280e..a0fb635 100644 (file)
@@ -1577,15 +1577,15 @@ class GlmBillingSupport
         $billingFields   = $billingAccount->fields;
         if ( $billingFields ) {
             foreach( $billingFields as $field_name => $field ) {
-                if ( $field['required'] ) {
+                if ( isset( $field['required'] ) && $field['required'] ) {
                     $required_fields[] = $field_name;
                 }
             }
         }
         // Check to see if using contact or business address for billing
-        $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 );
+        $contact_use_billing  = isset( $_REQUEST['contact_use_billing'] ) ? filter_var( $_REQUEST['contact_use_billing'], FILTER_VALIDATE_BOOLEAN ) : false;
+        $business_use_billing = isset( $_REQUEST['business_use_billing'] ) ? filter_var( $_REQUEST['business_use_billing'], FILTER_VALIDATE_BOOLEAN ) : false;
+        $use_billing          = isset( $_REQUEST['use_billing'] ) ? filter_var( $_REQUEST['use_billing'], FILTER_VALIDATE_BOOLEAN ) : false;
         if ( $contact_use_billing ) {
             // Need to convert city to String
             $city_id = filter_var( $_REQUEST['city'], FILTER_VALIDATE_INT );
@@ -1680,7 +1680,7 @@ class GlmBillingSupport
         }
         // Check the given $ref_dest
         $member_id = filter_var( $ref_dest, FILTER_VALIDATE_INT );
-        if ( $member_id && $billing_updated && $billing_updated_format ) {
+        if ( $member_id && isset( $billing_updated ) && $billing_updated && isset( $billing_updated_format ) && $billing_updated_format ) {
             // Get the members account
             $account = $this->getAccountByRefDest( $member_id );