]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/1189.schema.auto_renewal_view_updates.sql
LP1615805 No inputs after submit in patron search (AngularJS)
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 1189.schema.auto_renewal_view_updates.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('1189', :eg_version);
4
5 CREATE OR REPLACE VIEW action.open_circulation AS
6         SELECT  *
7           FROM  action.circulation
8           WHERE checkin_time IS NULL
9           ORDER BY due_date;
10
11 CREATE OR REPLACE VIEW action.billable_circulations AS
12         SELECT  *
13           FROM  action.circulation
14           WHERE xact_finish IS NULL;
15
16 CREATE OR REPLACE VIEW reporter.overdue_circs AS
17 SELECT  *
18   FROM  "action".circulation
19   WHERE checkin_time is null
20         AND (stop_fines NOT IN ('LOST','CLAIMSRETURNED') OR stop_fines IS NULL)
21         AND due_date < now();
22
23 CREATE OR REPLACE VIEW reporter.circ_type AS
24 SELECT  id,
25         CASE WHEN opac_renewal OR phone_renewal OR desk_renewal OR auto_renewal
26                 THEN 'RENEWAL'
27                 ELSE 'CHECKOUT'
28         END AS "type"
29   FROM  action.circulation;
30
31 COMMIT;