Hello!

I have been getting the following error when I try to view my MERCI Calendar View: "An illegal choice has been detected. Please contact the site administrator" and it is comes from form.inc when it tries to validate the choice.

I am using MERCI 6.x-2.0+2-dev and my calendar has an exposed filter for reserved item_nid. On my site, I link to various filtered views of the calendar by passing this parameter in the url '?item_nid='. My site also has the MERCI Permissions and MERCI UI modules enabled. All of the items that can be reserved using MERCI are resources. Additionally I have all of my resources set to 'Auto Checkout' and 'Auto Check in.'

The error occurs when someone follows one of these links which contains the 'item_nid' parameter, and it only occurs on calendars that have reservations on them. Also the error usually occurs only for about 10 minutes after a reservation for that particular resource has ended, though it can last for up to 40 minutes. I have also discovered that when this error occurs the merci/includes/database.inc method 'merci_get_reservable_items' returns an empty array for the resource in question.

The code finds the correct item but then gets unset because of this code.

  if ($overdue) {
    $overdue_items_array = merci_overdue_items($content_type, $start, $reservation_nid);
    if (!empty($overdue_items_array)) {
      foreach ($options as $item_nid => $title) {
        if (array_key_exists($item_nid, $overdue_items_array)) {
          unset($options[$item_nid]);
        }
      }
    }
  }

The resources get marked as overdue because they aren't being marked as checked-in for usually around 10 minutes after the reservation occurs, which causes the resource to not be sent into the view and then the error occurs.

That's all I know about the issue. Please feel free to let me know if anything was unclear or if you require additional information.

Thank you in advance for your assistance.

Comments

wackywalter017 created an issue.

darrick’s picture

Can you post exports of the view or views you are using? Upload a tar if possible. I recently fixed a bug if v7 for the auto-checkin/checkout code. Possible the v6 code has the same issue. The auto-checkin code was entirely broken. I also recall a bug in v7 for the overdue validation too. So maybe I need to backport those fixes.

Try the patches below. Also, let me know your timezone.

Timezone patch: http://cgit.drupalcode.org/merci/commit/?id=9899f2c28998e39ddd49c43bd372...

Auto checkin fix: http://cgit.drupalcode.org/merci/commit/?id=29abb5701496cd17b09c7e4ff253...

Another timezone fix: http://cgit.drupalcode.org/merci/commit/?id=52d3dd5fe97c19888530fbae1efe...

wackywalter017’s picture

Thank you for your prompt response darrick!

My site timezone is America/Chicago.

Additionally the view I am using is the MERCI Calendar View. I'm still fairly new to drupal and php, so I am uncertain on how to export this view. If you could please let me know how to do this, I can try and get you the .tar.

wackywalter017’s picture

Hello! I apologize for the delay. I've tested the patches that darrick provided, and unfortunately the error is still occurring. However, with the patches applied the error now only occurs for users when they are logged in. The error message disappears once you log out, but then reappears when you log back in. Please let me know, if you have any additional suggestions on how to fix this error or if you require any additional information from me.

darrick’s picture

I'm most focused on the rewrite of MERCI and also upgrade to D8. Drupal 6 will reach EOL on 2/24/16. https://www.drupal.org/drupal-6-eol I would suggest you focus your efforts on upgrading to D7.

wackywalter017’s picture

I have managed to work around the error by disabling the overdue logic of MERCI, since I do not need this functionality for my site. That being said, I will look into upgrading to D7.

Thank you for all your help with this darrick, and good luck with the MERCI rewrite.