• Resolved Dirk

    (@dirkhag)


    #_ATTENDEESLIST / Attendeeslist.php shows a list of all attendees of an event.

    I also want to show a list of people who have cancelled their booking.

    I am using the following code for a new attendeeslist:

    if($EM_Booking->booking_status == 3 && !in_array($EM_Booking->get_person()->ID, $people) ){

    This is working, BUT: if someone has cancelled his booking and then booked again, he will be shown in both lists….attendees AND cancelled people.

    How can I solve this? And how can I count the cancelled bookings (without doubles)?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Dirk

    (@dirkhag)

    Better description:

    In principal I do not want to see cancelled bookings of a person more than once. I wonder why each cancellation will be listed. If a person has cancelled three times for an event, three cancellations will be shown in the bookings-list. I do not see a sense in this behavior.

    Yes, each bookings status is recorded and listed, unless you delete the booking. So if they cancel more than once, you will see it more than once. Very logical.

    If you set “Allow double bookings” to “yes”, then an email adress does not have to be unique for that event and can indeed be registered as both approved and cancelled, multiple times. Each one has their own booking ID.

    If double bookings are not allowed, a user will not be able to place a new booking if the cancelled one has not been deleted, as EM will check if the email is already linked to that event.

    Thread Starter Dirk

    (@dirkhag)

    In my case I have disabled the “Double Booking Option”. However one can accept and cancel a booking as often he likes and will appear on both lists (approved and cancelled) as you can see in the following example. The user has accepted the booking and then cancelled and finally accepted again….

    https://wanderfreunde-rheinmain.de/events/testevent/

    Thread Starter Dirk

    (@dirkhag)

    @duisterdenhaag Are you now official part of the support team?

    No, I am not. Never claimed to be either, nor do I have any desire to become part of the EM team. I’m just an EM user who likes to help out.

    Thread Starter Dirk

    (@dirkhag)

    Ok, fine if you can help.

    Thread Starter Dirk

    (@dirkhag)

    But still, my question is not answered. I am looking for a solution that cancelled bookings will not be shown if a user is approved for the booking. You can see in my example that this is not the case.

    Hello,

    Technically a booking that is cancelled is still counted as a booking that will be recorded. It’s just that it will be “cancelled” status. If you want to not show them on the list. before showing the data. The quickest option is to manually delete his Cancelled booking. Another option is You could add an if/else statement to check if the booking status is cancelled or not.

    Here’s a small screenshot of the booking status label. https://monosnap.com/file/x5XicaeqMkPJhHUDDaumqpMQrQPtMo

    On your list of cancelled bookings. You could try and call all the bookings that are approved and save them into an array. then for each entry of the loop on your cancelled bookings, You could check if that email or user is in the array of the approved bookings.

    Thread Starter Dirk

    (@dirkhag)

    Thank you for your help! I fear my coding skills are not enough for this. But I’ll try and report back if I succeed. ??

    Thread Starter Dirk

    (@dirkhag)

    Ok, I got it working now:

    First I store all approved bookings in an array $peoples…

    if( count($EM_Bookings->bookings) > 0 ){
    foreach( $EM_Bookings as $EM_Booking){ /* @var $EM_Booking EM_Booking */
    		if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){
    			$i++;
    			$peoples[$i] = $EM_Booking->get_person()->ID;
    		}}}

    Then I get the list of cancelled bookings…

    if($EM_Booking->booking_status == 3 && !in_array($EM_Booking->get_person()->ID, $people) ){

    Finally I check if no approvals are within the list of cancelled bookings….

    if (!in_array($EM_Booking->get_person()->ID,$peoples))

    PERFECT! THANK YOU!

    • This reply was modified 4 years, 11 months ago by Dirk.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘List of cancelled bookings’ is closed to new replies.