3 CREATE OR REPLACE VIEW reporter.classic_current_circ AS
4 SELECT cl.shortname AS circ_lib,
6 circ.xact_start AS xact_start,
7 circ_type.type AS circ_type,
10 ol.shortname AS owning_lib_name,
12 lfm.value AS lit_form,
13 ifm.value AS item_form,
14 itm.value AS item_type,
15 sl.name AS shelving_location,
17 g.name AS profile_group,
18 dem.general_division AS demographic_general_division,
21 cn.label AS call_number_label,
22 call_number_dewey(cn.label) AS dewey,
24 WHEN call_number_dewey(cn.label) ~ E'^[0-9.]+$'
28 10 * floor((call_number_dewey(cn.label)::float) / 10), '000'
32 END AS dewey_block_tens,
34 WHEN call_number_dewey(cn.label) ~ E'^[0-9.]+$'
38 100 * floor((call_number_dewey(cn.label)::float) / 100), '000'
42 END AS dewey_block_hundreds,
44 WHEN call_number_dewey(cn.label) ~ E'^[0-9.]+$'
48 10 * floor((call_number_dewey(cn.label)::float) / 10), '000'
54 10 * floor((call_number_dewey(cn.label)::float) / 10) + 9, '000'
58 END AS dewey_range_tens,
60 WHEN call_number_dewey(cn.label) ~ E'^[0-9.]+$'
64 100 * floor((call_number_dewey(cn.label)::float) / 100), '000'
70 100 * floor((call_number_dewey(cn.label)::float) / 100) + 99, '000'
74 END AS dewey_range_hundreds,
75 hl.id AS patron_home_lib,
76 hl.shortname AS patron_home_lib_shortname,
77 paddr.county AS patron_county,
78 paddr.city AS patron_city,
79 paddr.post_code AS patron_zip,
80 sc1.stat_cat_entry AS stat_cat_1,
81 sc2.stat_cat_entry AS stat_cat_2
82 FROM action.circulation circ
83 JOIN reporter.circ_type circ_type ON (circ.id = circ_type.id)
84 JOIN asset.copy cp ON (cp.id = circ.target_copy)
85 JOIN asset.copy_location sl ON (cp.location = sl.id)
86 JOIN asset.call_number cn ON (cp.call_number = cn.id)
87 JOIN actor.org_unit ol ON (cn.owning_lib = ol.id)
88 JOIN metabib.rec_descriptor rd ON (rd.record = cn.record)
89 JOIN actor.org_unit cl ON (circ.circ_lib = cl.id)
90 JOIN actor.usr p ON (p.id = circ.usr)
91 JOIN actor.org_unit hl ON (p.home_ou = hl.id)
92 JOIN permission.grp_tree g ON (p.profile = g.id)
93 JOIN reporter.demographic dem ON (dem.id = p.id)
94 JOIN actor.usr_address paddr ON (paddr.id = p.billing_address)
95 LEFT JOIN config.language_map lm ON (rd.item_lang = lm.code)
96 LEFT JOIN config.lit_form_map lfm ON (rd.lit_form = lfm.code)
97 LEFT JOIN config.item_form_map ifm ON (rd.item_form = ifm.code)
98 LEFT JOIN config.item_type_map itm ON (rd.item_type = itm.code)
99 LEFT JOIN asset.stat_cat_entry_copy_map sc1 ON (sc1.owning_copy = cp.id AND sc1.stat_cat = 1)
100 LEFT JOIN asset.stat_cat_entry_copy_map sc2 ON (sc2.owning_copy = cp.id AND sc2.stat_cat = 2);
102 CREATE OR REPLACE VIEW reporter.legacy_cat1 AS
106 FROM asset.stat_cat_entry
109 CREATE OR REPLACE VIEW reporter.legacy_cat2 AS
113 FROM asset.stat_cat_entry