X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=circ%2Fcirculation.pl;h=efd533e57c981f881275d2e087990f107edd9fc7;hb=8c3d3eb01a91c073aa9a5f2cb016bba01f0529ab;hp=b664d4989aec096a8cc52b747096294d61efd90a;hpb=eee5324a26ce92eae7187cc88c78e18b8ba7843c;p=koha_fer diff --git a/circ/circulation.pl b/circ/circulation.pl index b664d4989a..efd533e57c 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -5,6 +5,7 @@ # Copyright 2000-2002 Katipo Communications # copyright 2010 BibLibre # Copyright 2011 PTFS-Europe Ltd. +# Copyright 2012 software.coop and MJ Ray # # This file is part of Koha. # @@ -24,7 +25,6 @@ use strict; use warnings; use CGI; - use C4::Output; use C4::Print; use C4::Auth qw/:DEFAULT get_session/; @@ -35,6 +35,8 @@ use C4::Circulation; use C4::Overdues qw/CheckBorrowerDebarred/; use C4::Members; use C4::Biblio; +use C4::Search; +use MARC::Record; use C4::Reserves; use C4::Context; use CGI::Session; @@ -103,7 +105,6 @@ our %return_failed = (); for (@failedreturns) { $return_failed{$_} = 1; } my $findborrower = $query->param('findborrower') || q{}; -utf8::decode($findborrower); $findborrower =~ s|,| |g; my $borrowernumber = $query->param('borrowernumber'); @@ -293,6 +294,34 @@ if ($barcode) { $template->param( authvalcode_notforloan => C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'}), ); + # Fix for bug 7494: optional checkout-time fallback search for a book + + if ( $error->{'UNKNOWN_BARCODE'} + && C4::Context->preference("itemBarcodeFallbackSearch") ) + { + $template->param( FALLBACK => 1 ); + + my $query = "kw=" . $barcode; + my ( $searcherror, $results, $total_hits ) = SimpleSearch($query); + + # if multiple hits, offer options to librarian + if ( $total_hits > 0 ) { + my @options = (); + foreach my $hit ( @{$results} ) { + my $chosen = + TransformMarcToKoha( C4::Context->dbh, + MARC::Record->new_from_usmarc($hit) ); + + # offer all barcodes individually + foreach my $barcode ( sort split(/\s*\|\s*/, $chosen->{barcode}) ) { + my %chosen_single = %{$chosen}; + $chosen_single{barcode} = $barcode; + push( @options, \%chosen_single ); + } + } + $template->param( options => \@options ); + } + } delete $question->{'DEBT'} if ($debt_confirmed); foreach my $impossible ( keys %$error ) { @@ -361,8 +390,9 @@ if ($borrowernumber) { $getreserv{nottransfered} = 0; $getreserv{reservedate} = format_date( $num_res->{'reservedate'} ); - $getreserv{reservenumber} = $num_res->{'reservenumber'}; + $getreserv{reserve_id} = $num_res->{'reserve_id'}; $getreserv{title} = $getiteminfo->{'title'}; + $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($getiteminfo->{biblionumber}), GetFrameworkCode($getiteminfo->{biblionumber})); $getreserv{itemtype} = $itemtypeinfo->{'description'}; $getreserv{author} = $getiteminfo->{'author'}; $getreserv{barcodereserv} = $getiteminfo->{'barcode'}; @@ -402,12 +432,14 @@ if ($borrowernumber) { $getreserv{color} = 'inwait'; $getreserv{title} = $getbibinfo->{'title'}; + $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($num_res->{biblionumber}), GetFrameworkCode($num_res->{biblionumber})); $getreserv{nottransfered} = 0; $getreserv{itemtype} = $itemtypeinfo->{'description'}; $getreserv{author} = $getbibinfo->{'author'}; $getreserv{biblionumber} = $num_res->{'biblionumber'}; } $getreserv{waitingposition} = $num_res->{'priority'}; + $getreserv{expirationdate} = $num_res->{'expirationdate'}; push( @reservloop, \%getreserv ); # if we have a reserve waiting, initiate waitingreserveloop @@ -472,7 +504,7 @@ sub build_issue_data { $it->{'displaydate'} = output_pref($it->{'issuedate'}); #$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; $it->{'od'} = $it->{'overdue'}; - $it->{'author'} ||= ' '; + $it->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($it->{biblionumber}), GetFrameworkCode($it->{biblionumber})); $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}}; $it->{'return_failed'} = $return_failed{$it->{'barcode'}};