Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1334-1340 (lines=7) @@
1331
    if ( $is_ajax ) {
1332
        // Save address fields.
1333
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1334
        foreach ( $address_fields as $field ) {
1335
            if ( isset( $user[$field] ) ) {
1336
                $invoice->set( $field, $user[$field] );
1337
            }
1338
            
1339
            $invoice->save();
1340
        }
1341
1342
        $response['success']            = true;
1343
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1407-1413 (lines=7) @@
1404
    
1405
    // Save vat fields.
1406
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1407
    foreach ( $address_fields as $field ) {
1408
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1409
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1410
        }
1411
        
1412
        $invoice->save();
1413
    }
1414
1415
    // Add the user data for hooks
1416
    $valid_data['user'] = $user;