3 INSERT INTO config.upgrade_log (version) VALUES ('0047');
5 CREATE OR REPLACE FUNCTION action.circulation_claims_returned () RETURNS TRIGGER AS $$
7 IF OLD.stop_fines IS NULL OR OLD.stop_fines <> NEW.stop_fines THEN
8 IF NEW.stop_fines = 'CLAIMSRETURNED' THEN
9 UPDATE actor.usr SET claims_returned_count = claims_returned_count + 1 WHERE id = NEW.usr;
11 IF NEW.stop_fines = 'CLAIMSNEVERCHECKEDOUT' THEN
12 UPDATE actor.usr SET claims_never_checked_out_count = claims_never_checked_out_count + 1 WHERE id = NEW.usr;
14 IF NEW.stop_fines = 'LOST' THEN
15 UPDATE asset.copy SET status = 3 WHERE id = NEW.target_copy;
20 $$ LANGUAGE 'plpgsql';