]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/t/lp1775216-inconsistent-available-counts.pg
LP1615805 No inputs after submit in patron search (AngularJS)
[Evergreen.git] / Open-ILS / src / sql / Pg / t / lp1775216-inconsistent-available-counts.pg
1 BEGIN;
2
3 select plan(2);
4
5 --consider all statuses to be "available" and "opac visible"
6 update config.copy_status set opac_visible = 't', is_available = 't';
7
8 -- consider all copies / locations to be opac visible 
9 -- (since we're comparing staff copy counts with opac counts)
10 update asset.copy_location set opac_visible = 't';
11 update asset.copy set opac_visible = 't';
12
13 -- the lp bug started because of a hardcoded status list.
14 -- make sure we have at least some items with other statuses.
15 select isnt_empty(
16     'select id from asset.copy where status not in (0,7,12) and not deleted',
17     'cannot test: no suitable copies for comparison'
18 );
19
20 select is_empty(
21     '
22     with min_ou as (select min(id) as id from actor.org_unit)
23     select distinct(record)
24     from min_ou,
25         asset.copy cpy join asset.call_number cn on cpy.call_number = cn.id
26     where not cpy.deleted and cpy.status not in (0,7,12)
27         and (select available from asset.staff_ou_record_copy_count(min_ou.id, cn.record))
28             !=
29             (select available from asset.opac_ou_record_copy_count(min_ou.id, cn.record))
30     ','inconsistent available copy counts between staff client and opac'
31 );
32
33 SELECT * FROM finish();
34 ROLLBACK;
35