Bugzilla – Attachment 67885 Details for
Bug 18399
Add reasons on edit suggestion page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18399 - Add reasons in edit suggestion page
Bug-18399---Add-reasons-in-edit-suggestion-page.patch (text/plain), 5.98 KB, created by
Nick Clemens
on 2017-10-10 16:21:15 UTC
(
hide
)
Description:
Bug 18399 - Add reasons in edit suggestion page
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2017-10-10 16:21:15 UTC
Size:
5.98 KB
patch
obsolete
>From 5e08fe78ada2a23ab889fe4e806b2ed75d7360b6 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Wed, 4 Oct 2017 15:04:15 +0000 >Subject: [PATCH] Bug 18399 - Add reasons in edit suggestion page > >Test plan: > > - Fill the authorised values's category 'SUGGEST' with reason > - Edit a pending suggestion. Set the status to rejected > and select a reason > - Check the reason has been saved (i.e in the suggestions > table of rejected tab) > - Check in the corresponding message_queue that the reason > is here > - Re-edit the same suggestion > - Check that the correct reason is selected by defaut > - Edit an other pending suggetion. Set the status to rejected, > select other reason and fill the input text > - Re-edit the previews suggestion and make sure the input > "other" is displayed by default with the correct value > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/en/modules/suggestion/suggestion.tt | 41 ++++++++++++++++++++++ > suggestion/suggestion.pl | 17 ++++++++- > 2 files changed, 57 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 89f9271..25e04b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -172,6 +172,24 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o > $("#quantity,#price,#currency").on("change",function(){ > calcNewsuggTotal(); > }); >+ >+ [% IF other_reason %] >+ $(".select-reason").hide(); >+ $(".select-reason").find("option[value='other']").attr("selected","selected"); >+ $("#other_reason").show(); >+ [% ELSE %] >+ $("#other_reason").hide(); >+ [% END %] >+ $(".select-reason").change(function(){ >+ if($(this).val() == "other"){ >+ $(this).hide(); >+ $("#other_reason").show(); >+ } >+ }); >+ $("a[href*=back]").click(function(){ >+ $(".select-reason").show().find("option[value='']").attr("selected","selected"); >+ $("#other_reason").hide(); >+ }); > }); > // ]]> > </script> >@@ -457,6 +475,29 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o > [% END %] > </select> > </li> >+ <li> >+ <label for="reason">Reason</label> >+ <select class="select-reason" id="reason" name="reason"> >+ <option value=""> -- Choose a reason -- </option> >+ [% FOREACH reasonsloo IN suggestion.reasonsloop %] >+ [% IF (reasonsloo.lib == suggestion.reason) %] >+ <option value="[% reasonsloo.lib %]" selected="selected">[% reasonsloo.lib %]</option> >+ [% ELSE %] >+ <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option> >+ [% END %] >+ [% END %] >+ <option value="other">Others...</option> >+ </select> >+ >+ <span id="other_reason" name="other_reason"> >+ [% IF other_reason %] >+ <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason%]"/> >+ [% ELSE %] >+ <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." /> >+ [% END %] >+ <a href="#back">Cancel</a> >+ </span> >+ </li> > [% END %] > <li><table> > <thead><tr><th> </th><th>Date</th><th>By</th></tr></thead> >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 929e65a..94e6eab 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -92,6 +92,7 @@ my $returnsuggested = $input->param('returnsuggested'); > my $managedby = $input->param('managedby'); > my $displayby = $input->param('displayby') || ''; > my $tabcode = $input->param('tabcode'); >+my $reasonsloop = GetAuthorisedValues("SUGGEST"); > > # filter informations which are not suggestion related. > my $suggestion_ref = $input->Vars; >@@ -133,6 +134,12 @@ if ( $op =~ /save/i ) { > $suggestion_only->{manageddate} = dt_from_string; > $suggestion_only->{"managedby"} = C4::Context->userenv->{number}; > } >+ >+ my $otherreason = $input->param('other_reason'); >+ if ($suggestion_only->{reason} eq 'other' && $otherreason) { >+ $suggestion_only->{reason} = $otherreason; >+ } >+ > if ( $suggestion_only->{'suggestionid'} > 0 ) { > &ModSuggestion($suggestion_only); > } else { >@@ -169,6 +176,15 @@ elsif ($op=~/add/) { > elsif ($op=~/edit/) { > #Edit suggestion > $suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'}); >+ $suggestion_ref->{reasonsloop} = $reasonsloop; >+ my $other_reason = 1; >+ foreach my $reason ( @{ $reasonsloop } ) { >+ if ($suggestion_ref->{reason} eq $reason->{lib}) { >+ $other_reason = 0; >+ } >+ } >+ $other_reason = 0 unless $suggestion_ref->{reason}; >+ $template->param(other_reason => $other_reason); > Init($suggestion_ref); > $op ='save'; > } >@@ -243,7 +259,6 @@ if ($op=~/else/) { > push @criteria_dv, '' if $criteria_has_empty; > > my @allsuggestions; >- my $reasonsloop = GetAuthorisedValues("SUGGEST"); > foreach my $criteriumvalue ( @criteria_dv ) { > # By default, display suggestions from current working branch > unless ( exists $$suggestion_ref{'branchcode'} ) { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18399
:
63384
|
67608
|
67609
|
67633
|
67635
|
67832
| 67885 |
67935