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

(-)a/C4/Suggestions.pm (+5 lines)
Lines 205-210 sub SearchSuggestion { Link Here
205
        }
205
        }
206
    }
206
    }
207
207
208
    # By default do not search for archived suggestions
209
    unless ( exists $suggestion->{archived} && $suggestion->{archived} ) {
210
        push @query, q{ AND suggestions.archived = 0 };
211
    }
212
208
    $debug && warn "@query";
213
    $debug && warn "@query";
209
    my $sth = $dbh->prepare("@query");
214
    my $sth = $dbh->prepare("@query");
210
    $sth->execute(@sql_params);
215
    $sth->execute(@sql_params);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-6 / +38 lines)
Lines 560-565 Link Here
560
                    [% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate | html %] [% END %]
560
                    [% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate | html %] [% END %]
561
                        [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %]
561
                        [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %]
562
                        [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<div class="note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>[% END %]
562
                        [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<div class="note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>[% END %]
563
                        [% IF suggestions_loo.archived %]<br /><i class="fa fa-archive"> Archived[% END %]
563
                </td>
564
                </td>
564
                <td>
565
                <td>
565
                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamesuggestedby | html %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby | html %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby | html %])[% END %]</a>
566
                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamesuggestedby | html %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby | html %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby | html %])[% END %]</a>
Lines 603-610 Link Here
603
                    [% END %]
604
                    [% END %]
604
                </td>
605
                </td>
605
                <td class="actions">
606
                <td class="actions">
606
                    <a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a>
607
                    <div class="dropup">
607
                    <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
608
                    <div class="btn-group">
609
                        <a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" id="more_actions_[% suggestions_loo.suggestionid | html %]" role="button" data-toggle="dropdown" href="#"><b class="caret"></b></a>
610
                        <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="more_actions_[% suggestions_loo.suggestionid | html %]">
611
                            <li><a class="deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a></li>
612
                            [% UNLESS suggestions_loo.archived %]
613
                                <li><a class="archivesuggestion" href="suggestion.pl?op=archive&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Archive</a></li>
614
                            [% ELSE %]
615
                                <li><a class="unarchivesuggestion" href="suggestion.pl?op=unarchive&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Unarchive</a></li>
616
                            [% END %]
617
                        </ul>
618
                    </div>
619
                    </div>
608
                </td>
620
                </td>
609
        </tr>
621
        </tr>
610
        [% END %]</tbody>
622
        [% END %]</tbody>
Lines 664-669 Link Here
664
                    </div>
676
                    </div>
665
677
666
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
678
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
679
                    <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
667
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset>
680
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset>
668
                </fieldset>
681
                </fieldset>
669
            </div>
682
            </div>
Lines 672-677 Link Here
672
                    <label for="itemtype">Update item types with: </label>
685
                    <label for="itemtype">Update item types with: </label>
673
                    [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20  %]
686
                    [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20  %]
674
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
687
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
688
                    <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
675
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset>
689
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset>
676
                </fieldset>
690
                </fieldset>
677
            </div>
691
            </div>
Lines 683-688 Link Here
683
                    <span id="managedby_name[% loop.count %]"></span>
697
                    <span id="managedby_name[% loop.count %]"></span>
684
                    <input type="hidden" name="suggestion_managedby" id="managedby[% loop.count %]" value="[% logged_in_user.borrowernumber | html %]" />
698
                    <input type="hidden" name="suggestion_managedby" id="managedby[% loop.count %]" value="[% logged_in_user.borrowernumber | html %]" />
685
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
699
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
700
                    <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
686
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_manager"/>Submit</button></fieldset>
701
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_manager"/>Submit</button></fieldset>
687
                </fieldset>
702
                </fieldset>
688
            </div>
703
            </div>
Lines 691-696 Link Here
691
                <fieldset>
706
                <fieldset>
692
                    <label for="delete_[% loop.count %]">Delete selected</label>
707
                    <label for="delete_[% loop.count %]">Delete selected</label>
693
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
708
                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
709
                    <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
694
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset>
710
                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset>
695
                </fieldset>
711
                </fieldset>
696
            </div>
712
            </div>
Lines 742-748 Link Here
742
                    [% ELSE %]
758
                    [% ELSE %]
743
                        <option value="acceptedby">Accepted by</option>
759
                        <option value="acceptedby">Accepted by</option>
744
                    [% END %]
760
                    [% END %]
745
                </select> <input type="submit" value="Go" /></li></ol></fieldset>
761
                </select>
762
                <input type="submit" value="Go" />
763
                </li>
764
                </ol>
765
                </fieldset>
766
746
<h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
767
<h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
747
                <div style="display:block;" id="limits">
768
                <div style="display:block;" id="limits">
748
769
Lines 758-764 Link Here
758
                    <ol>
779
                    <ol>
759
                        <li>
780
                        <li>
760
                            <label for="archived" style="display: inline;">Include archived:</label>
781
                            <label for="archived" style="display: inline;">Include archived:</label>
761
                            <input type="checkbox" id="archived" name="filter_archived" value="archived" title="Include archived suggestions in the search" />
782
                            [% IF filter_archived %]
783
                                <input type="checkbox" id="archived" name="filter_archived" checked="checked" title="Include archived suggestions in the search" />
784
                            [% ELSE %]
785
                                <input type="checkbox" id="archived" name="filter_archived" title="Include archived suggestions in the search" />
786
                            [% END %]
762
                      </li>
787
                      </li>
763
                      <li>
788
                      <li>
764
                          <label for="STATUS"> Status:</label>
