Revert "Bug 18996: [16.11.x] Handle data corruption from old_issues at SIP checkin" v16.05.18
authorMason James <mtj@kohaaloha.com>
Wed, 25 Oct 2017 00:41:56 +0000 (13:41 +1300)
committerMason James <mtj@kohaaloha.com>
Wed, 25 Oct 2017 00:41:56 +0000 (13:41 +1300)
This reverts commit 722c26c4ef16074624f0606233a1671509289bd6.

C4/SIP/ILS.pm
C4/SIP/ILS/Transaction/Checkin.pm

index b3816f4..7a40777 100644 (file)
@@ -211,32 +211,29 @@ sub checkin {
     else {
         $circ->alert(1);
         $circ->alert_type(99);
-        $circ->ok( 0 );
         $circ->screen_msg('Invalid Item');
-        return $circ;
     }
 
-    if( !$circ->ok && $circ->alert_type && $circ->alert_type == 98 ) { # data corruption
-        $circ->screen_msg("Checkin failed: data problem");
-        syslog( "LOG_WARNING", "Problem with issue_id in issues and old_issues; check the about page" );
-    } elsif( !$item->{patron} ) {
-        if( $checked_in_ok ) { # Mark checkin ok although book not checked out
-            $circ->ok( 1 );
-            syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - using checked_in_ok");
-        } else {
-            $circ->screen_msg("Item not checked out");
-            syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item not checked out");
+    # It's ok to check it in if it exists, and if it was checked out
+    # or it was not checked out but the checked_in_ok flag was set
+    $circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) );
+    syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - using checked_in_ok") if $checked_in_ok;
+
+    if ( !defined( $item->{patron} ) ) {
+        $circ->screen_msg("Item not checked out") unless $checked_in_ok;
+       syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - item not checked out");
+    }
+    else {
+        if ( $circ->ok ) {
+            $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) );
+            delete $item->{patron};
+            delete $item->{due_date};
+            $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
         }
-    } elsif( $circ->ok ) {
-        $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) );
-        delete $item->{patron};
-        delete $item->{due_date};
-        $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
-    } else {
-        $circ->screen_msg("Checkin failed");
-        syslog( "LOG_WARNING", "Checkin failed: probably for Wrongbranch or withdrawn" );
     }
 
+    # END TRANSACTION
+
     return $circ;
 }
 
index 1e138bc..19c82e9 100644 (file)
@@ -72,9 +72,7 @@ sub do_checkin {
     # biblionumber, biblioitemnumber, itemnumber
     # borrowernumber, reservedate, branchcode
     # cancellationdate, found, reservenotes, priority, timestamp
-    if( $messages->{DataCorrupted} ) {
-        $self->alert_type('98');
-    }
+
     if ($messages->{BadBarcode}) {
         $self->alert_type('99');
     }