From b853eed5f4e672b0e1aab0360b79d692183eeedb Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 20 Mar 2008 14:25:15 -0500 Subject: [PATCH] Some reworking of suggestions management interface in preparation for tackling hdl's proposal of wider scope. Includes change to Suggestions.pm to enable passing of borrowernumber to the template. Signed-off-by: Joshua Ferraro --- C4/Suggestions.pm | 8 ++- .../en/modules/suggestion/acceptorreject.tmpl | 63 ++++++++----------- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 82123072ad..afb548d519 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -91,8 +91,10 @@ sub SearchSuggestion { SELECT suggestions.*, U1.surname AS surnamesuggestedby, U1.firstname AS firstnamesuggestedby, + U1.borrowernumber AS borrnumsuggestedby, U2.surname AS surnamemanagedby, - U2.firstname AS firstnamemanagedby + U2.firstname AS firstnamemanagedby, + U2.borrowernumber AS borrnummanagedby FROM suggestions LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber @@ -214,8 +216,10 @@ sub GetSuggestionByStatus { my $query = "SELECT suggestions.*, U1.surname AS surnamesuggestedby, U1.firstname AS firstnamesuggestedby, + U1.borrowernumber AS borrnumsuggestedby, U2.surname AS surnamemanagedby, - U2.firstname AS firstnamemanagedby + U2.firstname AS firstnamemanagedby, + U2.borrowernumber AS borrnummanagedby FROM suggestions LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl index e8dfb39e8b..69731721a9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl @@ -8,27 +8,24 @@ * displayOther. * This function display the select or an textaera to write a reason. */ - function displayOther(id) { - var spanselect = document.getElementById("span-select-reason"+id); - var spanother = document.getElementById("span-other-reason"+id); - var select = spanselect.firstChild.nextSibling; - - if(select.value != "other"){ - return; - } - if(spanother.getAttribute('class')=='content_visible'){ - spanother.removeAttribute('class'); - spanselect.removeAttribute('class'); - spanother.setAttribute('class','content_hidden'); - spanselect.setAttribute('class','content_visible'); - } - else{ - spanother.removeAttribute('class'); - spanselect.removeAttribute('class'); - spanselect.setAttribute('class','content_hidden'); - spanother.setAttribute('class','content_visible'); - } + function displayOther(id,show,hide) { + $("#"+hide+id).hide(); + $("#"+show+id).show(); } + $(document).ready(function() { + $("div[id*=other-reason]").hide(); + $("input[name*=other-reason]").focus(function(){ $(this).val(""); }); + $("select[name*=reason]").change(function(){ + if($(this).children("[@selected]").val() == "other"){ + displayOther($(this).attr("name").replace(/reason/,""),"other-reason","select-reason"); + } + }); + $("a[href*=back]").click(function(){ + var sid = $(this).attr("href").replace(/#back/,""); + displayOther(sid,"select-reason","other-reason"); + $("#reason"+sid).find("option[value='']").attr("selected","selected"); + }); + }); // ]]> @@ -76,21 +73,19 @@ - - " class="content_visible"> - " name="reason"> No reasons defined in authorised values - - - " class="content_hidden"> - " value="please note your reason here..." onclick="if(this.value === 'please note your reason here...'){this.value=''}" /> - '); return false;">back to list - + +
"> + " value="please note your reason here..." /> +

">back to list

+
@@ -99,11 +94,7 @@ ; Volume: ; ISBN : ; Published by in in
- - - , - - + ">, @@ -158,9 +149,7 @@ - - , - + ">, -- 2.39.5