Bugzilla – Attachment 95231 Details for
Bug 23596
Add ability to modify the suggestions 'reason' field when receiving the item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23596: Edit suggestion's reason when receiving
Bug-23596-Edit-suggestions-reason-when-receiving.patch (text/plain), 7.05 KB, created by
Jonathan Druart
on 2019-11-08 15:28:33 UTC
(
hide
)
Description:
Bug 23596: Edit suggestion's reason when receiving
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-11-08 15:28:33 UTC
Size:
7.05 KB
patch
obsolete
>From c9807d6df7ab2af2e5d0b91e252033a8b1004a9f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 8 Nov 2019 15:50:57 +0100 >Subject: [PATCH] Bug 23596: Edit suggestion's reason when receiving > >This patch displays and let the librarian edit the suggestion.reason >information when receiving an order. > >Note that if no reason was given the edit is not possible (easily >modifiable if needed but it seems that we do not want to display too >much details unnecessarily) > >Test plan: >- Create a suggestion and fill the reason >- Create an order from this suggestion >- Close the basket and start receiving the order >=> The reason is displayed and editable >- Modify the reason and click Save >- Receive again >=> The reason has been correctly modified >- Play with the "Others..." option and give a specific reason > >Sponsored-by: BULAC - http://www.bulac.fr/ >--- > acqui/finishreceive.pl | 9 ++++ > acqui/orderreceive.pl | 10 ++-- > .../prog/en/modules/acqui/orderreceive.tt | 53 +++++++++++++++++++++- > 3 files changed, 65 insertions(+), 7 deletions(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 64aa9f5ad4..fc5bbde8d0 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -56,6 +56,7 @@ my $invoiceno = $invoice->{invoicenumber}; > my $booksellerid = $input->param('booksellerid'); > my $cnt = 0; > my $bookfund = $input->param("bookfund"); >+my $suggestion_id = $input->param("suggestionid"); > my $order = GetOrder($ordernumber); > my $new_ordernumber = $ordernumber; > >@@ -185,4 +186,12 @@ while ( my $item = $items->next ) { > ); > } > >+if ($suggestion_id) { >+ my $reason = $input->param("reason") || ''; >+ my $other_reason = $input->param("other_reason"); >+ $reason = $other_reason if $reason eq 'other'; >+ my $suggestion = Koha::Suggestions->find($suggestion_id); >+ $suggestion->update( { reason => $reason } ) if $suggestion; >+} >+ > print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid&sticky_filters=1"); >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 0b9ef232b6..e813bc271c 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -185,8 +185,6 @@ if( defined $order->{tax_rate_on_receiving} ) { > $tax_rate = $order->{tax_rate_on_ordering} + 0.0; > } > >-my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber}); >- > my $creator = Koha::Patrons->find( $order->{created_by} ); > > my $budget = GetBudget( $order->{budget_id} ); >@@ -251,12 +249,14 @@ $template->param( > datereceived => $datereceived, > order_internalnote => $order_internalnote, > order_vendornote => $order_vendornote, >- suggestionid => $suggestion->{suggestionid}, >- surnamesuggestedby => $suggestion->{surnamesuggestedby}, >- firstnamesuggestedby => $suggestion->{firstnamesuggestedby}, > gst_values => \@gst_values, > ); > >+my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber}); >+if ( $suggestion ) { >+ $template->param( suggestion => $suggestion ); >+} >+ > my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; > my @budget_loop; > my $periods = GetBudgetPeriods( ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index a2159eaf96..d84fc45a35 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -42,13 +42,43 @@ > </ol> > </fieldset> > >- [% IF ( suggestionid ) %] >+ [% IF suggestion %] > <fieldset class="rows"> > <legend>Suggestion</legend> > <ol> > <li> > <span class="label">Suggested by: </span> >- [% surnamesuggestedby | html %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid | uri %]&op=show">suggestion #[% suggestionid | html %]</a>) >+ [% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&op=show">suggestion #[% suggestion.suggestionid | html %]</a>) >+ [% IF suggestion.reason %] >+ <li> >+ <span class="label">Reason:</span> >+ [% SET avs = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %] >+ [% SET other_reason = 1 %] >+ <select class="select-reason" id="reason" name="reason"> >+ <option value=""> -- Choose a reason -- </option> >+ [% FOREACH reason IN suggestion_reasons %] >+ [% IF reason.lib == suggestion.reason %] >+ <option value="[% reason.lib | html %]" selected="selected">[% reason.lib | html %]</option> >+ [% SET other_reason = 0 %] >+ [% ELSE %] >+ <option value="[% reason.lib | html %]">[% reason.lib | html %]</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 | html %]"/> >+ [% 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> >+ >+ <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" /> >+ </li> >+ [% END %] > </li> > </ol> > </fieldset> >@@ -436,6 +466,25 @@ > CheckNItems($(this).val()); > }); > [% END %] >+ >+ [% 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> > [% END %] >-- >2.11.0
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 23596
:
95231
|
95296
|
99030
|
99032
|
99033
|
99036
|
99037
|
99116
|
102802
|
102803
|
102834
|
102835