789
                          <label for="STATUS"> Status:</label>
Lines 833-839 Link Here
833
                        <label for="accepteddate_to">To:</label>
858
                        <label for="accepteddate_to">To:</label>
834
                        <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" />
859
                        <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" />
835
                    </li>
860
                    </li>
836
                    <li><input type="submit" value="Go" /></li></ol>
861
                    <li>
862
                        <input type="submit" value="Go" />
863
                    </li>
864
                </ol>
837
                </fieldset>
865
                </fieldset>
838
866
839
				<fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
867
				<fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
Lines 857-863 Link Here
857
                        [% ELSE %]
885
                        [% ELSE %]
858
                            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
886
                            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
859
                        [% END %]
887
                        [% END %]
860
                    </select></li><li><input type="submit" value="Go" /></li></ol>
888
                    </select></li>
889
                    <li>
890
                        <input type="submit" value="Go" />
891
                    </li>
892
                </ol>
861
                </fieldset>
893
                </fieldset>
862
            </form>
894
            </form>
863
        [% INCLUDE 'acquisitions-menu.inc' %]
895
        [% INCLUDE 'acquisitions-menu.inc' %]
(-)a/suggestion/suggestion.pl (-4 / +15 lines)
Lines 92-97 my $displayby = $input->param('displayby') || ''; Link Here
92
my $tabcode         = $input->param('tabcode');
92
my $tabcode         = $input->param('tabcode');
93
my $save_confirmed  = $input->param('save_confirmed') || 0;
93
my $save_confirmed  = $input->param('save_confirmed') || 0;
94
my $notify          = $input->param('notify');
94
my $notify          = $input->param('notify');
95
my $filter_archived = $input->param('filter_archived');
95
96
96
my $reasonsloop     = GetAuthorisedValues("SUGGEST");
97
my $reasonsloop     = GetAuthorisedValues("SUGGEST");
97
98
Lines 104-110 my $columns = ' '.join(' ', $schema->source('Suggestion')->columns).' '; Link Here
104
my $suggestion_only = { map { $columns =~ / $_ / ? ($_ => $suggestion_ref->{$_}) : () } keys %$suggestion_ref };
105
my $suggestion_only = { map { $columns =~ / $_ / ? ($_ => $suggestion_ref->{$_}) : () } keys %$suggestion_ref };
105
$suggestion_only->{STATUS} = $suggestion_ref->{STATUS};
106
$suggestion_only->{STATUS} = $suggestion_ref->{STATUS};
106
107
107
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field notify );
108
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode notify filter_archived );
108
foreach (keys %$suggestion_ref){
109
foreach (keys %$suggestion_ref){
109
    delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' ));
110
    delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' ));
110
}
111
}
Lines 289-294 elsif ($op eq "update_status" ) { Link Here
289
    }
290
    }
290
    redirect_with_params($input);
291
    redirect_with_params($input);
291
}
292
}
293
elsif ($op eq "archive" ) {
294
    Koha::Suggestions->find($_)->update({ archived => 1 }) for @editsuggestions;
295
296
    redirect_with_params($input);
297
}
298
elsif ($op eq "unarchive" ) {
299
    Koha::Suggestions->find($_)->update({ archived => 0 }) for @editsuggestions;
300
301
    redirect_with_params($input);
302
}
292
elsif ( $op eq 'update_itemtype' ) {
303
elsif ( $op eq 'update_itemtype' ) {
293
    my $new_itemtype = $input->param('suggestion_itemtype');
304
    my $new_itemtype = $input->param('suggestion_itemtype');
294
    foreach my $suggestionid (@editsuggestions) {
305
    foreach my $suggestionid (@editsuggestions) {
Lines 347-353 if ($op=~/else/) { Link Here
347
        next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ) and ($displayby ne 'branchcode' or $branchfilter ne '__ANY__' );
358
        next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ) and ($displayby ne 'branchcode' or $branchfilter ne '__ANY__' );
348
        $$suggestion_ref{$displayby} = $criteriumvalue;
359
        $$suggestion_ref{$displayby} = $criteriumvalue;
349
360
350
        my $suggestions = &SearchSuggestion($suggestion_ref);
361
        my $suggestions = &SearchSuggestion({ %$suggestion_ref, archived => $filter_archived });
351
        foreach my $suggestion (@$suggestions) {
362
        foreach my $suggestion (@$suggestions) {
352
            if ($suggestion->{budgetid}){
363
            if ($suggestion->{budgetid}){
353
                my $bud = GetBudget( $suggestion->{budgetid} );
364
                my $bud = GetBudget( $suggestion->{budgetid} );
Lines 378-383 $template->param( Link Here
378
389
379
$template->param(
390
$template->param(
380
    %$suggestion_ref,
391
    %$suggestion_ref,
392
    filter_archived => $filter_archived,
381
    "op"             =>$op,
393
    "op"             =>$op,
382
);
394
);
383
395
Lines 456-462 sub redirect_with_params { Link Here
456
        displayby branchcode title author isbn publishercode copyrightdate
468
        displayby branchcode title author isbn publishercode copyrightdate
457
        collectiontitle suggestedby suggesteddate_from suggesteddate_to
469
        collectiontitle suggestedby suggesteddate_from suggesteddate_to
458
        manageddate_from manageddate_to accepteddate_from
470
        manageddate_from manageddate_to accepteddate_from
459
        accepteddate_to budgetid
471
        accepteddate_to budgetid filter_archived
460
        )
472
        )
461
      )
473
      )
462
    {
474
    {
463
- 

Return to bug 22784