[Evergreen-dev] Placing a part holds in the mobile app: when is a part required?

Ken Cox kenstir at gmail.com
Fri Aug 21 20:51:47 EDT 2020


I am working on part holds in the mobile apps, and I don't know how to
tell when a part selection is mandatory and when it is optional.

The solution was explained to me roughly this way:

    * when no_items_have_part -> no part selector appears; place title hold
    * when all_items_have_part -> patron must select a part; place part hold
    * when some_items_have_part -> patron may optionally select a
part; "- all parts -" places a title hold

I know how to tell if *any* items have parts
(open-ils.search.biblio.record_hold_parts), but not if some or all
items have parts.

I think I see what the OPAC is doing, but I don't know if I can
replicate it from the mobile app via the OpenSRF gateway.

I asked in IRC, and got the suggestion to call
open-ils.circ.title_hold.is_possible.  I don't think that will work
well; one of the parameters it inspects is 'pickup_lib', and I need to
decide whether the "- all parts -" option appears in the drop-down
before a pickup_lib is selected.


WHAT THE OPAC DOES

EGCatLoader::Account::load_place_hold sets a variable 'part_required'
with a json_query (below), and place_hold.tt2 uses it to add an '- All
Parts -' option.

                # T holds on records that have parts are OK, but if
the record has
                # no non-part copies, the hold will ultimately fail.  When that
                # happens, require the user to select a part.
                my $part_required = 0;
                if (@$parts) {
                    my $np_copies = $e->json_query({
                        select => { acp => [{column => 'id', transform
=> 'count', alias => 'count'}]},
                        from => {acp => {acn => {}, acpm => {type => 'left'}}},
                        where => {
                            '+acp' => {deleted => 'f'},
                            '+acn' => {deleted => 'f', record => $rec->id},
                            '+acpm' => {id => undef}
                        }
                    });
                    $part_required = 1 if $np_copies->[0]->{count} == 0;
                }

My understanding is such queries are not exposed over the gateway.

I would appreciate suggestions!
-- 
-Ken


More information about the Evergreen-dev mailing list