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

(-)a/C4/Suggestions.pm (-3 / +3 lines)
Lines 121-127 sub SearchSuggestion { Link Here
121
        push @sql_params,'%'.$s.'%'; 
121
        push @sql_params,'%'.$s.'%'; 
122
        " and suggestions.$_ like ? ";
122
        " and suggestions.$_ like ? ";
123
        } else { () }
123
        } else { () }
124
    } qw( title author isbn publishercode collectiontitle )
124
    } qw( title author isbn publishercode copyrightdate collectiontitle )
125
    );
125
    );
126
126
127
    my $userenv = C4::Context->userenv;
127
    my $userenv = C4::Context->userenv;
Lines 137-143 sub SearchSuggestion { Link Here
137
    foreach my $field (grep { my $fieldname=$_;
137
    foreach my $field (grep { my $fieldname=$_;
138
        any {$fieldname eq $_ } qw<
138
        any {$fieldname eq $_ } qw<
139
    STATUS branchcode itemtype suggestedby managedby acceptedby
139
    STATUS branchcode itemtype suggestedby managedby acceptedby
140
    bookfundid biblionumber
140
    budgetid biblionumber
141
    >} keys %$suggestion
141
    >} keys %$suggestion
142
    ) {
142
    ) {
143
        if ($$suggestion{$field}){
143
        if ($$suggestion{$field}){
Lines 155-161 sub SearchSuggestion { Link Here
155
        my $from = $_ . "_from";
155
        my $from = $_ . "_from";
156
        my $to = $_ . "_to";
156
        my $to = $_ . "_to";
157
        if ($$suggestion{$from} || $$suggestion{$to}) {
157
        if ($$suggestion{$from} || $$suggestion{$to}) {
158
            push @query, " AND suggestions.suggesteddate BETWEEN '" 
158
            push @query, " AND suggestions.$_ BETWEEN '" 
159
                . (format_date_in_iso($$suggestion{$from}) || 0000-00-00) . "' AND '" . (format_date_in_iso($$suggestion{$to}) || $today) . "'";
159
                . (format_date_in_iso($$suggestion{$from}) || 0000-00-00) . "' AND '" . (format_date_in_iso($$suggestion{$to}) || $today) . "'";
160
        } 
160
        } 
161
    }
161
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-10 / +10 lines)
Lines 493-499 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
493
                    <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author %]" /></li>
493
                    <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author %]" /></li>
494
                    <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn %]" /></li>
494
                    <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn %]" /></li>
495
                    <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode %]" /></li>
495
                    <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode %]" /></li>
496
                    <li><label for="publicationyear"> Publication year:</label><input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear %]" /></li>
496
                    <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate %]" /></li>
497
                    <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle %]" /></li><li><input type="submit" value="Go" /></li></ol>
497
                    <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle %]" /></li><li><input type="submit" value="Go" /></li></ol>
498
                </fieldset>
498
                </fieldset>
499
				 <fieldset class="brief"><h4 class="collapse"><a href="#">Suggestion information</a></h4>
499
				 <fieldset class="brief"><h4 class="collapse"><a href="#">Suggestion information</a></h4>
Lines 511-549 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
511
                    <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
511
                    <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
