Bugzilla – Attachment 18981 Details for
Bug 7494
Use partial barcode or callnumber as a fallback for the barcode search in checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug 7494: optional checkout-time fallback search for a book
bug-7494-optional-checkout-time-fallback-search-fo.patch (text/plain), 8.31 KB, created by
Jonathan Druart
on 2013-06-14 09:48:53 UTC
(
hide
)
Description:
bug 7494: optional checkout-time fallback search for a book
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-06-14 09:48:53 UTC
Size:
8.31 KB
patch
obsolete
>From 00c452fb0cb8580551e7bcd8288e9cdcdcea69f6 Mon Sep 17 00:00:00 2001 >From: MJ Ray <mjr@phonecoop.coop> >Date: Thu, 28 Jun 2012 20:35:49 +0100 >Subject: [PATCH] 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> >--- > circ/circulation.pl | 31 ++++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 9 ++++++ > .../en/modules/admin/preferences/circulation.pref | 6 ++++ > .../prog/en/modules/circ/circulation.tt | 23 ++++++++++++++- > 5 files changed, 69 insertions(+), 1 deletion(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 52823f4..2df9133 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. > # >@@ -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 ) { >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index fbd0387..6758574 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -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'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 648e161..c8a1265 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6990,6 +6990,15 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.13.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($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 (Add itemBarcodeFallbackSearch syspref)\n"; >+ # SetVersion($DBversion); >+} >+ > > =head1 FUNCTIONS > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 64cf338..a4f8c4e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -19,6 +19,12 @@ Circulation: > 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 > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 95252e7..354ad91 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -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 ) %] >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7494
:
8652
|
10139
|
15945
|
16365
|
16685
|
17389
| 18981