my $evt;
my $obt;
- if($self->claims_never_checked_out) {
-
- # backdate to void any fines accrued on the circ
- $self->backdate($circ->xact_start);
-
- # update the patrons never-checked-out count
- $self->patron->claims_never_checked_out_count(
- $self->patron->claims_never_checked_out_count + 1);
- $self->editor->update_actor_user($self->patron) or
- $self->bail_on_events($self->editor->event);
- }
+ $self->backdate($circ->xact_start) if $self->claims_never_checked_out;
# backdate the circ if necessary
if($self->backdate) {
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0046'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0047'); -- berick
CREATE TABLE config.bib_source (
IF NEW.stop_fines = 'CLAIMSRETURNED' THEN
UPDATE actor.usr SET claims_returned_count = claims_returned_count + 1 WHERE id = NEW.usr;
END IF;
+ IF NEW.stop_fines = 'CLAIMSNEVERCHECKEDOUT' THEN
+ UPDATE actor.usr SET claims_never_checked_out_count = claims_never_checked_out_count + 1 WHERE id = NEW.usr;
+ END IF;
IF NEW.stop_fines = 'LOST' THEN
UPDATE asset.copy SET status = 3 WHERE id = NEW.target_copy;
END IF;
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0047');
+
+CREATE OR REPLACE FUNCTION action.circulation_claims_returned () RETURNS TRIGGER AS $$
+BEGIN
+ IF OLD.stop_fines IS NULL OR OLD.stop_fines <> NEW.stop_fines THEN
+ IF NEW.stop_fines = 'CLAIMSRETURNED' THEN
+ UPDATE actor.usr SET claims_returned_count = claims_returned_count + 1 WHERE id = NEW.usr;
+ END IF;
+ IF NEW.stop_fines = 'CLAIMSNEVERCHECKEDOUT' THEN
+ UPDATE actor.usr SET claims_never_checked_out_count = claims_never_checked_out_count + 1 WHERE id = NEW.usr;
+ END IF;
+ IF NEW.stop_fines = 'LOST' THEN
+ UPDATE asset.copy SET status = 3 WHERE id = NEW.target_copy;
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+
+COMMIT;
+