Posted by rex_the_first on November 4, 2009 at 4:33pm
| Project: | Resource Conflict |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
On the edit content type the
Fields to check for conflicts
tick box keeps becoming unticked. I am not sure how to log/track this but it is ticked then a month later when I go back to it after complaints of double bookings it has become unticked. Could you advice?
Comments
#1
Also the message that resource conflict has been switched off does not appear in the system log
I get this php error in the system log:
strtr() [function.strtr]: The second argument is not an array in /home/greenaction/thepeanutgallery.org.uk/modules/syslog/syslog.module on line 106.
(line 106 in syslog is
<?php$message .= '|'. strip_tags(is_null($entry['variables']) ? $entry['message'] : strtr($entry['message'], $entry['variables']));
?>
)
at the same time I get Resource Conflict tries to send this:
Resource Conflict has been disabled for the event content type as the requirements for it are no longer met.
I am not sure but it looks like the watchdog message is not in the correct format but I cannot see any problem.
(from resource_conflict.module)
<?php$msg = t('Resource Conflict has been disabled for the %type content type as the requirements for it are no longer met.', array('%type' => $type));
watchdog('rsrc conflict', $msg, WATCHDOG_WARNING);
?>
See http://drupal.org/node/349259 for something that *might* be related.
#2
More info on Resource Conflict becoming un-ticked.
This happens when Captcha module stops some spam.
event_node_form post blocked by CAPTCHA module: challenge "Random CAPTCHA type" (by module "random_captcha_type"), user answered "reCAPTCHA", but the solution was "1".
Could this trigger Resource Conflict to switch off?
I am going to disable function _resource_conflict_disable for now
#3
Commenting out the function _resource_conflict_disable has stopped the problem. I will have a look at fixing this but I don't know much php.
#4
Well, there's a bug in that Watchdog call; the message doesn't need to be piped through t() as watchdog does that for you. That's likely the cause of your error from the syslog module. However, I think it's likely unrelated to the issue of it becoming disabled. I'll try and install recaptcha this weekend to take a look.
#5
Here's a patch with the Watchdog call fixed. I've installed recaptcha, and with this patch everything seems fine. Can you give it a test and let me know if it works for your install as well?
Thanks!
#6
Cheers for that. I have been internet-less for a bit but I will have a look and get back to you soon about watchdog (and maybe even about recaptcha).
#7
Let me know if this should be in a separate issue or not. Seems like what started here, but the watchdog entry went off course a little (though it seems important also).
I've also noticed the checkbox 'Enable resource conflict checking for this content type' on my reservation type's edit form gets unchecked periodically for no apparent reason. I've been checking it daily for it to happen again so I could check the logs. While doing a screencast today on how to use our corporate reservations system, I discovered not only was it unchecked again, but I was the user ID referenced by the watchdog message:
type: rsrc conflict
message: Resource Conflict has been disabled for the reservation content type as the requirements for it are no longer met.
location & referrer: http://ourfabuloussite.com/node/add/reservation
variable: i:4;
That variable value is for a 'comment_default_mode_page', not sure if that is a good clue.
I re-checked the box and hammered on the reservation system trying to get it unchecked. Finally discovered that if I cause an error in the reservation form the box gets unchecked. Not just any error (leaving a required text field blank does not trip it up), but when I cause an date/time error (which makes sense since that's what this module works with).
In this content type, From and To dates and times are all four required fields. If I try to save or preview without values in all four of those, it trips the normal error like expected but also unchecks the 'Enable resource conflict checking for this content type' box.
This only happens if one of the fields has no value. I tried to set the To date earlier than the From date, which triggers the obvious warning that the To date must be after the From date, but the box does not get unchecked in that circumstance. It's like if there's no value when you save/preview the module assumes the type does not have all requisite fields and disables itself. It should instead either check if the requisite fields exist and are just empty.
Hope this helps track down the error. If no response by Monday AM I'll dive into your module to try finding where this is breaking.
#8
I just commented out line 36 '// _resource_conflict_disable($type); and it won't unset itself now.
I see how your logic is checking if the field forms are empty, but in the else statement you should really check if the field is required ( '#required' => TRUE, ).
If it's empty but required, this module shouldn't go disabling itself. If it's empty and not required, it should disable itself and present a suggestion to user to make the fields required.
Hope to see this fix soon, this is a great module invaluable for resource reservations.
#9
Thanks for the detailed info. The watchdog issue above was *also* causing the box to become unchecked, so I've opened a new issue at #700864: Resource conflict disables itself if a date field is empty and not required for this specific problem.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.