X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FCirculation.pm;h=237181fe1c769c70427a2104b6ec50755ed1e043;hb=be8a3ee8304d305a3f684a435a366d5b9ea69b27;hp=1421c7869b811693bba9685ff3f7a0dba0cc1f89;hpb=e8c232fcf757659bfb48433e1b8f08fa895e6aaa;p=koha-ffzg.git diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 1421c7869b..237181fe1c 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -824,6 +824,7 @@ sub CanBookBeIssued { borrowernumber => $patron->borrowernumber, ccode => $item_object->ccode, categorycode => $patron->categorycode, + location => $item_object->location, } ); ModDateLastSeen( $item_object->itemnumber ); # FIXME Move to Koha::Item @@ -2292,8 +2293,15 @@ sub AddReturn { $validTransfer = 1 if $transfer->reason eq 'Reserve'; } else { - $messages->{'WasTransfered'} = $transfer->tobranch; $messages->{'TransferTrigger'} = $transfer->reason; + if ( $transfer->frombranch eq $branch ) { + $transfer->transit; + $messages->{'WasTransfered'} = $transfer->tobranch; + } + else { + $messages->{'WrongTransfer'} = $transfer->tobranch; + $messages->{'WrongTransferItem'} = $item->itemnumber; + } } } } @@ -2954,6 +2962,10 @@ sub CanBookBeRenewed { } } + # There is an item level hold on this item, no other item can fill the hold + return ( 0, "on_reserve" ) + if ( $item->current_holds->search( { non_priority => 0 } )->count ); + my $fillable_holds = Koha::Holds->search( { biblionumber => $item->biblionumber, @@ -3156,7 +3168,8 @@ sub AddRenewal { $renews = ( $item_object->renewals || 0 ) + 1; $item_object->renewals($renews); $item_object->onloan($datedue); - $item_object->store({ log_action => 0 }); + # Don't index as we are in a transaction + $item_object->store({ log_action => 0, skip_record_index => 1 }); # Charge a new rental fee, if applicable my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); @@ -3208,11 +3221,11 @@ sub AddRenewal { # Add renewal record my $renewal = Koha::Checkouts::Renewal->new( { - checkout_id => $issue->issue_id, - renewer_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, - seen => $seen, - interface => C4::Context->interface, - renewal_type => $renewal_type + checkout_id => $issue->issue_id, + interface => C4::Context->interface, + renewal_type => $renewal_type, + renewer_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, + seen => $seen, } )->store(); @@ -3241,6 +3254,9 @@ sub AddRenewal { } }); }); + # We index now, after the transaction is committed + my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); + $indexer->index_records( $item_object->biblionumber, "specialUpdate", "biblioserver" ); return $datedue; }