Lines 211-239
sub checkin {
Link Here
|
211 |
else { |
211 |
else { |
212 |
$circ->alert(1); |
212 |
$circ->alert(1); |
213 |
$circ->alert_type(99); |
213 |
$circ->alert_type(99); |
|
|
214 |
$circ->ok( 0 ); |
214 |
$circ->screen_msg('Invalid Item'); |
215 |
$circ->screen_msg('Invalid Item'); |
|
|
216 |
return $circ; |
215 |
} |
217 |
} |
216 |
|
218 |
|
217 |
# It's ok to check it in if it exists, and if it was checked out |
219 |
if( !$circ->ok && $circ->alert_type && $circ->alert_type == 98 ) { # data corruption |
218 |
# or it was not checked out but the checked_in_ok flag was set |
220 |
$circ->screen_msg("Checkin failed: data problem"); |
219 |
$circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) ); |
221 |
syslog( "LOG_WARNING", "Problem with issue_id in issues and old_issues; check the about page" ); |
220 |
syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - using checked_in_ok") if $checked_in_ok; |
222 |
} elsif( !$item->{patron} ) { |
221 |
|
223 |
if( $checked_in_ok ) { # Mark checkin ok although book not checked out |
222 |
if ( !defined( $item->{patron} ) ) { |
224 |
$circ->ok( 1 ); |
223 |
$circ->screen_msg("Item not checked out") unless $checked_in_ok; |
225 |
syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - using checked_in_ok"); |
224 |
syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - item not checked out"); |
226 |
} else { |
225 |
} |
227 |
$circ->screen_msg("Item not checked out"); |
226 |
else { |
228 |
syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item not checked out"); |
227 |
if ( $circ->ok ) { |
|
|
228 |
$circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) ); |
229 |
delete $item->{patron}; |
230 |
delete $item->{due_date}; |
231 |
$patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ]; |
232 |
} |
229 |
} |
|
|
230 |
} elsif( $circ->ok ) { |
231 |
$circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) ); |
232 |
delete $item->{patron}; |
233 |
delete $item->{due_date}; |
234 |
$patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ]; |
235 |
} else { |
236 |
$circ->screen_msg("Checkin failed"); |
237 |
syslog( "LOG_WARNING", "Checkin failed: probably for Wrongbranch or withdrawn" ); |
233 |
} |
238 |
} |
234 |
|
239 |
|
235 |
# END TRANSACTION |
|
|
236 |
|
237 |
return $circ; |
240 |
return $circ; |
238 |
} |
241 |
} |
239 |
|
242 |
|