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;
$item->store;
}
+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");
$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} );
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( );
</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>
}
$("select[name='currency']").on("change", function(){update_unitprice()} );
$("#unitprice_currency").on("change", function(){update_unitprice()} );
+
+ [% 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 %]