Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

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