I have a room, with prices, availability and bookings.
I have a node with an availability calendar ( https://www.drupal.org/node/1782238 )
When logged in as admin, this works. When logged out this does not.
--- Logged IN:
http://panopoly.local/content/test-unit-2?q=rooms/units/unit/1/availabil...
[{"id":"1","start":"2014-09-01T13:00:00Z","end":"2014-09-30T13:00:00Z","title":"AV","color":"#8CBF62","borderColor":"#04711B"}]
NOTE: VALID json
--- Logged OUT:
http://panopoly.local/content/test-unit-2?q=rooms/units/unit/1/availabil...
[][{"id":"1","start":"2014-09-02T13:00:00Z","end":"2014-09-30T13:00:00Z","title":"AV","color":"#8CBF62","borderColor":"#04711B"}]
Note: INVALID json, the first two characters: [] are a problem.
This seems to be a problem AFTER the function:
sites/all/modules/rooms_availability/rooms_availability.moule
-> rooms_availability_event(....)
is called...
But regardless, when the invalid json is passed to fullcalendar.js (line 995) with the ajax.complete() is run, it simply returns a parse error.
Expected behaviour:
- When logged in as admin, can see the calendar as normal
- When logged out, or logged in as user can see own bookings, can see other peoples bookings as 'booked' with no details
Comments
Comment #1
ITWest-jg CreditAttribution: ITWest-jg commentedComment #2
ITWest-jg CreditAttribution: ITWest-jg commentedOK, I'm sorry but I'm going to log my trail of discovery here.
It seems that
rooms_availability.module
:the commented line is the problem.
So '[]' is echo'd, then later the correct array is also echo'd. There are a few problems here.
IMHO: rooms_availability_get_style should not have side effects (the echo)
Comment #3
mbchler@drupal.org CreditAttribution: mbchler@drupal.org commentedI reported the same issue recently, it is solved on master branch, please see https://www.drupal.org/node/2322951
Comment #4
acrollet CreditAttribution: acrollet commentedClosing as duplicate of #2322951: rooms_availability_get_style echoes an empty array 'if user doesn't have 'view anonymous availability information' permission.'