Show
Ignore:
Timestamp:
03/07/08 13:10:23 (7 months ago)
Author:
miker
Message:

adding circ_item_list example reporter view; installing staged-search stuff

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Open-ILS/src/sql/Pg/example.reporter-extension.sql

    r7452 r8904  
    155155        JOIN actor.usr_address paddr ON (paddr.id = u.billing_address); 
    156156 
     157CREATE OR REPLACE VIEW reporter.classic_item_list AS 
     158SELECT  t.value as title, 
     159    a.value as author, 
     160    p.value as pubdate, 
     161    cp.id, 
     162    cp.price, 
     163    cp.barcode, 
     164    cn.label as call_number_label, 
     165    CASE 
     166        WHEN call_number_dewey(cn.label) ~  E'^[0-9.]+$' 
     167            THEN 
     168                btrim( 
     169                    to_char( 
     170                        10 * floor((call_number_dewey(cn.label)::float) / 10), '000' 
     171                    ) 
     172                ) 
     173        ELSE NULL 
     174    END AS dewey_block_tens, 
     175    CASE 
     176        WHEN call_number_dewey(cn.label) ~  E'^[0-9.]+$' 
     177            THEN 
     178                btrim( 
     179                    to_char( 
     180                        100 * floor((call_number_dewey(cn.label)::float) / 100), '000' 
     181                    ) 
     182                ) 
     183        ELSE NULL 
     184    END AS dewey_block_hundreds, 
     185    (SELECT COUNT(*) FROM action.circulation WHERE target_copy = cp.id) as use_count, 
     186    cp.circ_modifier, 
     187    sl.name AS shelving_location, 
     188    sc1.stat_cat_entry AS stat_cat_1, 
     189    sc2.stat_cat_entry AS stat_cat_2, 
     190    sce1.value AS stat_cat_1_value, 
     191    sce2.value AS stat_cat_2_value, 
     192    cp.edit_date, 
     193    cp.create_date, 
     194    ol.shortname AS owning_lib_name, 
     195    cn.owning_lib, 
     196    cl.shortname AS circ_lib_name, 
     197    cl.id AS circ_lib, 
     198    cp.creator, 
     199    cp.age_protect, 
     200    cp.opac_visible, 
     201    cp.ref, 
     202    cp.deposit_amount, 
     203    cp.deleted, 
     204    b.tcn_value, 
     205    cp.status, 
     206    circ.stop_fines, 
     207    circ.due_date, 
     208    circ_card.barcode as patron_barcode, 
     209    circ_u.first_given_name || ' ' || circ_u.family_name as patron_name 
     210  FROM  asset.copy cp 
     211    JOIN asset.copy_location sl ON (cp.location = sl.id) 
     212    JOIN asset.call_number cn ON (cp.call_number = cn.id) 
     213    JOIN biblio.record_entry b ON (cn.record = b.id) 
     214    JOIN actor.org_unit ol ON (cn.owning_lib = ol.id) 
     215    JOIN actor.org_unit cl ON (cp.circ_lib = cl.id) 
     216    LEFT JOIN metabib.full_rec t ON (cn.record = t.record AND t.tag = '245' and t.subfield = 'a') 
     217    LEFT JOIN metabib.full_rec a ON (cn.record = a.record AND a.tag = '100' and a.subfield = 'a') 
     218    LEFT JOIN metabib.full_rec p ON (cn.record = p.record AND p.tag = '260' and p.subfield = 'c') 
     219    LEFT JOIN action.circulation circ ON (circ.target_copy = cp .id AND circ.checkin_time IS NULL) 
     220    LEFT JOIN actor.usr circ_u ON (circ_u.id = circ.usr) 
     221    LEFT JOIN actor.card circ_card ON (circ_u.id = circ_card.usr) 
     222    LEFT JOIN asset.stat_cat_entry_copy_map sc1 ON (sc1.owning_copy = cp.id AND sc1.stat_cat = 1) 
     223    LEFT JOIN asset.stat_cat_entry sce1 ON (sce1.id = sc1.stat_cat_entry) 
     224    LEFT JOIN asset.stat_cat_entry_copy_map sc2 ON (sc2.owning_copy = cp.id AND sc2.stat_cat = 2) 
     225    LEFT JOIN asset.stat_cat_entry sce2 ON (sce2.id = sc2.stat_cat_entry); 
    157226 
    158227COMMIT;