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();
@@ 1679-1685 (lines=7) @@
1676
    
1677
    // Save vat fields.
1678
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1679
    foreach ( $address_fields as $field ) {
1680
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1681
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1682
        }
1683
1684
        $invoice->save();
1685
    }
1686
1687
    // Add the user data for hooks
1688
    $valid_data['user'] = $user;