Code Duplication    Length = 7-7 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 1558-1564 (lines=7) @@
1555
    if ( $is_ajax ) {
1556
        // Save address fields.
1557
        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1558
        foreach ( $address_fields as $field ) {
1559
            if ( isset( $user[$field] ) ) {
1560
                $invoice->set( $field, $user[$field] );
1561
            }
1562
            
1563
            $invoice->save();
1564
        }
1565
1566
        $response['success']            = true;
1567
        $response['data']['subtotal']   = $invoice->get_subtotal();
@@ 1631-1637 (lines=7) @@
1628
    
1629
    // Save vat fields.
1630
    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1631
    foreach ( $address_fields as $field ) {
1632
        if ( isset( $invoice_data['user_info'][$field] ) ) {
1633
            $invoice->set( $field, $invoice_data['user_info'][$field] );
1634
        }
1635
        
1636
        $invoice->save();
1637
    }
1638
1639
    // Add the user data for hooks
1640
    $valid_data['user'] = $user;