@@ -, +, @@ suggestions --- C4/Suggestions.pm | 5 +++ .../prog/en/modules/suggestion/suggestion.tt | 44 +++++++++++++++++++--- suggestion/suggestion.pl | 18 +++++++-- 3 files changed, 58 insertions(+), 9 deletions(-) --- a/C4/Suggestions.pm +++ a/C4/Suggestions.pm @@ -207,6 +207,11 @@ sub SearchSuggestion { } } + # By default do not search for archived suggestions + unless ( exists $suggestion->{archived} && $suggestion->{archived} ) { + push @query, q{ AND suggestions.archived = 0 }; + } + $debug && warn "@query"; my $sth = $dbh->prepare("@query"); $sth->execute(@sql_params); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -560,6 +560,7 @@ [% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate | html %] [% END %] [% IF ( suggestions_loo.volumedesc ) %]; Volume:[% suggestions_loo.volumedesc | html %] [% END %] [% IF ( suggestions_loo.isbn ) %]; ISBN:[% suggestions_loo.isbn | html %] [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in [% suggestions_loo.publicationyear | html %] [% END %][% IF ( suggestions_loo.place ) %] in [% suggestions_loo.place | html %] [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]
[% IF ( suggestions_loo.note ) %]
[% suggestions_loo.note | html %]
[% END %] + [% IF suggestions_loo.archived %]
Archived[% END %] [% suggestions_loo.surnamesuggestedby | html %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby | html %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby | html %])[% END %] @@ -603,8 +604,19 @@ [% END %] - Edit - Delete +
+
+ Edit + +
+
[% END %] @@ -664,6 +676,7 @@ +
@@ -672,6 +685,7 @@ [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20 %] +
@@ -683,6 +697,7 @@ +
@@ -691,6 +706,7 @@
+
@@ -742,7 +758,12 @@ [% ELSE %] [% END %] - + + + + + +

Filter by: [clear]

@@ -758,7 +779,11 @@
  1. - + [% IF filter_archived %] + + [% ELSE %] + + [% END %]
  2. @@ -833,7 +858,10 @@
  3. -
+
  • + +
  • +

    Acquisition information

    @@ -857,7 +885,11 @@ [% ELSE %] [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %] [% END %] -
  • + +
  • + +
  • +
    [% INCLUDE 'acquisitions-menu.inc' %] --- a/suggestion/suggestion.pl +++ a/suggestion/suggestion.pl @@ -93,6 +93,7 @@ my $displayby = $input->param('displayby') || ''; my $tabcode = $input->param('tabcode'); my $save_confirmed = $input->param('save_confirmed') || 0; my $notify = $input->param('notify'); +my $filter_archived = $input->param('filter_archived'); my $reasonsloop = GetAuthorisedValues("SUGGEST"); @@ -105,7 +106,7 @@ my $columns = ' '.join(' ', $schema->source('Suggestion')->columns).' '; my $suggestion_only = { map { $columns =~ / $_ / ? ($_ => $suggestion_ref->{$_}) : () } keys %$suggestion_ref }; $suggestion_only->{STATUS} = $suggestion_ref->{STATUS}; -delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field notify ); +delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode notify filter_archived ); foreach (keys %$suggestion_ref){ delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' )); } @@ -290,6 +291,16 @@ elsif ($op eq "update_status" ) { } redirect_with_params($input); } +elsif ($op eq "archive" ) { + Koha::Suggestions->find($_)->update({ archived => 1 }) for @editsuggestions; + + redirect_with_params($input); +} +elsif ($op eq "unarchive" ) { + Koha::Suggestions->find($_)->update({ archived => 0 }) for @editsuggestions; + + redirect_with_params($input); +} elsif ( $op eq 'update_itemtype' ) { my $new_itemtype = $input->param('suggestion_itemtype'); foreach my $suggestionid (@editsuggestions) { @@ -348,7 +359,7 @@ if ($op=~/else/) { next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ) and ($displayby ne 'branchcode' or $branchfilter ne '__ANY__' ); $$suggestion_ref{$displayby} = $criteriumvalue; - my $suggestions = &SearchSuggestion($suggestion_ref); + my $suggestions = &SearchSuggestion({ %$suggestion_ref, archived => $filter_archived }); foreach my $suggestion (@$suggestions) { if ($suggestion->{budgetid}){ my $bud = GetBudget( $suggestion->{budgetid} ); @@ -379,6 +390,7 @@ $template->param( $template->param( %$suggestion_ref, + filter_archived => $filter_archived, "op" =>$op, ); @@ -464,7 +476,7 @@ sub redirect_with_params { displayby branchcode title author isbn publishercode copyrightdate collectiontitle suggestedby suggesteddate_from suggesteddate_to manageddate_from manageddate_to accepteddate_from - accepteddate_to budgetid + accepteddate_to budgetid filter_archived ) ) { --