Fix for Bug 5898 - search to hold feature not clearing

Search to hold cookie is now cleared when the user loads a blank
circulation page and when the user logs out.

The user also now has the option to "forget" the current
search to hold patron by choosing an option from the
search to hold menu on the search results page.

Signed-off-by: Liz Rea <lrea@nekls.org>
Tested:
Forget <patron> from search to hold results clears cookie
Logging out clears the cookie - testing note: i had to clear my cookies and test fresh before this would work
Loading a blank circulation page (Check Out from the circulation-home) clears the cookie.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Owen Leonard 2011-09-23 11:49:37 -04:00 committed by Chris Cormack
parent f977264066
commit 7f6656aff8
5 changed files with 37 additions and 7 deletions

View file

@ -436,6 +436,11 @@ div#toolbar {
margin-bottom : .7em;
}
div#toolbar .yui-menu-button button,
div#toolbar .yui-button-button button {
line-height : 1.7em;
}
ul.toolbar {
padding-left : 0;
}
@ -948,6 +953,8 @@ fieldset.rows .inputnote {
background-repeat : no-repeat;
}
#placeholdc #yui-gen13 { border-top : 1px solid #CCCCCC; margin-top : .3em; }
#holdfor .first-child { padding-left : 17px; }
#editmenuc .first-child, #deleteshelf .first-child,#newmenuc .first-child, #addbiblio .first-child, #z3950search .first-child, #printmenuc .first-child, #newsupplier .first-child, #savemenuc .first-child, #budgets_menuc .first-child, #periods_menuc .first-child {
@ -1492,6 +1499,11 @@ html>/**/body #searchheader button, x:-moz-any-link, x:default {
padding : 5px 25em 0 0;
}
#searchheader .yui-button button,
#searchheader .yui-button a {
line-height : 1.5em;
}
#search-facets ul {
margin : 0;
padding : .3em;

View file

@ -65,9 +65,9 @@
[% loggedinusername %]
</span>
[% IF ( intranetbookbag ) %]
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="delBasket(true);">Log Out</a>) |
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor(); delBasket(true);">Log Out</a>) |
[% ELSE %]
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1">Log Out</a>) |
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor();">Log Out</a>) |
[% END %]
[% ELSE %]
You are not logged in |

View file

@ -89,3 +89,7 @@ function checkEnter(e){ //e is event object passed from function invocation
return true;
}
}
function clearHoldFor(){
$.cookie("holdfor",null, { path: "/", expires: 0 });
}

View file

@ -136,6 +136,20 @@ function placeHold () {
$("#hold_form").submit();
return false;
}
function forgetPatron(){
$.cookie("holdfor",null, { path: "/", expires: 0 });
$(".holdforlink").remove();
$("#placeholdc").empty();
new YAHOO.widget.Button({
id: "placehold",
type: "button",
label: _("Place hold"),
container: "placeholdc",
onclick: { fn: placeHold }
});
}
function addToList () {
var checkedItems = $(".selection:checked");
if ($(checkedItems).size() == 0) {
@ -181,8 +195,8 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
}
var HoldForButtonMenu = [
{ text: "Place hold", onclick: { fn: holdFor }},
{ text: "Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])", onclick: { fn: holdForPatron }}
];
{ text: "Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])", onclick: { fn: holdForPatron }},
{ text: "Forget [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])", onclick: { fn: forgetPatron }}];
var HoldForButton = new YAHOO.widget.Button({
type: "split",
@ -195,7 +209,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
[% ELSE %]
new YAHOO.widget.Button({
id: "placehold",
type: "link",
type: "button",
label: _("Place hold"),
container: "placeholdc",
onclick: { fn: placeHold }
@ -499,7 +513,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
<span class="noholdstext">No holds allowed</span>
[% ELSE %]
<a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
[% IF ( holdfor ) %] | <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a>[% END %]
[% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
[% END %]
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
| <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>

View file

@ -9,7 +9,7 @@
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript">
//<![CDATA[
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% END %]
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
[% IF ( UseTablesortForCirc ) %]$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },