@@ -, +, @@ - Create a suggestion and fill the reason - Create an order from this suggestion - Close the basket and start receiving the order - Modify the reason and click Save - Receive again - Play with the "Others..." option and give a specific reason --- acqui/finishreceive.pl | 9 ++++ acqui/orderreceive.pl | 10 ++-- .../prog/en/modules/acqui/orderreceive.tt | 53 +++++++++++++++++++++- 3 files changed, 65 insertions(+), 7 deletions(-) --- a/acqui/finishreceive.pl +++ a/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"); --- a/acqui/orderreceive.pl +++ a/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( ); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -42,13 +42,43 @@ - [% IF ( suggestionid ) %] + [% IF suggestion %]
Suggestion
  1. Suggested by: - [% surnamesuggestedby | html %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby | html %][% END %] (suggestion #[% suggestionid | html %]) + [% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (suggestion #[% suggestion.suggestionid | html %]) + [% IF suggestion.reason %] +
  2. + Reason: + [% SET avs = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %] + [% SET other_reason = 1 %] + + + + [% IF other_reason %] + + [% ELSE %] + + [% END %] + Cancel + + + +
  3. + [% END %]
@@ -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(); + }); + }); [% END %] --