512
[% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
512
[% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
513
                                                                     </select></li>
513
                                                                     </select></li>
514
                    <li><label for="suggesteddate_from"> Suggested on:</label>[% suggesteddate %]
514
                    <li><label for="suggesteddate_from"> Suggested on:</label>
515
                        <table class="invis">
515
                        <table class="invis">
516
                        <tr>
516
                        <tr>
517
                        <td><label for="suggesteddate_from">from:</label></td><td><input type="text" id="suggesteddate_from" name="suggesteddate_from" style="width:80px;" /></td>
517
                        <td><label for="suggesteddate_from">from:</label></td><td><input type="text" id="suggesteddate_from" name="suggesteddate_from" value="[% suggesteddate_from %]" style="width:80px;" /></td>
518
                        </tr>
518
                        </tr>
519
                        <tr>
519
                        <tr>
520
                        <td><label for="suggesteddate_to">to:</label></td><td><input type="text" id="suggesteddate_to" name="suggesteddate_to" style="width:80px;" /></td>
520
                        <td><label for="suggesteddate_to">to:</label></td><td><input type="text" id="suggesteddate_to" name="suggesteddate_to" value="[% suggesteddate_to %]" style="width:80px;" /></td>
521
                        </tr>
521
                        </tr>
522
                        </table>
522
                        </table>
523
                    </li>
523
                    </li>
524
                    <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
524
                    <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
525
[% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code %]" selected="selected">[% managedby_loo.desc %]</option>[% ELSE %]<option value="[% managedby_loo.code %]">[% managedby_loo.desc %]</option>[% END %][% END %]
525
[% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code %]" selected="selected">[% managedby_loo.desc %]</option>[% ELSE %]<option value="[% managedby_loo.code %]">[% managedby_loo.desc %]</option>[% END %][% END %]
526
                                                                     </select></li>
526
                                                                     </select></li>
527
                    <li><label for="manageddate_from"> Management date:</label>[% manageddate %]
527
                    <li><label for="manageddate_from"> Management date:</label>
528
                        <table class="invis">
528
                        <table class="invis">
529
                        <tr>
529
                        <tr>
530
                        <td><label for="manageddate_from">from:</label></td><td><input type="text" id="manageddate_from" name="manageddate_from" style="width:80px;" /></td>
530
                        <td><label for="manageddate_from">from:</label></td><td><input type="text" id="manageddate_from" name="manageddate_from" value="[% manageddate_from %]" style="width:80px;" /></td>
531
                        </tr>
531
                        </tr>
532
                        <tr>
532
                        <tr>
533
                        <td><label for="manageddate_to">to:</label></td><td><input type="text" id="manageddate_to" name="manageddate_to" style="width:80px;" /></td>
533
                        <td><label for="manageddate_to">to:</label></td><td><input type="text" id="manageddate_to" name="manageddate_to" value="[% manageddate_to %]" style="width:80px;" /></td>
534
                        </tr>
534
                        </tr>
535
                        </table>
535
                        </table>
536
                    </li>
536
                    </li>
537
                    <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
537
                    <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
538
[% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code %]" selected="selected">[% acceptedby_loo.desc %]</option>[% ELSE %]<option value="[% acceptedby_loo.code %]">[% acceptedby_loo.desc %]</option>[% END %][% END %]
538
[% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code %]" selected="selected">[% acceptedby_loo.desc %]</option>[% ELSE %]<option value="[% acceptedby_loo.code %]">[% acceptedby_loo.desc %]</option>[% END %][% END %]
539
		                                      </select></li>
539
		                                      </select></li>
540
                    <li><label for="accepteddate_from"> Accepted on:</label>[% accepteddate %]
540
                    <li><label for="accepteddate_from"> Accepted on:</label>
541
                        <table class="invis">
541
                        <table class="invis">
542
                        <tr>
542
                        <tr>
543
                        <td><label for="accepteddate_from">from:</label></td><td><input type="text" id="accepteddate_from" name="accepteddate_from" style="width:80px;" /></td>
543
                        <td><label for="accepteddate_from">from:</label></td><td><input type="text" id="accepteddate_from" name="accepteddate_from" value="[% accepteddate_from %]" style="width:80px;" /></td>
544
                        </tr>
544
                        </tr>
545
                        <tr>
545
                        <tr>
546
                        <td><label for="accepteddate_to">to:</label></td><td><input type="text" id="accepteddate_to" name="accepteddate_to" style="width:80px;" /></td>
546
                        <td><label for="accepteddate_to">to:</label></td><td><input type="text" id="accepteddate_to" name="accepteddate_to" value="[% accepteddate_to %]" style="width:80px;" /></td>
547
                        </tr>
547
                        </tr>
548
                        </table>
548
                        </table>
549
                    </li>
549
                    </li>
(-)a/suggestion/suggestion.pl (-3 / +17 lines)
Lines 190-199 if ($op=~/else/) { Link Here
190
    
190
    
191
    $displayby||="STATUS";
191
    $displayby||="STATUS";
192
    delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode");
192
    delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode");
193
    # distinct values of display by
193
    my $criteria_list=GetDistinctValues("suggestions.".$displayby);
194
    my $criteria_list=GetDistinctValues("suggestions.".$displayby);
195
    my (@criteria_dv, $criteria_has_empty);
196
    foreach (@$criteria_list) {
197
        if ($_->{value}) {
198
            push @criteria_dv, $_->{value};
199
        } else {
200
            $criteria_has_empty = 1;
201
        }
202
    }
203
    # agregate null and empty values under empty value
204
    push @criteria_dv, '' if $criteria_has_empty;
205
    
194
    my @allsuggestions;
206
    my @allsuggestions;
195
    my $reasonsloop = GetAuthorisedValues("SUGGEST");
207
    my $reasonsloop = GetAuthorisedValues("SUGGEST");
196
    foreach my $criteriumvalue ( map { $$_{'value'} } @$criteria_list ) {
208
    foreach my $criteriumvalue ( @criteria_dv ) {
197
        # By default, display suggestions from current working branch
209
        # By default, display suggestions from current working branch
198
        if(not defined $branchfilter) {
210
        if(not defined $branchfilter) {
199
            $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'};
211
            $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'};
Lines 356-370 $template->param( Link Here
356
	total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
368
	total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
357
);
369
);
358
370
371
# lists of distinct values (without empty) for filters
359
my %hashlists;
372
my %hashlists;
360
foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) {
373
foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) {
361
    my $values_list;
374
    my $values_list;
362
    $values_list = GetDistinctValues( "suggestions." . $field );
375
    $values_list = GetDistinctValues( "suggestions." . $field );
363
    my @codes_list = map {
376
    my @codes_list = map {
364
        {   'code' => $$_{'value'},
377
        {   'code' => $$_{'value'},
365
            'desc' => GetCriteriumDesc( $$_{'value'}, $field ),
378
            'desc' => GetCriteriumDesc( $$_{'value'}, $field ) || $$_{'value'},
366
            'selected' => ($$suggestion_ref{$field}) ? $$_{'value'} eq $$suggestion_ref{$field} : 0,
379
            'selected' => ($$suggestion_ref{$field}) ? $$_{'value'} eq $$suggestion_ref{$field} : 0,
367
        }
380
        }
381
    } grep {
382
        $$_{'value'}
368
    } @$values_list;
383
    } @$values_list;
369
    $hashlists{ lc($field) . "_loop" } = \@codes_list;
384
    $hashlists{ lc($field) . "_loop" } = \@codes_list;
370
}
385
}
371
- 

Return to bug 8443