Bugzilla – Attachment 102781 Details for
Bug 22784
Add the ability to archive purchase suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug-22784-Add-the-ability-to-archiveunarchive-a-pu.patch (text/plain), 13.38 KB, created by
Katrin Fischer
on 2020-04-12 23:10:04 UTC
(
hide
)
Description:
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-04-12 23:10:04 UTC
Size:
13.38 KB
patch
obsolete
>From 1673d3b7045c9c8a96ff4be949a7644e90e666e6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 13 Nov 2019 16:34:56 +0100 >Subject: [PATCH] Bug 22784: Add the ability to archive/unarchive a purchase > suggestions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >There are performance issues when searching suggestions if there are >thousands of suggestions. >To prevent that we are going to add the ability to archive purchase >suggestions, in order to remove them from the search list (by default). > >Test plan: >0. Apply all the patches, execute the updatedatabase.pl script, restart >all >1. Create some suggestions >2. Search for them >3. Use the "Archive" action button for one of them >4. Restart the search >=> The archived suggestion does no longer appear in the list >5. Use the filter "Included archived" in the "Suggestion information" >filter box >=> The archived suggestion is now displayed >6. Use other filters >=> The "archived" filter is kept from one search to another >7. Use one of the action at the bottom of the suggestion list (change >the status for instance) >=> The "archived" filter is still kept > >Sponsored-by: BULAC - http://www.bulac.fr/ >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Suggestions.pm | 5 +++ > .../prog/en/modules/suggestion/suggestion.tt | 46 +++++++++++++++++++--- > suggestion/suggestion.pl | 18 +++++++-- > 3 files changed, 61 insertions(+), 8 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 8d5336063c..50f5ad9a0e 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -205,6 +205,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); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index af3659c5ca..730a73719a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -573,6 +573,7 @@ > [% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate | html %] [% END %] > [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %] > [% 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 %] >+ [% IF suggestions_loo.archived %]<br /><i class="fa fa-archive"> Archived[% END %] > </td> > <td> > <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> >@@ -622,8 +623,19 @@ > [% END %] > </td> > <td class="actions"> >- <a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&op=edit"><i class="fa fa-pencil"></i> Edit</a> >- <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a> >+ <div class="dropup"> >+ <div class="btn-group"> >+ <a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&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> >+ <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="more_actions_[% suggestions_loo.suggestionid | html %]"> >+ <li><a class="deletesuggestion" href="suggestion.pl?op=delete&suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a></li> >+ [% UNLESS suggestions_loo.archived %] >+ <li><a class="archivesuggestion" href="suggestion.pl?op=archive&suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Archive</a></li> >+ [% ELSE %] >+ <li><a class="unarchivesuggestion" href="suggestion.pl?op=unarchive&suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Unarchive</a></li> >+ [% END %] >+ </ul> >+ </div> >+ </div> > </td> > </tr> > [% END %]</tbody> >@@ -683,6 +695,7 @@ > </div> > > <input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> >+ <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" /> > <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset> > </fieldset> > </div> >@@ -691,6 +704,7 @@ > <label for="itemtype">Update item types with: </label> > [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20 %] > <input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> >+ <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" /> > <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset> > </fieldset> > </div> >@@ -702,6 +716,7 @@ > <span id="managedby_name[% loop.count | html %]"></span> > <input type="hidden" name="suggestion_managedby" id="managedby[% loop.count | html %]" value="[% logged_in_user.borrowernumber | html %]" /> > <input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> >+ <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" /> > <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_manager"/>Submit</button></fieldset> > </fieldset> > </div> >@@ -710,6 +725,7 @@ > <fieldset> > <label for="delete_[% loop.count | html %]">Delete selected</label> > <input type="hidden" name="branchcode" value="[% branchfilter | html %]" /> >+ <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" /> > <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset> > </fieldset> > </div> >@@ -761,7 +777,12 @@ > [% ELSE %] > <option value="acceptedby">Accepted by</option> > [% END %] >- </select> <input type="submit" value="Go" /></li></ol></fieldset> >+ </select> >+ <input type="submit" value="Go" /> >+ </li> >+ </ol> >+ </fieldset> >+ > <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4> > <div style="display:block;" id="limits"> > >@@ -775,6 +796,14 @@ > </fieldset> > <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4> > <ol> >+ <li> >+ <label for="archived" style="display: inline;">Include archived:</label> >+ [% IF filter_archived %] >+ <input type="checkbox" id="archived" name="filter_archived" checked="checked" title="Include archived suggestions in the search" /> >+ [% ELSE %] >+ <input type="checkbox" id="archived" name="filter_archived" title="Include archived suggestions in the search" /> >+ [% END %] >+ </li> > <li> > <label for="STATUS"> Status:</label> > >@@ -848,7 +877,10 @@ > <label for="accepteddate_to">To:</label> > <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" /> > </li> >- <li><input type="submit" value="Go" /></li></ol> >+ <li> >+ <input type="submit" value="Go" /> >+ </li> >+ </ol> > </fieldset> > > <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4> >@@ -872,7 +904,11 @@ > [% ELSE %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %] > [% END %] >- </select></li><li><input type="submit" value="Go" /></li></ol> >+ </select></li> >+ <li> >+ <input type="submit" value="Go" /> >+ </li> >+ </ol> > </fieldset> > </form> > [% INCLUDE 'acquisitions-menu.inc' %] >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 6a80310a92..cdfa5fb817 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -92,6 +92,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"); > >@@ -104,7 +105,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' )); > } >@@ -288,6 +289,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) { >@@ -346,7 +357,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} ); >@@ -377,6 +388,7 @@ $template->param( > > $template->param( > %$suggestion_ref, >+ filter_archived => $filter_archived, > "op" =>$op, > ); > >@@ -455,7 +467,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 > ) > ) > { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22784
:
95499
|
95500
|
95501
|
95502
|
95510
|
95511
|
95512
|
95513
|
95533
|
95534
|
95535
|
95536
|
95537
|
95538
|
96900
|
96901
|
96902
|
96903
|
96904
|
96905
|
100806
|
100807
|
100808
|
100809
|
100810
|
100811
|
100854
|
100855
|
100856
|
100857
|
100858
|
100859
|
101948
|
102779
|
102780
| 102781 |
102782
|
102783
|
102784
|
102785
|
102786
|
102944