| 
                                
                                    @@ 1576-1582 (lines=7) @@
                                 | 
                            
                                                            
                                    | 1573 | 
                                     | 
                                        if ( $is_ajax ) { | 
                                
                                                            
                                    | 1574 | 
                                     | 
                                            // Save address fields.  | 
                                
                                                            
                                    | 1575 | 
                                     | 
                                            $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );  | 
                                
                                                            
                                    | 1576 | 
                                     | 
                                            foreach ( $address_fields as $field ) { | 
                                
                                                            
                                    | 1577 | 
                                     | 
                                                if ( isset( $user[$field] ) ) { | 
                                
                                                            
                                    | 1578 | 
                                     | 
                                                    $invoice->set( $field, $user[$field] );  | 
                                
                                                            
                                    | 1579 | 
                                     | 
                                                }  | 
                                
                                                            
                                    | 1580 | 
                                     | 
                                                  | 
                                
                                                            
                                    | 1581 | 
                                     | 
                                                $invoice->save();  | 
                                
                                                            
                                    | 1582 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 1583 | 
                                     | 
                                     | 
                                
                                                            
                                    | 1584 | 
                                     | 
                                            $response['success']            = true;  | 
                                
                                                            
                                    | 1585 | 
                                     | 
                                            $response['data']['subtotal']   = $invoice->get_subtotal();  | 
                                
                                                                                
                                 | 
                                
                                    @@ 1649-1655 (lines=7) @@
                                 | 
                            
                                                            
                                    | 1646 | 
                                     | 
                                          | 
                                
                                                            
                                    | 1647 | 
                                     | 
                                        // Save vat fields.  | 
                                
                                                            
                                    | 1648 | 
                                     | 
                                        $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );  | 
                                
                                                            
                                    | 1649 | 
                                     | 
                                        foreach ( $address_fields as $field ) { | 
                                
                                                            
                                    | 1650 | 
                                     | 
                                            if ( isset( $invoice_data['user_info'][$field] ) ) { | 
                                
                                                            
                                    | 1651 | 
                                     | 
                                                $invoice->set( $field, $invoice_data['user_info'][$field] );  | 
                                
                                                            
                                    | 1652 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 1653 | 
                                     | 
                                              | 
                                
                                                            
                                    | 1654 | 
                                     | 
                                            $invoice->save();  | 
                                
                                                            
                                    | 1655 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 1656 | 
                                     | 
                                     | 
                                
                                                            
                                    | 1657 | 
                                     | 
                                        // Add the user data for hooks  | 
                                
                                                            
                                    | 1658 | 
                                     | 
                                        $valid_data['user'] = $user;  |