returning NO_CHANGE on duplicate scans in the correct location
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Feb 2006 15:24:24 +0000 (15:24 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Feb 2006 15:24:24 +0000 (15:24 +0000)
some bug fixes

git-svn-id: svn://svn.open-ils.org/ILS/trunk@3077 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/ils_events.xml
Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm

index c4f98c7..f4ef48e 100644 (file)
                <desc>Placeholder event.  Used for development only</desc>
        </event>
 
+       <event code='3' textcode='NO_CHANGE'>
+               <desc>
+                       The called method didn't actually do anything
+               </desc>
+       </event>
+
+
 
        <event code='1000' textcode='LOGIN_FAILED'>
                <desc>
index 3514f0a..c2d9689 100644 (file)
@@ -914,8 +914,8 @@ sub generic_receive {
 
        my $copy = $ctx->{copy};
        $U->unflesh_copy($copy);
-       $logger->info("Checkin copy called by user ".$requestor->id." for copy ".$copy->id);
        return OpenILS::Event->new('COPY_NOT_FOUND') unless $copy;
+       $logger->info("Checkin copy called by user ".$requestor->id." for copy ".$copy->id);
        # ------------------------------------------------------------------------------
 
        return $self->checkin_do_receive($connection, $ctx);
@@ -929,6 +929,7 @@ sub checkin_do_receive {
        my $copy                        = $ctx->{copy};
        my $session             = $ctx->{session};
        my $requestor   = $ctx->{requestor};
+       my $nochange    = 1; # did we actually do anything?
 
        if(!$ctx->{force}) {
                return $evt if ($evt = _checkin_check_copy_status($copy));
@@ -945,6 +946,7 @@ sub checkin_do_receive {
                # info from the circ then close it out 
                $longoverdue    = 1 if ($circ->stop_fines =~ /longoverdue/);
                $claimsret              = 1 if ($circ->stop_fines =~ /claimsreturned/);
+               $nochange               = 0;
                $ctx->{circ}    = $circ;
                $evt                            = _checkin_handle_circ($ctx);
                return $evt if $evt;
@@ -952,8 +954,9 @@ sub checkin_do_receive {
        } elsif( $transit ) {
 
                # is this item currently in transit?
-               $ctx->{transit} = $transit;
-               $evt = $transcode->transit_receive( $copy, $requestor, $session );
+               $nochange                       = 0;
+               $ctx->{transit} = $transit;
+               $evt                                    = $transcode->transit_receive( $copy, $requestor, $session );
 
                if( !$U->event_equals($evt, 'SUCCESS') ) {
 
@@ -987,7 +990,8 @@ sub checkin_do_receive {
 
        if($hold) {
 
-               $ctx->{hold} = $hold;
+               $ctx->{hold}    = $hold;
+               $nochange               = 0;
                
                # Capture the hold with this copy
                return $evt if ($evt = _checkin_capture_hold($ctx));
@@ -1017,12 +1021,16 @@ sub checkin_do_receive {
 
                        # Copy wants to go home. Transit it there.
                        return $evt if ( $evt = _checkin_build_generic_copy_transit($ctx) );
-                       $evt = OpenILS::Event->new('ROUTE_ITEM', org => $copy->circ_lib);
+                       $evt                    = OpenILS::Event->new('ROUTE_ITEM', org => $copy->circ_lib);
+                       $nochange       = 0;
                }
        }
 
        $logger->info("Copy checkin finished with event: ".$evt->{textcode});
 
+       return _checkin_flesh_event(
+               $ctx, OpenILS::Event->new('NO_CHANGE')) if $nochange;
+
        $U->commit_db_session($session);
        return _checkin_flesh_event($ctx, $evt);
 }