Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1588-1594 (lines=7) @@
1585
    if ( $is_ajax ) {
1586
        // Save address fields.
1587
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1588
        foreach ( $address_fields as $field ) {
1589
            if ( isset( $user[$field] ) ) {
1590
                $invoice->set( $field, $user[$field] );
1591
            }
1592
            
1593
            $invoice->save();
1594
        }
1595
1596
        $response['success']            = true;
1597
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1661-1667 (lines=7) @@
1658
    
1659
    // Save vat fields.
1660
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1661
    foreach ( $address_fields as $field ) {
1662
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1663
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1664
        }
1665
        
1666
        $invoice->save();
1667
    }
1668
1669
    // Add the user data for hooks
1670
    $valid_data['user'] = $user;