Created
August 1, 2016 15:23
-
-
Save stompro/ec8d050686153c56f7428e36f5c8cdeb to your computer and use it in GitHub Desktop.
Set "Circ as Type" for copies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Report on which items don't have circ as type set. | |
select aou.shortname, au.usrname as editor,ac.circ_modifier, ac.barcode, ac.edit_date, ac.circ_lib | |
from asset.copy ac | |
join actor.usr au on au.id=ac.editor | |
join actor.org_unit aou on aou.id=ac.circ_lib | |
where ac.deleted=false | |
and ac.circ_as_type is null | |
-- and ac.status!=9 | |
and ac.circ_modifier is not null | |
order by aou.shortname, ac.edit_date; | |
-- Update copies that don't have it set. | |
begin; | |
-- Audiobook | |
update asset.copy | |
set circ_as_type='i' | |
where circ_modifier='Audiobook' | |
and circ_as_type is null; | |
-- Music | |
update asset.copy | |
set circ_as_type='j' | |
where circ_modifier='Music' | |
and circ_as_type is null; | |
-- DVD | |
-- Express DVD | |
update asset.copy | |
set circ_as_type='g' | |
where circ_modifier in ('DVD','Express DVD') | |
and circ_as_type is null; | |
-- Book | |
-- Express Book | |
-- Reference | |
-- Magazine | |
-- ILL | |
-- ILLspecial | |
update asset.copy | |
set circ_as_type='a' | |
where circ_modifier in ('Book','Express Book','Reference','Magazine','ILL','ILLspecial') | |
and circ_as_type is null; | |
-- KitA | |
-- KitB | |
-- KitC | |
update asset.copy | |
set circ_as_type='o' | |
where circ_modifier in ('KitA','KitB','KitC') | |
and circ_as_type is null; | |
rollback; -- switch to commit when ready. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment