Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1570-1576 (lines=7) @@
1567
    if ( $is_ajax ) {
1568
        // Save address fields.
1569
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1570
        foreach ( $address_fields as $field ) {
1571
            if ( isset( $user[$field] ) ) {
1572
                $invoice->set( $field, $user[$field] );
1573
            }
1574
            
1575
            $invoice->save();
1576
        }
1577
1578
        $response['success']            = true;
1579
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1643-1649 (lines=7) @@
1640
    
1641
    // Save vat fields.
1642
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1643
    foreach ( $address_fields as $field ) {
1644
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1645
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1646
        }
1647
        
1648
        $invoice->save();
1649
    }
1650
1651
    // Add the user data for hooks
1652
    $valid_data['user'] = $user;