neokoenig / RoomBooking

This is an open source application for booking rooms via a web based calendar, using cfWheels, Bootstrap3, jQuery, FullCalendar.js, and other bits. AKA the OxAlto RoomBooking System
http://roombooking.readme.io
187 stars 73 forks source link

Error when clicking Day in Events drop down #29

Closed kcits closed 9 years ago

kcits commented 9 years ago

I am getting: Error! Sorry, that caused an unexpected error. Please try again later.

When clicking Day in the Events drop down. Links to [domain]/index.cfm/bookings/day

neokoenig commented 9 years ago

What does the error email say?

If you ever see that, it should send you an email with the precise error (set it in config/production/settings.cfm)

Alternatively, reload app in design mode (?reload=design&password=yourreloadpassword) to get the actual error on screen.

T

kcits commented 9 years ago

Error Executing Database Query.

Query Of Queries syntax error. Encountered "end. Incorrect conditional expression, Expected one of [like|null|between|in|comparison] condition,

neokoenig commented 9 years ago

Ah, I think I might know what that could be: "end" might be a reserved word in some versions of CF/some DBMS: can you confirm what version of CF you're running and which DB?

eventsQ.addParam(name='start', value=t.timeslot, cfsqltype='cf_sql_timestamp');
eventsQ.addParam(name='end', value=t.timeslot, cfsqltype='cf_sql_timestamp');
eventsQ.setSQL('SELECT * FROM rs WHERE locationid =:locationid AND start <= :start AND end > :end AND allday = 0'); 
kcits commented 9 years ago

CF 10 and MySQL 5.6

neokoenig commented 9 years ago

That’s odd; I’ve got it running fine on CF10 /MySQL... The lines above are the only lines doing a QoQ in that section, so I’m 90% sure it’s that…

Can you try replacing lines 77 - 79 in controllers/Bookings.cfc to:

eventsQ.addParam(name='thestart', value=t.timeslot, cfsqltype='cf_sql_timestamp');
eventsQ.addParam(name='theend', value=t.timeslot, cfsqltype='cf_sql_timestamp');
eventsQ.setSQL('SELECT * FROM rs WHERE locationid =:locationid AND start <= :thestart AND end > :theend AND allday = 0');
kcits commented 9 years ago

I expanded the debugging:

Query Of Queries syntax error. Encountered "end. Incorrect conditional expression, Expected one of [like|null|between|in|comparison] condition,

The error occurred in C:/ColdFusion10/cfusion/CustomTags/com/adobe/coldfusion/base.cfc: line 445 Called from C:/ColdFusion10/cfusion/CustomTags/com/adobe/coldfusion/query.cfc: line 641 Called from C:/inetpub/wwwroot/roombooking.stick/controllers/Bookings.cfc: line 80 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/global/cfml.cfm: line 164 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/controller/processing.cfm: line 107 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/controller/processing.cfm: line 76 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/dispatch/request.cfm: line 174 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/index.cfm: line 1 Called from C:/inetpub/wwwroot/roombooking.stick/index.cfm: line 1 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/events/onrequest.cfm: line 1 Called from C:/ColdFusion10/cfusion/CustomTags/com/adobe/coldfusion/base.cfc: line 445 Called from C:/ColdFusion10/cfusion/CustomTags/com/adobe/coldfusion/query.cfc: line 641 Called from C:/inetpub/wwwroot/roombooking.stick/controllers/Bookings.cfc: line 80 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/global/cfml.cfm: line 164 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/controller/processing.cfm: line 107 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/controller/processing.cfm: line 76 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/dispatch/request.cfm: line 174 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/index.cfm: line 1 Called from C:/inetpub/wwwroot/roombooking.stick/index.cfm: line 1 Called from C:/inetpub/wwwroot/roombooking.stick/wheels/events/onrequest.cfm: line 1

443 : #getPreserveSingleQuotes(sqlArray[1])# 444 : <cfif sqlType neq "" and arraylen(sqlParams) gt 0> 445 : 446 : <cfif (i-1) lte arraylen(sqlParams)> 447 :

SQL SELECT * FROM rs WHERE locationid = (param 1) AND start <= (param 2) AND end > (param 3) AND allday = 0

kcits commented 9 years ago

443 : #getPreserveSingleQuotes(sqlArray[1])# 444 : < cfif sqlType neq "" and arraylen(sqlParams) gt 0> 445 : < cfloop index="i" from="2" to="#ArrayLen(sqlArray)#"> 446 : < cfif (i-1) lte arraylen(sqlParams)> 447 : < cfqueryparam attributeCollection="#sqlParams[i-1]#"/>

neokoenig commented 9 years ago

My mistake - it's actually very simple - I forgot I fixed this in another branch. Line 79 "end" needs square brackets..