$("#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>
[% 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>
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;
$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 {
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';
}
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'} ) {