Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1092-1098 (lines=7) @@
1089
    if ( $is_ajax ) {
1090
        // Save address fields.
1091
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1092
        foreach ( $address_fields as $field ) {
1093
            if ( isset( $user[$field] ) ) {
1094
                $invoice->set( $field, $user[$field] );
1095
            }
1096
            
1097
            $invoice->save();
1098
        }
1099
1100
        $response['success']            = true;
1101
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1165-1171 (lines=7) @@
1162
    
1163
    // Save vat fields.
1164
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1165
    foreach ( $address_fields as $field ) {
1166
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1167
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1168
        }
1169
        
1170
        $invoice->save();
1171
    }
1172
1173
    // Add the user data for hooks
1174
    $valid_data['user'] = $user;