From 9a145d32b94be1a7a54a4295018713c695098f6d Mon Sep 17 00:00:00 2001 From: Paul Poulain <paul.poulain@biblibre.com> Date: Wed, 15 Dec 2010 00:06:06 +0100 Subject: [PATCH] Bug 5870 : suggestion management enhancements * changing suggestedy management * adding a new status field & filter --- .../prog/en/modules/suggestion/suggestion.tmpl | 29 +++++++++++-------- suggestion/suggestion.pl | 13 +++++++- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl index 0b4e351..b9fd25e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl @@ -124,10 +124,11 @@ h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di </fieldset> <fieldset class="rows"> <legend>Suggestion management</legend> <ol> - <!--TMPL_IF Name="suggestionid"--><li><label for="status">Status:</label><select id="status" name="status"><option value="">No Status</option> - <!-- TMPL_LOOP name="status_loop" --> - <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="code" -->" selected="selected"><!-- TMPL_VAR name="desc" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="code" -->"><!-- TMPL_VAR name="desc" --></option><!-- /TMPL_IF --> - <!-- /TMPL_LOOP --> + <!--TMPL_IF Name="suggestionid"--><li><label for="status">Status:</label><select id="STATUS" name="STATUS"><option value="">No Status</option> + <option value="ASKED"<!-- TMPL_IF NAME="statusselected_ASKED" --> selected="selected"<!--/TMPL_IF-->>Asked</option> + <option value="ACCEPTED"<!-- TMPL_IF NAME="statusselected_ACCEPTED" --> selected="selected"<!--/TMPL_IF-->>Accepted</option> + <option value="CHECKED"<!-- TMPL_IF NAME="statusselected_CHECKED" --> selected="selected"<!--/TMPL_IF-->>Checked</option> + <option value="REJECTED"<!-- TMPL_IF NAME="statusselected_REJECTED" --> selected="selected"<!--/TMPL_IF-->>Rejected</option> </select></li><!--/TMPL_IF--> <li><table> <thead><tr><th> </th><th>Date</th><th>By</th></tr></thead> @@ -178,8 +179,8 @@ h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di </li><li><label for="total">Total</label> <input type="text" readonly="readonly" id="total" name="total" size="10" value="<!--TMPL_VAR Name="total"-->"/> </li></ol> - </fieldset> - <fieldset class="action"><input type="hidden" name="op" value="<!--TMPL_VAR Name="op"-->" /><!--TMPL_IF Name="suggestionid"--><input type="submit" value="Save" /> <a class="cancel" href="suggestion.pl?suggestionid=<!--TMPL_VAR Name="suggestionid"-->">Cancel</a><!--TMPL_ELSE--><input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a><!--/TMPL_IF--> + </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="<!--TMPL_IF Name="returnsuggestedby"--><!--TMPL_VAR Name="returnsuggestedby"--><!-- TMPL_ELSE -->noone<!--/TMPL_IF-->"/> + <fieldset class="action"><input type="hidden" name="op" value="<!--TMPL_VAR Name="op"-->" /><!--TMPL_IF Name="suggestionid"--><input type="submit" value="Save" /> <a class="cancel" href="<!--TMPL_IF Name="returnsuggestedby"-->/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="returnsuggestedby"-->#suggestions<!-- TMPL_ELSE -->suggestion.pl?suggestionid=<!--TMPL_VAR Name="suggestionid"--><!--/TMPL_IF-->">Cancel</a><!--TMPL_ELSE--><input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a><!--/TMPL_IF--> </fieldset> </form> <!-- /TMPL_IF --> @@ -250,7 +251,7 @@ h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di <!-- TMPL_VAR name="budget_name" --> </td> <td> - <!-- TMPL_IF name="ASKED" -->Requested<!-- /TMPL_IF --> <!-- TMPL_IF name="ACCEPTED" -->Accepted<!-- /TMPL_IF --> <!-- TMPL_IF name="ORDERED" -->Ordered<!-- /TMPL_IF --> <!-- TMPL_IF name="REJECTED" -->Rejected<!-- /TMPL_IF --> <!-- TMPL_IF name="CHECKED" -->Checked<!-- /TMPL_IF --> <!-- TMPL_IF name="reason" --><br />(<!-- TMPL_VAR name="reason" -->)<!-- /TMPL_IF --> + <!-- TMPL_IF name="ASKED" -->Asked<!-- /TMPL_IF --> <!-- TMPL_IF name="ACCEPTED" -->Accepted<!-- /TMPL_IF --> <!-- TMPL_IF name="ORDERED" -->Ordered<!-- /TMPL_IF --> <!-- TMPL_IF name="REJECTED" -->Rejected<!-- /TMPL_IF --> <!-- TMPL_IF name="CHECKED" -->Checked<!-- /TMPL_IF --> <!-- TMPL_IF name="reason" --><br />(<!-- TMPL_VAR name="reason" -->)<!-- /TMPL_IF --> </td> </tr> <!-- /TMPL_LOOP --></tbody> @@ -259,9 +260,10 @@ h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di <div id="status<!-- TMPL_VAR NAME="suggestiontype" -->"> <label for="STATUS<!-- TMPL_VAR NAME="suggestiontype" -->">Mark selected as: </label><select name="STATUS" id="STATUS<!-- TMPL_VAR NAME="suggestiontype" -->"> <option value=""> -- Choose a status --</option> - <option value="ACCEPTED">Accepted</option> - <option value="CHECKED">Checked</option> - <option value="REJECTED">Rejected</option> + <option value="ASKED"<!-- TMPL_IF NAME="statusselected_ASKED" --> selected="selected"<!--/TMPL_IF-->>Asked</option> + <option value="ACCEPTED"<!-- TMPL_IF NAME="statusselected_ACCEPTED" --> selected="selected"<!--/TMPL_IF-->>Accepted</option> + <option value="CHECKED"<!-- TMPL_IF NAME="statusselected_CHECKED" --> selected="selected"<!--/TMPL_IF-->>Checked</option> + <option value="REJECTED"<!-- TMPL_IF NAME="statusselected_REJECTED" --> selected="selected"<!--/TMPL_IF-->>Rejected</option> </select> <label for="reason<!-- TMPL_VAR NAME="suggestiontype" -->">with this reason:</label> <select id="reason<!-- TMPL_VAR NAME="suggestiontype" -->" name="reason<!-- TMPL_VAR NAME="suggestiontype" -->"> <option value=""> -- Choose a reason -- </option> @@ -313,8 +315,11 @@ h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di <li><label for="collectiontitle"> Collection Title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="<!-- TMPL_VAR name="collectiontitle"-->" /></li><li><input type="submit" value="Go" /></li></ol> </fieldset> <fieldset class="brief"><h4 class="collapse"><a href="#">Suggestion information</a></h4> - <ol><li><label for="status"> Status:</label><select name="status" id="status"><option value="">Any</option> -<!-- TMPL_LOOP name="status_loop" --><!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="code" -->" selected="selected"><!-- TMPL_VAR name="desc" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="code" -->"><!-- TMPL_VAR name="desc" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP --> + <ol><li><label for="status"> Status:</label><select name="STATUS" id="STATUS"><option value="">Any</option> + <option value="ASKED"<!-- TMPL_IF NAME="statusselected_ASKED" --> selected="selected"<!--/TMPL_IF-->>Asked</option> + <option value="ACCEPTED"<!-- TMPL_IF NAME="statusselected_ACCEPTED" --> selected="selected"<!--/TMPL_IF-->>Accepted</option> + <option value="CHECKED"<!-- TMPL_IF NAME="statusselected_CHECKED" --> selected="selected"<!--/TMPL_IF-->>Checked</option> + <option value="REJECTED"<!-- TMPL_IF NAME="statusselected_REJECTED" --> selected="selected"<!--/TMPL_IF-->>Rejected</option> </select></li> <li><label for="suggestedby"> Suggested By:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option> <!-- TMPL_LOOP name="suggestedby_loop" --><!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="code" -->" selected="selected"><!-- TMPL_VAR name="desc" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="code" -->"><!-- TMPL_VAR name="desc" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP --> diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 26863f3..8d3f80c 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -72,12 +72,15 @@ my $op = $input->param('op')||'else'; my @editsuggestions = $input->param('edit_field'); my $branchfilter = $input->param('branchcode'); my $suggestedby = $input->param('suggestedby'); +my $returnsuggested = $input->param('returnsuggested'); +my $returnsuggestedby = $input->param('returnsuggestedby'); my $managedby = $input->param('managedby'); my $displayby = $input->param('displayby'); my $tabcode = $input->param('tabcode'); # filter informations which are not suggestion related. my $suggestion_ref = $input->Vars; + delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); foreach (keys %$suggestion_ref){ delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' || $op eq 'change')); @@ -199,7 +202,7 @@ if ($op=~/else/) { ); } -foreach my $element qw(managedby suggestedby){ +foreach my $element qw(managedby suggestedby acceptedby) { # $debug || warn $$suggestion_ref{$element}; if ($$suggestion_ref{$element}){ my $member=GetMember(borrowernumber=>$$suggestion_ref{$element}); @@ -220,6 +223,10 @@ $template->param( "op" =>$op, ); +if(defined($returnsuggested) and $returnsuggested ne "noone") +{ + print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=".$returnsuggested."#suggestions"); +} #################### ## Initializing selection lists @@ -258,6 +265,7 @@ foreach my $support(@$supportlist){ } } $template->param(itemtypeloop=>$supportlist); +$template->param( returnsuggestedby => $returnsuggestedby ); my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG",$$suggestion_ref{'patronreason'}); $template->param(patron_reason_loop=>$patron_reason_loop); @@ -271,6 +279,7 @@ foreach my $budget (@$budgets){ }; $template->param( budgetsloop => $budgets); +$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1); # get currencies and rates my @rates = GetCurrencies(); @@ -293,7 +302,7 @@ $template->param( ); my %hashlists; -foreach my $field qw(managedby acceptedby suggestedby budgetid STATUS) { +foreach my $field qw(managedby acceptedby suggestedby budgetid) { my $values_list; $values_list=GetDistinctValues("suggestions.".$field) ; my @codes_list = map{ -- 1.7.1