Booking - limiting by item attributes does not limit available resources

Bug #1807784 reported by Christine Burns
6
This bug affects 1 person
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: booking cstore
Revision history for this message
Christine Burns (christine-burns) wrote :
tags: added: booking
Revision history for this message
James Fournie (jfournie) wrote :

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:

        $query->{having}->{'+bram'}->{value}->{'@>'} = {
            transform => 'array_accum',
            value => '$_' . $$ . '${' .
                join(',', @{$filters->{attribute_values}}) .
                '}$_' . $$ . '$'
        };

$$ 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.

James Fournie (jfournie)
tags: added: cstore
Revision history for this message
James Fournie (jfournie) wrote :

I'm not sure this is a duplicate -- if the bookings refresh is largely keeping the backend OpenSRF Perl code unchanged, (which the bug only references updating Angular interfaces) you'll likely still hit this problem. Feel free to re-mark as duplicate of 1816475 and comment with rationale :)

Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.