Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1606-1612 (lines=7) @@
1603
    if ( $is_ajax ) {
1604
        // Save address fields.
1605
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1606
        foreach ( $address_fields as $field ) {
1607
            if ( isset( $user[$field] ) ) {
1608
                $invoice->set( $field, $user[$field] );
1609
            }
1610
1611
            $invoice->save();
1612
        }
1613
1614
        $response['success']            = true;
1615
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1680-1686 (lines=7) @@
1677
    
1678
    // Save vat fields.
1679
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1680
    foreach ( $address_fields as $field ) {
1681
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1682
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1683
        }
1684
1685
        $invoice->save();
1686
    }
1687
1688
    // Add the user data for hooks
1689
    $valid_data['user'] = $user;