Bug 23697: (follow-up) Add autocompletion search in patron module

- Rename CircAutocompl system preference to PatronAutocompletion
 - Take this system preference into consideration for patron search

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Matthias Meusburger 2019-10-04 11:16:08 +02:00 committed by Martin Renvoize
parent a777b6376d
commit e5bf671357
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
13 changed files with 45 additions and 32 deletions

View File

@ -480,7 +480,7 @@ sub get_template_and_user {
AmazonCoverImages => C4::Context->preference("AmazonCoverImages"),
AutoLocation => C4::Context->preference("AutoLocation"),
"BiblioDefaultView" . C4::Context->preference("IntranetBiblioDefaultView") => 1,
CircAutocompl => C4::Context->preference("CircAutocompl"),
PatronAutocompletion => C4::Context->preference("PatronAutocompletion"),
FRBRizeEditions => C4::Context->preference("FRBRizeEditions"),
IndependentBranches => C4::Context->preference("IndependentBranches"),
IntranetNav => C4::Context->preference("IntranetNav"),

View File

@ -182,7 +182,7 @@ sub BuildReport {
TransferWhenCancelAllWaitingHolds
AllowAllMessageDeletion
AllowOfflineCirculation
CircAutocompl
PatronAutocompletion
CircAutoPrintQuickSlip
DisplayClearScreenButton
FilterBeforeOverdueReport

View File

@ -241,7 +241,7 @@ $template->param(
setwaiting => $setwaiting,
trsfitemloop => \@trsfitemloop,
errmsgloop => \@errmsgloop,
CircAutocompl => C4::Context->preference("CircAutocompl"),
PatronAutocompletion => C4::Context->preference("PatronAutocompletion"),
);
# Checking if there is a Fast Cataloging Framework

View File

@ -636,7 +636,7 @@ my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber =>
$template->param(
debt_confirmed => $debt_confirmed,
SpecifyDueDate => $duedatespec_allow,
CircAutocompl => C4::Context->preference("CircAutocompl"),
PatronAutocompletion => C4::Context->preference("PatronAutocompletion"),
debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }),
todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
has_modifications => $has_modifications,

View File

@ -0,0 +1,6 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
$dbh->do( "UPDATE systempreferences SET variable="PatronAutocompletion" WHERE variable="CircAutocompl" LIMIT 1" );
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 23697 - Rename CircAutocompl system preference to PatronAutocompletion)\n";
}

View File

@ -116,7 +116,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('CatalogModuleRelink','0',NULL,'If OFF the linker will never replace the authids that are set in the cataloging module.','YesNo'),
('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'),
('CheckPrevCheckout','hardno','hardyes|softyes|softno|hardno','By default, for every item checked out, should we warn if the patron has borrowed that item in the past?','Choice'),
('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'),
('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'),
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
('CircSidebar','0',NULL,'Activate or deactivate the navigation sidebar on all Circulation pages','YesNo'),
@ -464,6 +463,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
('PatronAutocompletion','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),

View File

@ -81,7 +81,7 @@
[% END %]
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
[% IF ( CircAutocompl ) %]
[% IF ( PatronAutocompletion ) %]
<script>
$(document).ready(function(){
var obj = $( "#findborrower" ).autocomplete({
@ -109,3 +109,30 @@
</script>
[% END %]
[% END %]
[% IF ( PatronAutocompletion ) %]
<script>
$(document).ready(function(){
var obj = $( "#searchmember" ).autocomplete({
source: "/cgi-bin/koha/circ/ysearch.pl",
minLength: 3,
select: function( event, ui ) {
window.location.href = ui.item.link;
}
}).data( "ui-autocomplete" );
if( obj ) {
obj._renderItem = function( ul, item ) {
item.link = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber;
var cardnumber = "";
if( item.cardnumber != "" ){
// Display card number in parentheses if it exists
cardnumber = " (" + item.cardnumber + ") ";
}
return $( "<li></li>" )
.data( "ui-autocomplete-item", item )
.append( "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
.appendTo( ul );
};
}
});
</script>
[% END %]

View File

@ -2,7 +2,7 @@
<div id="circ_search" class="residentsearch">
<p class="tip">Enter patron card number or partial name:</p>
<form action="/cgi-bin/koha/circ/circulation.pl" id="patronsearch" method="post">
[% IF ( CircAutocompl ) %]
[% IF ( PatronAutocompletion ) %]
<div class="autocomplete">
<input autocomplete="off" id="findborrower" name="findborrower" size="40" class="head-searchbox focus" type="text" />
<input id="autocsubmit" type="submit" class="submit" value="Submit" />

View File

@ -15,11 +15,11 @@ Circulation:
- the automatic redirection to another patron when a patron barcode is scanned instead of a book.
- This should not be enabled if you have overlapping patron and book barcodes.
-
- pref: CircAutocompl
- pref: PatronAutocompletion
choices:
yes: Try
no: "Don't try"
- to guess the patron being entered while typing a patron search on the circulation screen.
- to guess the patron being entered while typing a patron search for circulation or patron search.
- Only returns the first 10 results at a time.
-
- pref: itemBarcodeInputFilter

View File

@ -1224,7 +1224,7 @@
});
[% UNLESS ( patron || patron.borrowernumber || borrowers || noitems ) %]
[% IF ( CircAutocompl ) %]
[% IF ( PatronAutocompletion ) %]
$( "#patron" ).autocomplete({
source: "/cgi-bin/koha/circ/ysearch.pl",
minLength: 3,

View File

@ -96,27 +96,6 @@ $(document).ready(function(){
$("#patronImageEdit").modal("show");
});
var obj = $( "#searchmember" ).autocomplete({
source: "/cgi-bin/koha/circ/ysearch.pl",
minLength: 3,
select: function( event, ui ) {
window.location.href = ui.item.link;
}
}).data( "ui-autocomplete" );
if( obj ) {
obj._renderItem = function( ul, item ) {
item.link = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber;
var cardnumber = "";
if( item.cardnumber != "" ){
// Display card number in parentheses if it exists
cardnumber = " (" + item.cardnumber + ") ";
}
return $( "<li></li>" )
.data( "ui-autocomplete-item", item )
.append( "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
.appendTo( ul );
};
}
});

View File

@ -70,6 +70,7 @@ $template->param(
$template->param(
alphabet => C4::Context->preference('alphabet') || join (' ', 'A' .. 'Z'),
PatronAutocompletion => C4::Context->preference('PatronAutocompletion'),
patron_lists => [ GetPatronLists() ],
PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
);

View File

@ -435,7 +435,7 @@ sub mocking_systempreferences_to_a_set_value {
TransferWhenCancelAllWaitingHolds
AllowAllMessageDeletion
AllowOfflineCirculation
CircAutocompl
PatronAutocompletion
CircAutoPrintQuickSlip
DisplayClearScreenButton
FilterBeforeOverdueReport