-- user id: 4, name: Gregory Jones
+-- clear bills and payments for our test circs
+DELETE FROM money.billing WHERE xact <= 9;
+DELETE FROM money.payment WHERE xact <= 9;
+
+-- clear any non-stock settings
+-- XXX This will need adjusting if new stock settings are added, so
+-- TODO: Pad out org_unit_settings with a SETVAL like we do for other
+-- settings
+DELETE FROM actor.org_unit_setting WHERE id >= 14;
+
+-- clear out the test workstation (just in case)
+DELETE FROM actor.workstation WHERE name = 'BR1-test-09-lp1198465_neg_balances.t';
+
-- Setup all LOST circs
UPDATE action.circulation SET
xact_start = '2014-05-14 08:39:13.070326-04',
stop_fines_time = '2014-05-28 08:39:13.070326-04',
create_time = '2014-05-14 08:39:13.070326-04',
max_fine = '3.00',
- stop_fines = 'LOST'
+ stop_fines = 'LOST',
+ checkin_staff = NULL,
+ checkin_lib = NULL,
+ checkin_time = NULL,
+ checkin_scan_time = NULL
WHERE id >= 1 AND id <= 6;
UPDATE asset.copy SET status = 3 WHERE id >= 2 AND id <= 7;
due_date = NOW() + '1 day'::interval,
stop_fines_time = NOW() - '3 hours'::interval,
max_fine = '3.00',
- stop_fines = 'LOST'
+ stop_fines = 'LOST',
+ checkin_staff = NULL,
+ checkin_lib = NULL,
+ checkin_time = NULL,
+ checkin_scan_time = NULL
WHERE id IN (8, 9);
UPDATE asset.copy SET status = 3 WHERE id IN (9, 10);
(DEFAULT, 8, NOW() - '30 minutes'::interval, false, 50.00, 'LOST payment'),
(DEFAULT, 9, NOW() - '2 hours'::interval, false, 50.00, 'LOST payment');
+-- if rerunning, make sure our mangled bills have the right total in the summary
+UPDATE money.materialized_billable_xact_summary SET balance_owed = 50.00
+ WHERE id >=1 AND id <= 6;
+UPDATE money.materialized_billable_xact_summary SET balance_owed = 0.70
+ WHERE id = 7;
+UPDATE money.materialized_billable_xact_summary SET balance_owed = 0.00
+ WHERE id IN (8, 9);
COMMIT;