From 18b3446a15e191031c6eb96ea6783985d4cf31b3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 18 Sep 2014 10:23:47 +0200 Subject: [PATCH] Bug 12775: Suggestions should be ordered by anyone Currently only the suggestion manager can order from accepted suggestion. This patch set to default the ability to show all suggestions when ordering from a suggestion. 2 links "show only mine" and "show all" permits to filter/show all permissions. Test plan: Create an order from a suggestion and verify you are able to see all suggestions by default. Verify the "show only mine" link works as expected. --- acqui/newordersuggestion.pl | 16 +++++++++------- .../prog/en/modules/acqui/newordersuggestion.tt | 10 ++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index 21ac988..b360b70 100755 --- a/acqui/newordersuggestion.pl +++ b/acqui/newordersuggestion.pl @@ -128,19 +128,21 @@ if ( $op eq 'connectDuplicate' ) { } # getting all suggestions. -my $suggestions_loop = - &SearchSuggestion( - { managedby => $borrowernumber, - author => $author, - title => $title, - publishercode => $publishercode, - STATUS => 'ACCEPTED'}); +my $suggestions_loop = SearchSuggestion( + { + author => $author, + title => $title, + publishercode => $publishercode, + STATUS => 'ACCEPTED' + } +); my $vendor = GetBookSellerFromId($booksellerid); $template->param( suggestions_loop => $suggestions_loop, basketno => $basketno, booksellerid => $booksellerid, name => $vendor->{'name'}, + loggedinuser => $borrowernumber, "op_$op" => 1, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt index 2b30eba..9411489 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt @@ -8,10 +8,17 @@ $(document).ready(function() { var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ + { "aTargets": [ 0 ], "bVisible": false, "bSearchable": false }, { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, ], "sPaginationType": "four_button" } ) ); + $("#show_only_mine").on('click', function(){ + suggestionst.fnFilter('^[% loggedinuser %]$', 0, true); + }); + $("#show_all").on('click', function(){ + suggestionst.fnFilter('', 0 ); + }); }); //]]> @@ -30,9 +37,11 @@

Suggestions

[% IF ( suggestions_loop ) %] + Show only mine | Show all suggestions + @@ -42,6 +51,7 @@ [% FOREACH suggestions_loo IN suggestions_loop %] +
Mine Suggestion Suggested by Accepted by
[% suggestions_loo.managedby %]

[% suggestions_loo.title |html %] - [% suggestions_loo.author %]

-- 2.1.0