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.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2014-09-18 10:23:47 +02:00 committed by Tomas Cohen Arazi
parent 26cece17ad
commit c4e0d8432f
2 changed files with 19 additions and 7 deletions

View file

@ -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,
);

View file

@ -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 );
});
});
//]]>
</script>
@ -30,9 +37,11 @@
<h1>Suggestions</h1>
[% IF ( suggestions_loop ) %]
<a href="#" id="show_only_mine">Show only mine</a> | <a href="#" id="show_all">Show all suggestions</a>
<table id="suggestionst">
<thead>
<tr>
<th>Mine</th>
<th>Suggestion</th>
<th>Suggested by</th>
<th>Accepted by</th>
@ -42,6 +51,7 @@
<tbody>
[% FOREACH suggestions_loo IN suggestions_loop %]
<tr>
<td>[% suggestions_loo.managedby %]</td>
<td>
<p>[% suggestions_loo.title |html %] - [% suggestions_loo.author %]</p>
<p>