Booking - limiting by item attributes does not limit available resources
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Confirmed
|
Medium
|
Unassigned |
Bug Description
When creating a new reservation either from patron record or from booking menu
limiting by item attributes does not limit available resources if you choose an attribute, it does not limit the resources available based on the chosen attribute -> Click on reserve any results in error message
I have created a resource type called "Tablet", and a resource attribute called "Platform" : and some attribute values such as Android and IOS. I added two new resources and then mapped the resources to their individual attributes and values.
tablet1 = Android
tablet2 = IOS
When I go to create a reservation, I can choose Tablet and see the two resources in the left hand box. I see Platform in the ‘With these attributes’drop down menu.
However, when I choose a specific attribute value, nothing happens.
Eg. If I choose Platform "Android", I would expect tablet2 to disappear from the list leaving only tablet1. The only time items disappear from the box is if I choose a time that I’ve already booked them for.
If I choose an attribute, select an item that has that attribute and choose ‘Reserve Selected’, the reservation is made.
But if I choose the wrong attribute (ie. Android for tablet2), select one that doesn’t have that attribute and choose ‘Reserve Selected’, the reservation is also made, but on the wrong type tablet.
If I choose any attribute and choose ‘Reserve Any’, I get the message below and the reservation appears in the list as “None targeted”.
tags: | added: cstore |
Changed in evergreen: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Hi! The problem is here:
https:/ /github. com/evergreen- library- system/ Evergreen/ blob/21ca1e6/ Open-ILS/ src/perlmods/ lib/OpenILS/ Application/ Booking. pm#L351
AND:
https:/ /github. com/evergreen- library- system/ Evergreen/ blob/21ca1e6/ Open-ILS/ src/perlmods/ lib/OpenILS/ Application/ Booking. pm#L552
Specifically the bits like this doing some fancy dollar quoting:
value => '$_' . $$ . '${' .
};
$$ outputs the Perl PID. This takes the attribute values and wraps them in $_PID${ ARRAY }$_PID$. So for example $_29814$ {1,3}$_ 29814$
It looks like the intent was to use dollar quoting for escaping things, however the resulting query will be additionally quoted with single quotes like: '$_29814$ {1,3}$_ 29814$' and PostgreSQL doesn't like this.
I'm not certain of the intent of this quoting, I suspect either this has never worked, or the quoting for cstore used to be different or PostgreSQL used to allow dollar quotes inside single quotes.