View | Details | Raw Unified | Return to bug 18399
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (+41 lines)
Lines 172-177 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
172
            $("#quantity,#price,#currency").on("change",function(){
172
            $("#quantity,#price,#currency").on("change",function(){
173
                calcNewsuggTotal();
173
                calcNewsuggTotal();
174
            });
174
            });
175
176
            [% IF other_reason %]
177
                $(".select-reason").hide();
178
                $(".select-reason").find("option[value='other']").attr("selected","selected");
179
                $("#other_reason").show();
180
            [% ELSE %]
181
                $("#other_reason").hide();
182
            [% END %]
183
            $(".select-reason").change(function(){
184
                if($(this).val() == "other"){
185
                    $(this).hide();
186
                    $(this).next("#other_reason").show();
187
                }
188
            });
189
            $("a[href*=back]").click(function(){
190
                $(".select-reason").show().find("option[value='']").attr("selected","selected");
191
                $("#other_reason").hide();
192
            });
175
        });
193
        });
176
        // ]]>
194
        // ]]>
177
    </script>
195
    </script>
Lines 457-462 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
457
                        [% END %]
475
                        [% END %]
458
                    </select>
476
                    </select>
459
                </li>
477
                </li>
478
                <li>
479
                    <label for="reason">Reason</label>
480
                    <select class="select-reason" id="reason" name="reason">
481
                        <option value=""> -- Choose a reason -- </option>
482
                        [% FOREACH reasonsloo IN suggestion.reasonsloop %]
483
                            [% IF (reasonsloo.lib == suggestion.reason) %]
484
                                <option value="[% reasonsloo.lib %]" selected="selected">[% reasonsloo.lib %]</option>
485
                            [% ELSE %]
486
                                <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
487
                            [% END %]
488
                        [% END %]
489
                        <option value="other">Others...</option>
490
                    </select>
491
492
                    <span id="other_reason" name="other_reason">
493
                        [% IF other_reason %]
494
                            <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason%]"/>
495
                        [% ELSE %]
496
                            <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
497
                        [% END %]
498
                        <a href="#back">Cancel</a>
499
                    </span>
500
                </li>
460
            [% END %]
501
            [% END %]
461
        <li><table>
502
        <li><table>
462
            <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
503
            <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
(-)a/suggestion/suggestion.pl (-2 / +16 lines)
Lines 92-97 my $returnsuggested = $input->param('returnsuggested'); Link Here
92
my $managedby       = $input->param('managedby');
92
my $managedby       = $input->param('managedby');
93
my $displayby       = $input->param('displayby') || '';
93
my $displayby       = $input->param('displayby') || '';
94
my $tabcode         = $input->param('tabcode');
94
my $tabcode         = $input->param('tabcode');
95
my $reasonsloop     = GetAuthorisedValues("SUGGEST");
95
96
96
# filter informations which are not suggestion related.
97
# filter informations which are not suggestion related.
97
my $suggestion_ref  = $input->Vars;
98
my $suggestion_ref  = $input->Vars;
Lines 133-138 if ( $op =~ /save/i ) { Link Here
133
        $suggestion_only->{manageddate} = dt_from_string;
134
        $suggestion_only->{manageddate} = dt_from_string;
134
        $suggestion_only->{"managedby"}   = C4::Context->userenv->{number};
135
        $suggestion_only->{"managedby"}   = C4::Context->userenv->{number};
135
    }
136
    }
137
138
    my $otherreason = $input->param('other_reason');
139
    if ($suggestion_only->{reason} eq 'other' && $otherreason) {
140
        $suggestion_only->{reason} = $otherreason;
141
    }
142
136
    if ( $suggestion_only->{'suggestionid'} > 0 ) {
143
    if ( $suggestion_only->{'suggestionid'} > 0 ) {
137
        &ModSuggestion($suggestion_only);
144
        &ModSuggestion($suggestion_only);
138
    } else {
145
    } else {
Lines 169-174 elsif ($op=~/add/) { Link Here
169
elsif ($op=~/edit/) {
176
elsif ($op=~/edit/) {
170
    #Edit suggestion  
177
    #Edit suggestion  
171
    $suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'});
178
    $suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'});
179
    $suggestion_ref->{reasonsloop} = $reasonsloop;
180
    my $other_reason = 1;
181
    foreach my $reason ( @{ $reasonsloop } ) {
182
        if ($suggestion_ref->{reason} eq $reason->{lib}) {
183
            $other_reason = 0;
184
        }
185
    }
186
    $other_reason = 0 unless $suggestion_ref->{reason};
187
    $template->param(other_reason => $other_reason);
172
    Init($suggestion_ref);
188
    Init($suggestion_ref);
173
    $op ='save';
189
    $op ='save';
174
}  
190
}  
Lines 243-249 if ($op=~/else/) { Link Here
243
    push @criteria_dv, '' if $criteria_has_empty;
259
    push @criteria_dv, '' if $criteria_has_empty;
244
260
245
    my @allsuggestions;
261
    my @allsuggestions;
246
    my $reasonsloop = GetAuthorisedValues("SUGGEST");
247
    foreach my $criteriumvalue ( @criteria_dv ) {
262
    foreach my $criteriumvalue ( @criteria_dv ) {
248
        # By default, display suggestions from current working branch
263
        # By default, display suggestions from current working branch
249
        unless ( exists $$suggestion_ref{'branchcode'} ) {
264
        unless ( exists $$suggestion_ref{'branchcode'} ) {
250
- 

Return to bug 18399