[Koha-patches] [PATCH] [Signed Off] Fix for Bug 5898 - search to hold feature not clearing

Liz Rea lrea at nekls.org
Fri Sep 23 20:38:31 CEST 2011


From: Owen Leonard <oleonard at myacpl.org>

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 at 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.
---
 .../intranet-tmpl/prog/en/css/staff-global.css     |   12 ++++++++++
 .../intranet-tmpl/prog/en/includes/header.inc      |    4 +-
 koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js |    4 +++
 .../prog/en/modules/catalogue/results.tt           |   22 ++++++++++++++++---
 .../prog/en/modules/circ/circulation.tt            |    2 +-
 5 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 8b2b8f5..3987b31 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -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;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
index 1faf0ca..24d1104 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
@@ -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 |
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
index 463c28e..f491773 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
@@ -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 });
+}
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
index 7a1039d..2bed51c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -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>
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 d6b2b22..8f45e53 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -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;  },
-- 
1.7.2.5



More information about the Koha-patches mailing list