Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1317-1323 (lines=7) @@
1314
    if ( $is_ajax ) {
1315
        // Save address fields.
1316
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1317
        foreach ( $address_fields as $field ) {
1318
            if ( isset( $user[$field] ) ) {
1319
                $invoice->set( $field, $user[$field] );
1320
            }
1321
            
1322
            $invoice->save();
1323
        }
1324
1325
        $response['success']            = true;
1326
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1390-1396 (lines=7) @@
1387
    
1388
    // Save vat fields.
1389
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1390
    foreach ( $address_fields as $field ) {
1391
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1392
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1393
        }
1394
        
1395
        $invoice->save();
1396
    }
1397
1398
    // Add the user data for hooks
1399
    $valid_data['user'] = $user;