Bugzilla – Attachment 8652 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), 7.09 KB, created by
MJ Ray (software.coop)
on 2012-03-27 16:55:56 UTC
(
hide
)
Description:
bug 7494: optional checkout-time fallback search for a book
Filename:
MIME Type:
Creator:
MJ Ray (software.coop)
Created:
2012-03-27 16:55:56 UTC
Size:
7.09 KB
patch
obsolete
>From 7d873a660e6c22c69742389af294068523b6a744 Mon Sep 17 00:00:00 2001 >From: MJ Ray <mjr@phonecoop.coop> >Date: Tue, 27 Mar 2012 17:55:24 +0100 >Subject: [PATCH] bug 7494: optional checkout-time fallback search for a book > >--- > circ/circulation.pl | 26 ++++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 13 ++++++++++ > .../en/modules/admin/preferences/circulation.pref | 6 ++++ > .../prog/en/modules/circ/circulation.tt | 7 +++++ > 5 files changed, 53 insertions(+), 0 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 6928966..01697bc 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -4,6 +4,7 @@ > > # Copyright 2000-2002 Katipo Communications > # copyright 2010 BibLibre >+# Copyright 2012 software.coop and MJ Ray > # > # This file is part of Koha. > # >@@ -32,6 +33,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; >@@ -282,6 +285,29 @@ if ($barcode) { > CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); > my $blocker = $invalidduedate ? 1 : 0; > >+ # Fix for bug 7494: optional checkout-time fallback search for a book >+ if ( $error->{'UNKNOWN_BARCODE'} >+ && C4::Context->preference("itemBarcodeFallbackSearch") ) >+ { >+ my $query = >+ "kw=" >+ . $barcode >+ . " and ( ( allrecords,AlwaysMatches='' not onloan,AlwaysMatches='') and (lost,st-numeric=0) )"; >+ my ( $searcherror, $results, $total_hits ) = SimpleSearch($query); >+ >+ # if multiple hits, warn librarian >+ if ( $total_hits > 0 ) { >+ my $chosen = >+ TransformMarcToKoha( C4::Context->dbh, >+ MARC::Record->new_from_usmarc( $results->[0] ) ); >+ # use first barcode if multiple >+ $barcode = ( $chosen->{barcode} =~ m/^([^|]*)/ )[0]; >+ ( $error, $question ) = >+ CanBookBeIssued( $borrower, $barcode, $datedue, $inprocess ); >+ $question->{'FALLBACK'} = 1; >+ } >+ } >+ > delete $question->{'DEBT'} if ($debt_confirmed); > foreach my $impossible ( keys %$error ) { > $template->param( >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 3e850b3..5adcbd2 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -165,6 +165,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','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 1c8be0f..6057ec4 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4994,6 +4994,19 @@ if ( C4::Context->preference("Version") lt TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+ >+ >+$DBversion = '3.07.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 > > =head2 DropAllForeignKeys($table) >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 59ed564..970acf4 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 >@@ -18,6 +18,12 @@ Circulation: > libsuite8: Convert from Libsuite8 form > - 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 1d0e07a..c953efb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -260,6 +260,10 @@ function refocus(calendar) { > <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) is checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% issued_borrowernumber %]">[% issued_firstname %] [% issued_surname %]</a> ([% issued_cardnumber %]). Check in and check out?</li> > [% END %] > >+[% IF ( FALLBACK ) %] >+ <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) was found by searching. Check out anyway?</li> >+[% END %] >+ > [% IF ( TOO_MANY ) %] > <li>Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.</li> > [% END %] >@@ -298,7 +302,10 @@ function refocus(calendar) { > > <input type="hidden" name="barcode" value="[% barcode %]" /> > <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >+ [% IF ( FALLBACK ) %] >+ [% ELSE %] > <input type="hidden" name="issueconfirmed" value="1" /> >+ [% END %] > [% IF ( DEBT ) %]<input type="hidden" name="debt_confirmed" value="1" />[% END %] > [% IF ( INVALID_DATE ) %] > <p> >-- >1.7.2.5
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