You are not logged in. Please note that you need to log in before posting.
I *think* this is related to having no schedule which covers the time period where a user is trying to schedule an appointment, but I'm not positive that's true and I'm not sure that's the only way to make it happen. The MySQL error message is at the bottom of my post.
I've emailed Algis a code patch that appears to fix the problem, but haven't heard back from him yet. Below is what I saw in case anyone else is experiencing something similar. One fix was to extend a schedule which was expiring within the 24-hour window where I don't allow users to make appointments (the workaround). The other fix was to replace one variable name in core/panels/customer/appointments/request/select_date/action.php with another variable (the REAL fix, assuming Algis says I did the right thing).
Please review ALL the code to make sure the change described below was the
right fix and that it's not needed elsewhere. I checked the forum, and
since it's still read-only I thought I should send this to you before I
forgot what I did!
I reverted to several old releases, and I tried 4.2.5, and the results
were the same in each case.
If no schedules cover a time when a user tries to make an appointment, the
system crases with "MySQL error - 1054". After quite some time debugging,
I figured out and solved the problem, as described below. I'm NOT sure
this is the only place this problem occurs. It's a bad idea to use the same
variable name as a scalar and a vector, because inevitably the wrong form
is dereferenced. That's what I think happened.
In file core/panels/customer/appointments/request/select_date/action.php
there are two calls to getSelectableTimes(), which do not have consistent
calling syntax. I added 'echo' statements for debugging:Code:
$thisProId = $providerId ? $providerId[0] : 0; $thisLocId = $locationId ? $locationId[0] : 0; echo "before getSelectableTimes, thisProId=$thisProId<br>\n"; $times = $tm->getSelectableTimes( $sessionId, $startCheck, $endCheck, $thisProId, $thisLocId ); ... echo "before getSelectableTimes, providerId=$providerId<br>\n"; $times = $tm->getSelectableTimes( $sessionId, $startCheck, $endCheck, $providerId, $locationId );That second one is the problem, because providerId is an array here, so the
echo statement says providerId=Array. Changing providerId to thisProId seems
to solve the problem. Same for locationId. It needs to be thisLocId or SOMETIMES
there will be a crash. Haven't quite figured out when.
In file core/helpers/timeManager.php, I inserted an 'echo' statement into
function getSelectableTimes(), before this lineCode:
echo "before getBlocks: provider=$providerId.<br>\n"; $blocks = $this->getBlocks( $tsStart, $tsEnd, $serviceId, $providerId );and had a user try to select a service and a location.
This is what happened:
(two passes, one working and one failing, apparently from the two calls shown above)Code:
before getBlocks: provider=2. before getBlocks: provider=Array. MySQL error - 1054: Unknown column 'Array' in 'where clause'. The query was: SELECT ha40_timeblocks.id AS id, starts_at, ends_at, selectable_every, schedule_id, valid_to, valid_from, applied_on, provider_id, ( SELECT GROUP_CONCAT( DISTINCT meta_value SEPARATOR '-' ) FROM ha40_objectmeta WHERE ha40_objectmeta.meta_name = "_location" AND ha40_objectmeta.obj_id = ha40_timeblocks.id ) AS locations FROM ha40_timeblocks INNER JOIN ha40_schedules ON ha40_timeblocks.schedule_id = ha40_schedules.id INNER JOIN ha40_objectmeta ON ha40_timeblocks.id = ha40_objectmeta.obj_id WHERE ha40_schedules.provider_id = Array AND ha40_objectmeta.obj_class = "timeblock" AND ha40_objectmeta.meta_name = "_service" AND ha40_objectmeta.meta_value = 2 AND ha40_schedules.valid_to >= 20100701 AND ha40_schedules.valid_from <= 20100831
Offline