Bug 12775: Suggestions should be ordered by anyone
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 18 Sep 2014 08:23:47 +0000 (10:23 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 21 Nov 2014 19:13:27 +0000 (16:13 -0300)
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>
acqui/newordersuggestion.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt

index 21ac988..b360b70 100755 (executable)
@@ -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,
 );
 
index 2b30eba..9411489 100644 (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>
        
 <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>