Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1599-1605 (lines=7) @@
1596
    if ( $is_ajax ) {
1597
        // Save address fields.
1598
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1599
        foreach ( $address_fields as $field ) {
1600
            if ( isset( $user[$field] ) ) {
1601
                $invoice->set( $field, $user[$field] );
1602
            }
1603
            
1604
            $invoice->save();
1605
        }
1606
1607
        $response['success']            = true;
1608
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1672-1678 (lines=7) @@
1669
    
1670
    // Save vat fields.
1671
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1672
    foreach ( $address_fields as $field ) {
1673
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1674
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1675
        }
1676
        
1677
        $invoice->save();
1678
    }
1679
1680
    // Add the user data for hooks
1681
    $valid_data['user'] = $user;