$debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, dt_from_string($return_date));
- if ($checked_in_ok){
- $debug and warn 'not raising alert when AddReturn() does not return a value for $return due to $checked_in_ok being set to true';
- }
- else {
- $self->alert(!$return);
+
+ if ( $checked_in_ok ) {
+ delete $messages->{NotIssued};
+ delete $messages->{LocalUse};
+ $return = 1 unless keys %$messages;
}
- # ignoring messages: NotIssued, WasLost, WasTransfered
# biblionumber, biblioitemnumber, itemnumber
# borrowernumber, reservedate, branchcode
if ($messages->{withdrawn}) {
$self->alert_type('99');
}
+ if ($messages->{ReturnOfLostItemBlocked}) {
+ $self->alert_type('99');
+ }
if ($messages->{Wrongbranch}) {
$self->{item}->destination_loc($messages->{Wrongbranch}->{Rightbranch});
$self->alert_type('04'); # send to other branch
$self->{item}->hold_patron_id( $messages->{ResFound}->{borrowernumber} );
$self->{item}->destination_loc( $messages->{ResFound}->{branchcode} );
}
+ # ignoring messages: NotIssued, WasLost, WasTransfered
- my $alert = defined $self->alert_type;
- if ( $cv_triggers_alert ) {
- $self->alert($alert); # Overwrites existing alert value, should set to 0 if there is no alert type
- } else {
- $self->alert($alert) if $alert; # Doesn't affect alert value unless an alert type is set
+ if ($cv_triggers_alert) {
+ $self->alert( defined $self->alert_type ); # Overwrites existing alert value, should set to 0 if there is no alert type
+ }
+ else {
+ $self->alert( !$return || defined $self->alert_type );
}
$self->ok($return);