Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1329-1335 (lines=7) @@
1326
    if ( $is_ajax ) {
1327
        // Save address fields.
1328
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1329
        foreach ( $address_fields as $field ) {
1330
            if ( isset( $user[$field] ) ) {
1331
                $invoice->set( $field, $user[$field] );
1332
            }
1333
            
1334
            $invoice->save();
1335
        }
1336
1337
        $response['success']            = true;
1338
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1402-1408 (lines=7) @@
1399
    
1400
    // Save vat fields.
1401
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1402
    foreach ( $address_fields as $field ) {
1403
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1404
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1405
        }
1406
        
1407
        $invoice->save();
1408
    }
1409
1410
    // Add the user data for hooks
1411
    $valid_data['user'] = $user;