$logger->error( "Missing circ script(s)" )
unless( $p and $c and $d and $f and $m and $pr );
- $scripts{circ_permit_patron} = $p;
- $scripts{circ_permit_copy} = $c;
- $scripts{circ_duration} = $d;
- $scripts{circ_recurring_fines}= $f;
- $scripts{circ_max_fines} = $m;
- $scripts{circ_permit_renew} = $pr;
+ $scripts{circ_permit_patron} = $p;
+ $scripts{circ_permit_copy} = $c;
+ $scripts{circ_duration} = $d;
+ $scripts{circ_recurring_fines} = $f;
+ $scripts{circ_max_fines} = $m;
+ $scripts{circ_permit_renew} = $pr;
$logger->debug(
"circulator: Loaded rules scripts for circ: " .
);
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.checkin.override",
- signature => q/@see open-ils.circ.checkin/
+ method => "run_method",
+ api_name => "open-ils.circ.checkin.override",
+ signature => q/@see open-ils.circ.checkin/
);
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.renew.override",
- signature => q/@see open-ils.circ.renew/,
+ method => "run_method",
+ api_name => "open-ils.circ.renew.override",
+ signature => q/@see open-ils.circ.renew/,
);
NOTES
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.checkout.full");
+ method => "run_method",
+ api_name => "open-ils.circ.checkout.full"
+);
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.checkout.full.override");
-
+ method => "run_method",
+ api_name => "open-ils.circ.checkout.full.override"
+);
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.reservation.pickup");
+ method => "run_method",
+ api_name => "open-ils.circ.reservation.pickup"
+);
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.reservation.return");
-
+ method => "run_method",
+ api_name => "open-ils.circ.reservation.return"
+);
__PACKAGE__->register_method(
- method => "run_method",
- api_name => "open-ils.circ.checkout.inspect",
- desc => q/
- Returns the circ matrix test result and, on success, the rule set and matrix test object
- /
+ method => "run_method",
+ api_name => "open-ils.circ.checkout.inspect",
+ desc => q/Returns the circ matrix test result and, on success, the rule set and matrix test object/
);
-
sub run_method {
my( $self, $conn, $auth, $args ) = @_;
translate_legacy_args($args);
if ($transit) { # yes! unwrap it.
my $reservation = $circulator->editor->retrieve_booking_reservation( $transit->reservation );
- my $res_type = $circulator->editor->retrieve_booking_resource_type( $reservation->target_resource_type );
+ my $res_type = $circulator->editor->retrieve_booking_resource_type( $reservation->target_resource_type );
if ($U->is_true($res_type->catalog_item)) { # is there a copy to be had here?
if (my $copy = $circulator->editor->search_asset_copy({ barcode => $bc, deleted => 'f' })->[0]) { # got a copy
# Log the events
my @e = @{$circulator->events};
push( @ee, $_->{textcode} ) for @e;
- $logger->info("circulator: bailing out with events: @ee");
+ $logger->info("circulator: bailing out with events: " . (join ", ", @ee));
$circulator->editor->rollback;
opac_renewal
phone_renewal
desk_renewal
+ sip_renewal
retarget
matrix_test_result
circ_matrix_matchpoint
# if this is a renewal, default to desk_renewal
$self->desk_renewal(1) unless
- $self->opac_renewal or $self->phone_renewal;
+ $self->opac_renewal or $self->phone_renewal or $self->sip_renewal;
$self->capture('') unless $self->capture;
my $self = shift;
my $copy = $self->copy;
- my $islost = 0;
- my $ismissing = 0;
- my $evt = undef;
-
my $status = $U->copy_status($copy->status)->id;
return undef
my $self = shift;
return unless $self->circ;
$U->create_events_for_hook('checkout', $self->circ, $self->circ_lib) if $self->is_checkout;
- $U->create_events_for_hook('checkin', $self->circ, $self->circ_lib) if $self->is_checkin;
+ $U->create_events_for_hook('checkin', $self->circ, $self->circ_lib) if $self->is_checkin;
$U->create_events_for_hook('renewal', $self->circ, $self->circ_lib) if $self->is_renewal;
}
my $editor;
my $config;
-my $target_encoding;
+my $target_encoding; # FIXME: this is configured at the institution level.
use Digest::MD5 qw(md5_hex);
{
username => $username,
password => md5_hex($seed . md5_hex($password)),
- type => 'opac',
+ type => 'opac',
}
);
$xact->item($item);
if (!$patron) {
- $xact->screen_msg("Invalid Patron");
+ $xact->screen_msg("Invalid Patron Barcode '$patron_id'");
return $xact;
}
}
if( !$item ) {
- $xact->screen_msg("Invalid Item");
+ $xact->screen_msg("Invalid Item Barcode: '$item_id'");
return $xact;
}
$xact->desensitize(!$item->magnetic);
if( $xact->ok ) {
-
#editor()->commit;
syslog("LOG_DEBUG", "OILS: OpenILS::Checkout: " .
"patron %s checkout %s succeeded", $patron_id, $item_id);
-
} else {
-
#editor()->xact_rollback;
syslog("LOG_DEBUG", "OILS: OpenILS::Checkout: " .
"patron %s checkout %s FAILED, rolling back xact...", $patron_id, $item_id);
#editor()->xact_rollback;
syslog('LOG_WARNING', "OILS: Checkin failed");
}
- # END TRANSACTION
return $xact;
}
## We don't do anything with it.
sub end_patron_session {
my ($self, $patron_id) = @_;
- return (1, 'Thank you for using OpenILS!', '');
+ return (1, 'Thank you!', '');
}
return undef;
}
- $self->{user} = $user;
- $self->{id} = $patron_id;
- $self->{editor} = $e;
+ $self->{user} = $user;
+ $self->{id} = $patron_id;
+ $self->{editor} = $e;
syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s): found patron : barred=%s, card:active=%s",
$patron_id, $self->{user}->barred, $self->{user}->card->active );
# How much more detail do we need to check here?
sub charge_ok {
my $self = shift;
- my $u = $self->{user};
- return (($u->barred eq 'f') and ($u->card->active eq 't'));
+ my $u = $self->{user};
+ return (($u->barred eq 'f') and ($u->card->active eq 't'));
}
# How much more detail do we need to check here?
sub renew_ok {
my $self = shift;
- return $self->charge_ok;
+ return $self->charge_ok;
}
sub recall_ok {
sub hold_ok {
my $self = shift;
- return $self->charge_ok;
+ return $self->charge_ok;
}
# return true if the card provided is marked as lost
sub card_lost {
my $self = shift;
- return $self->{user}->card->active eq 'f';
+ return $self->{user}->card->active eq 'f';
}
sub recall_overdue {
sub block {
my ($self, $card_retained, $blocked_card_msg) = @_;
+ $blocked_card_msg ||= '';
my $e = $self->{editor};
my $u = $self->{user};
# retrieve the un-fleshed user object for update
$u = $e->retrieve_actor_user($u->id);
my $note = OpenILS::SIP::clean_text($u->alert_message) || "";
- $note = "CARD BLOCKED BY SELF-CHECK MACHINE\n$note"; # XXX Config option
-
+ $note = "<sip> CARD BLOCKED BY SELF-CHECK MACHINE. $blocked_card_msg</sip>\n$note"; # XXX Config option
+ $note =~ s/\s*$//; # kill trailng whitespace
$u->alert_message($note);
if( ! $e->update_actor_user($u) ) {
# Testing purposes only
sub enable {
- my $self = shift;
- # Un-mark card as inactive, grep out the patron alert
+ my ($self, $card_retained, $blocked_card_msg) = @_;
$self->{screen_msg} = "All privileges restored.";
+
+# Un-mark card as inactive, grep out the patron alert
+ my $u = $self->{user};
+ my $e = $self->{editor} = OpenILS::SIP->reset_editor();
+
+ syslog('LOG_INFO', "OILS: Unblocking user %s", $u->card->barcode );
+
+ return $self if $u->card->active eq 't';
+
+ $u->card->active('t');
+ if( ! $e->update_actor_card($u->card) ) {
+ syslog('LOG_ERR', "OILS: Unblock card update failed: %s", $e->event->{textcode});
+ $e->xact_rollback;
+ return $self;
+ }
+
+ # retrieve the un-fleshed user object for update
+ $u = $e->retrieve_actor_user($u->id);
+ my $note = OpenILS::SIP::clean_text($u->alert_message) || "";
+ $note =~ s#<sip>.*</sip>##;
+ $note =~ s/^\s*//; # kill leading whitespace
+ $note =~ s/\s*$//; # kill trailng whitespace
+ $u->alert_message($note);
+
+ if( ! $e->update_actor_user($u) ) {
+ syslog('LOG_ERR', "OILS: Unblock: patron alert update failed: %s", $e->event->{textcode});
+ $e->xact_rollback;
+ return $self;
+ }
+
+ # stay in synch
+ $self->{user}->alert_message( $note );
+
+ $e->commit; # commits and resets
+ $self->{editor} = OpenILS::SIP->reset_editor();
return $self;
}