bug 7494: optional checkout-time fallback search for a book
When issuing a book, some libraries want to issue by title or other details. This patch adds a systempreference and code that allows it. To test: 1) scan a patron card or enter a surname to start checking out; 2) enter title or other keywords; 3) the circulation screen should display a warning allowing to choose between copies. Signed-off-by: MJ Ray <mjr@phonecoop.coop> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
2291c217fb
commit
84c2e7c1e5
5 changed files with 69 additions and 1 deletions
|
@ -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.
|
||||
#
|
||||
|
@ -34,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;
|
||||
|
@ -291,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 ) {
|
||||
|
|
|
@ -158,6 +158,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numReturnedItemsToShow','20','Number of returned items to show on the check-in page',NULL,'Integer');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choose the fines mode, \'off\', \'test\' (emails admin report) or \'production\' (accrue overdue fines). Requires accruefines cronjob.','off|test|production','Choice');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','whitespace|T-prefix|cuecat|libsuite8|EAN13','Choice');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeFallbackSearch','','If set, uses scanned item barcodes as a catalogue search if not found as barcodes',NULL,'YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('singleBranchMode',0,'Operate in Single-branch mode, hide branch selection in the OPAC',NULL,'YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('URLLinkText','','Text to display as the link anchor in the OPAC',NULL,'free');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACViewOthersSuggestions',0,'If ON, allows all suggestions to be displayed in the OPAC',NULL,'YesNo');
|
||||
|
|
|
@ -7058,6 +7058,15 @@ if ( CheckVersion($DBversion) ) {
|
|||
SetVersion($DBversion);
|
||||
}
|
||||
|
||||
$DBversion = "3.13.00.XXX";
|
||||
if ( CheckVersion($DBversion) ) {
|
||||
$dbh->do(
|
||||
"INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeFallbackSearch','','If set, uses scanned item barcodes as a catalogue search if not found as barcodes',NULL,'YesNo')"
|
||||
);
|
||||
print "Upgrade to $DBversion done (Bug 7494: Add itemBarcodeFallbackSearch syspref)\n";
|
||||
# SetVersion($DBversion);
|
||||
}
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
=head2 TableExists($table)
|
||||
|
|
|
@ -18,6 +18,12 @@ Circulation:
|
|||
libsuite8: Convert from Libsuite8 form
|
||||
EAN13: EAN-13 or zero-padded UPC-A from
|
||||
- scanned item barcodes.
|
||||
-
|
||||
- pref: itemBarcodeFallbackSearch
|
||||
choices:
|
||||
yes: "Enable"
|
||||
no: "Don't enable"
|
||||
- to use scanned item barcodes as a catalogue search if not found as barcodes.
|
||||
-
|
||||
- Sort previous checkouts on the circulation page from
|
||||
- pref: previousIssuesDefaultSortOrder
|
||||
|
|
|
@ -469,12 +469,33 @@ function validate1(date) {
|
|||
[% END %]
|
||||
|
||||
[% IF ( UNKNOWN_BARCODE ) %]
|
||||
<li>The barcode was not found [% barcode |html %]</li>
|
||||
<li>The barcode was not found [% barcode |html %]
|
||||
[% IF ( fast_cataloging ) %]
|
||||
[% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
|
||||
<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA&barcode=[% barcode |uri %]&circborrowernumber=[% borrowernumber %]&branch=[% branch %]&duedatespec=[% duedatespec %]&stickyduedate=[% stickyduedate %]">Fast cataloging</a>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
[% IF ( FALLBACK ) %]
|
||||
[% IF options %]
|
||||
<br />The following items were found by searching:
|
||||
[% FOREACH book IN options %]
|
||||
<br />
|
||||
<form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
|
||||
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
|
||||
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
|
||||
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
|
||||
<input type="hidden" name="branch" value="[% branch %]" />
|
||||
<input type="hidden" name="barcode" value="[% book.barcode %]" />
|
||||
<input type="submit" name="x" value="Check out [% book.barcode %]: [% book.title %]" />
|
||||
</form>
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<br />No items were found by searching.
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
</li>
|
||||
[% END %]
|
||||
|
||||
[% IF ( NOT_FOR_LOAN ) %]
|
||||
|
|
Loading…
Reference in a new issue