LP1773452: Repeating copy alerts
[working/Evergreen.git] / Open-ILS / src / sql / Pg / t / regress / lp1773452_copy_state_post_checkin.pg
1 BEGIN;
2
3 SELECT plan(2);
4
5 INSERT INTO asset.copy (id,circ_lib,creator,loan_duration,fine_level,call_number,editor,barcode,dummy_title,dummy_author)
6   VALUES (8765309,1,1,2,2,-1,1,'8765309','Spooky Dance','Steve Bachman');
7
8 INSERT INTO action.circulation (id,usr,target_copy,circ_lib,circ_staff,renewal_remaining,
9     duration_rule,recurring_fine_rule,max_fine_rule,stop_fines,grace_period)
10   VALUES (8765309,1,8765309,1,1,0,
11     1,1,1,'LONGOVERDUE','0 hours');
12
13 SELECT is(asset.copy_state(8765309),'LONGOVERDUE', 'Copy state is LONGOVERDUE when stop_fines='LONGOVERDUE' and checkin_time is null');
14
15 -- Our long overdue item has returned!
16 UPDATE action.circulation SET checkin_time=now() WHERE id=8765309;
17
18 SELECT is(asset.copy_state(8765309),'NORMAL', 'Copy state is NORMAL when stop_fines='LONGOVERDUE' and checkin_time is not null');
19
20 ROLLBACK;