Bug 23590: Clean TT variables for patrons
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
index add1048..4d3bda8 100644 (file)
@@ -1,9 +1,11 @@
+[% PROCESS 'i18n.inc' %]
 [% USE raw %]
 [% USE Asset %]
 [% USE Branches %]
 [% USE AuthorisedValues %]
 [% USE KohaDates %]
 [% USE Price %]
+[% USE ColumnsSettings %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions  &rsaquo;
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% IF ( op_else ) %]
-    [% Asset.css("css/datatables.css") | $raw %]
 [% END %]
 [% IF ( op_else ) %]
     <style>
         h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
-        .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; } .note { -moz-border-radius: 3px; border-radius:3px; background: transparent url("[% interface | html %]/[% theme | html %]/img/famfamfam/silk/comment.png") top left no-repeat; padding : 1px 3px 1px 18px; font-size : 90%; }
+        .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; } div.note { background: transparent none; border-style: dotted; border-width: 1px 0 0 0; font-size : 90%; padding: 2px 0 0 0; } div.note i { color: #CCC; }
     </style>
 [% END %]
 </head>
@@ -55,8 +56,8 @@
             <div class="col-md-8 col-md-offset-2">
 
     <div id="toolbar" class="btn-toolbar">
-        <a class="btn btn-default btn-sm" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a>
-        <a class="btn btn-default btn-sm deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
+        <a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a>
+        <a class="btn btn-default deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
     </div>
 
     <fieldset class="rows">
             [% IF ( title ) %]
                 <li>
                     <span class="label">Title:</span>
-                    [% title | html %]
+                    [% IF suggestion.biblionumber %]
+                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
+                    [% ELSE %]
+                        [% title | html %]
+                    [% END %]
                 </li>
             [% END %]
             [% IF ( author ) %]
           [% ELSIF ( STATUS == 'REJECTED' ) %]
               Rejected
               [% SET status_found = 1 %]
+          [% ELSIF ( STATUS == 'ORDERED' ) %]
+              Ordered
+              [% SET status_found = 1 %]
+          [% ELSIF ( STATUS == 'AVAILABLE' ) %]
+              Available
+              [% SET status_found = 1 %]
           [% ELSE %]
               [% FOREACH s IN SuggestionStatuses %]
                   [% IF STATUS == s.authorised_value %]
             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
             <tbody>
             <tr>
-                <th>Created by:</th>
+                <th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
                 <td>[% suggesteddate | $KohaDates %]</td>
                 <td>
-                    [% IF ( suggestedby_borrowernumber ) %]
-                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
-                        [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])
+                    [% IF ( suggestedby_patron.borrowernumber ) %]
+                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]">[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>
+                        [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
                     [% END %]
                 </td>
             </tr>
                 <th>Managed by:</th>
                 <td>[% manageddate | $KohaDates %]</td>
                 <td>
-                        [% IF ( managedby_borrowernumber ) %]
-                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | uri %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
-                            [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])
+                        [% IF ( managedby_patron.borrowernumber ) %]
+                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_patron.borrowernumber | uri %]">[% managedby_patron.surname | html %], [% managedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>
+                            [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
                         [% END %]
                 </td>
             </tr>
                 <th>Accepted on:</th>
                 <td>[% accepteddate | $KohaDates %]</td>
                 <td>
-                    [% IF ( acceptedby_borrowernumber ) %]
-                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
-                        [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])
+                    [% IF ( acceptedby_patron.borrowernumber ) %]
+                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]">[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>
+                        [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
                     [% END %]
                 </td>
             </tr>
 [% END %]
 
 [% IF ( op_save ) %]
+    [% FOR m IN messages %]
+        <div class="dialog [% m.type | html %]">
+            [% SWITCH m.code %]
+            [% CASE 'biblio_exists' %]
+                A similar document already exists: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
+            [% CASE %]
+                [% m.code | html %]
+            [% END %]
+        </div>
+    [% END %]
     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
     <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
                 <li>
                     <label for="STATUS">Status:</label>
                     <select id="STATUS" name="STATUS">
-                        <option value="">No Status</option>
+                        <option value="">No status</option>
 
                         [% IF (statusselected_ASKED ) %]
                             <option value="ASKED" selected="selected">Pending</option>
             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
             <tbody>
             <tr>
-                <th><label for="suggesteddate">Created by:</label> </th>
+                <th><label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label> </th>
                 <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
-                <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>  [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %]
+                <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]">[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>  [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])[% END %]
                 </td>
             </tr>
             <tr>
-                <th><label for="managedon">Managed by:</label> </th>
-                <td><input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
-                <td><input type="hidden" id="managedby" name="managedby" value="[% managedby | html %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | uri %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])[% END %]</td>
-            </tr>
-            <tr>
                 <th><label for="accepteddate">Accepted on:</label> </th>
                 <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
-                <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])[% END %]</td>
+                <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]">[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a> [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])[% END %]</td>
             </tr>
             </tbody>
-        </table></li></ol>
+        </table></li>
+
+            <li>
+                <label for="managedon">Managed on:</label>
+                <input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
+            </li>
+            <li>
+                <label for="managedby_name">by:</label>
+                <div>
+                    <span id="managedby_name">
+                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% logged_in_user.borrowernumber | uri %]">You</a>
+                    </span>
+                    [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
+                        | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
+                    [% END %]
+                    <br />
+                    <a id="edit_manager" class="new_window" href="#"><i class="fa fa-search"></i> Select manager</a>
+                    [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
+                        <a id="restore_previous_manager" href="#"><i class="fa fa-trash"></i> Keep existing manager</a>
+                    [% END %]
+                    <input type="hidden" name="managedby" id="managedby" value="[% logged_in_user.borrowernumber | html %]" />
+                </div>
+            </li>
+        </ol>
     </fieldset>
     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
         <li><label for="branchcode">Library:</label>
                        <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]"/>
                 </li></ol>
     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]noone[% END %]"/>
-    <fieldset class="action"><input type="hidden" name="op" value="[% op | html %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby | html %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit your suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
+    <fieldset class="action">
+        <input type="hidden" name="op" value="[% op | html %]" />
+        [% IF ( suggestionid ) %]
+            [% IF ( need_confirm ) %]
+                <input type="hidden" name="save_confirmed" value="1" />
+                <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
+            [% ELSE %]
+                <input type="submit" value="Save" />
+            [% END %]
+            <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby | uri %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>
+        [% ELSE %]
+            [% IF ( need_confirm ) %]
+                <input type="hidden" name="save_confirmed" value="1" />
+                <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
+            [% ELSE %]
+                <input type="submit" value="Submit your suggestion" />
+            [% END %]
+            <a class="cancel" href="suggestion.pl">Cancel</a>
+        [% END %]
     </fieldset>
     </form>
 [% END %]
 
 [% IF ( op_else ) %]
 <div id="toolbar" class="btn-toolbar">
-    <a class="btn btn-default btn-sm" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
+    <a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
 </div>
 
 <h1>Suggestions management</h1>
         [% SWITCH m.code %]
         [% CASE 'already_exists' %]
             The suggestion has not been added. A suggestion with this title already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id | html %]&op=show'>suggestion #[% m.id | html %]</a>)
+        [% CASE 'biblio_exists' %]
+            A similar document already exists: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
         [% CASE %]
             [% m.code | html %]
         [% END %]
     <ul class="ui-tabs-nav">
         [% FOREACH suggestion IN suggestions %]
                 <li>
-            <a href="#[% suggestion.suggestiontype | uri %]">
+            <a href="#tab_[% loop.count | uri %]">
             [% IF ( suggestion.suggestiontypelabel ) %]
                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
 [% END %]
 
 [% FOREACH suggestion IN suggestions %]
-<div id="[% suggestion.suggestiontype | html %]">
-<form class="update_suggestions" name="f[% suggestion.suggestiontype | html %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype | html %]">
+<div id="tab_[% loop.count | html %]">
+<form class="update_suggestions" name="f" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#tab_[% loop.count | html %]">
 
 [% IF ( suggestion.suggestions_loop ) %]
-<p><a id="CheckAll[% suggestion.suggestiontype | html %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype | html %]" href="#">Uncheck all</a></p>
-    <table id="[% suggestion.suggestiontype | html %]t" class="sorted">
+<p><a class="checkall" href="#">Check all</a> | <a class="uncheckall" href="#">Uncheck all</a></p>
+    <table id="table_[% loop.count | html %]" class="sorted">
         <thead>
             <tr>
-                <th class="NoSort">&nbsp;</th>
+                <th class="NoSort noExport">&nbsp;</th>
                 <th class="anti-the">Suggestion</th>
-                <th>Suggested by - on</th>
-                <th>Managed by - on</th>
+                <th>Suggested by</th>
+                <th>Suggested on</th>
+                <th>Managed by</th>
+                <th>Managed on</th>
                 <th>Library</th>
                 <th>Fund</th>
                 <th>Status</th>
-                <th class="NoSort">&nbsp;</th>
+                <th class="NoSort noExport">&nbsp;</th>
             </tr>
     </thead>
         <tbody>
             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
                 <tr>
                 <td>
-                    <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid | html %]" />
+                    <input type="checkbox" name="suggestionid" value="[% suggestions_loo.suggestionid | html %]" />
                 </td>
                 <td>
                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&amp;op=show" title="suggestion" >
                     <br />
                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% 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 ) %]<span class="note">[% suggestions_loo.note | html %]</span>[% 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 %]
                 </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>
-                    [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %]
+                </td>
+                <td data-order="[% suggestions_loo.suggesteddate | html %]">
+                    [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate | $KohaDates %][% END %]
                 </td>
                 <td>
                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamemanagedby | html %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby | html %][% END %]</a>
-                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
+                </td>
+                <td data-order="[% suggestions_loo.manageddate | html %]">
+                    [% IF ( suggestions_loo.manageddate ) %][% suggestions_loo.manageddate | $KohaDates %][% END %]
                 </td>
                 <td>
                     [% Branches.GetName( suggestions_loo.branchcode ) | html %]
                         Rejected
                     [% ELSIF ( suggestions_loo.CHECKED ) %]
                         Checked
+                    [% ELSIF ( suggestions_loo.AVAILABLE ) %]
+                        Available
                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) | html %]
                     [% ELSE %]
                 </td>
                 <td class="actions">
                     <a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a>
-                    <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
+                    <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
                 </td>
         </tr>
         [% END %]</tbody>
-        </table>  <fieldset>
-    <div id="select-reason[% suggestion.suggestiontype | html %]">
-        <div id="status[% suggestion.suggestiontype | html %]">
-            <label for="STATUS[% suggestion.suggestiontype | html %]">Mark selected as: </label>
-            <select name="STATUS" id="STATUS[% suggestion.suggestiontype | html %]">
-                <option value=""> -- Choose a status --</option>
-
-                [% IF (statusselected_ASKED ) %]
-                    <option value="ASKED" selected="selected">Pending</option>
-                [% ELSE %]
-                    <option value="ASKED">Pending</option>
-                [% END %]
+        </table>
 
-                [% IF (statusselected_ACCEPTED ) %]
-                    <option value="ACCEPTED" selected="selected">Accepted</option>
-                [% ELSE %]
-                    <option value="ACCEPTED">Accepted</option>
-                [% END %]
+        <div class="row">
+            <h2 style="padding-left:1em;">Change selected suggestions</h3>
+            <div class="col-sm-4">
+                <fieldset>
+                    <div id="select-reason">
+                       <label for="STATUS">Mark selected as: </label>
+                       <select name="STATUS" id="STATUS">
+                           <option value=""> -- Choose a status --</option>
 
-                [% IF (statusselected_CHECKED ) %]
-                    <option value="CHECKED" selected="selected">Checked</option>
-                [% ELSE %]
-                    <option value="CHECKED">Checked</option>
-                [% END %]
+                           [% IF (statusselected_ASKED ) %]
+                               <option value="ASKED" selected="selected">Pending</option>
+                           [% ELSE %]
+                               <option value="ASKED">Pending</option>
+                           [% END %]
 
-                [% IF ( statusselected_REJECTED ) %]
-                    <option value="REJECTED" selected="selected">Rejected</option>
-                [% ELSE %]
-                    <option value="REJECTED">Rejected</option>
-                [% END %]
+                           [% IF (statusselected_ACCEPTED ) %]
+                               <option value="ACCEPTED" selected="selected">Accepted</option>
+                           [% ELSE %]
+                               <option value="ACCEPTED">Accepted</option>
+                           [% END %]
 
-                [% FOREACH s IN SuggestionStatuses %]
-                    <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
-                [% END %]
-            </select>
+                           [% IF (statusselected_CHECKED ) %]
+                               <option value="CHECKED" selected="selected">Checked</option>
+                           [% ELSE %]
+                               <option value="CHECKED">Checked</option>
+                           [% END %]
 
-            <label for="reason[% suggestion.suggestiontype | html %]">with this reason:</label>
-            <select id="reason[% suggestion.suggestiontype | html %]" name="reason[% suggestion.suggestiontype | html %]">
-                <option value=""> -- Choose a reason -- </option>
-                [% FOREACH reasonsloo IN suggestion.reasonsloop %]
-                    <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
-                [% END %]
-                <option value="other">Others...</option>
-            </select>
+                           [% IF ( statusselected_REJECTED ) %]
+                               <option value="REJECTED" selected="selected">Rejected</option>
+                           [% ELSE %]
+                               <option value="REJECTED">Rejected</option>
+                           [% END %]
+
+                           [% FOREACH s IN SuggestionStatuses %]
+                               <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
+                           [% END %]
+                       </select>
+
+                       <label for="reason">with this reason:</label>
+                       <select name="reason">
+                           <option value=""> -- Choose a reason -- </option>
+                           [% FOREACH reasonsloo IN suggestion.reasonsloop %]
+                               <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
+                           [% END %]
+                           <option value="other">Others...</option>
+                       </select>
 
-            <span id="other_reason[% suggestion.suggestiontype | html %]">
-                <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype | html %]" name="other_reason[% suggestion.suggestiontype | html %]" placeholder="please note your reason here..." />
-                <a href="#back[% suggestion.suggestiontype | uri %]">Cancel</a>
-            </span>
+                       <span class="other_reason">
+                           <input type="text" size="31" name="other_reason" placeholder="please note your reason here..." />
+                           <a href="#" class="cancel_note">Cancel</a>
+                       </span>
+                    </div>
 
-            <strong style="padding: 0 1em;">OR:</strong>
+                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
+                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset>
+                </fieldset>
+            </div>
+            <div class="col-sm-4">
+                <fieldset>
+                    <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 %]" />
+                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset>
+                </fieldset>
+            </div>
 
-            <label for="[% suggestion.suggestiontype | html %]delete">Delete selected</label>
-            <input type="checkbox" name="op" id="[% suggestion.suggestiontype | html %]delete" />
+            <div class="col-sm-4">
+                <fieldset>
+                    <label for="delete_[% loop.count | html %]">Delete selected</label>
+                    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
+                    <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset>
+                </fieldset>
+            </div>
         </div>
-    </div>
 
-    <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
-    <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype | html %]" />
-    <input type="hidden" name="op" value="change" />
-</fieldset>
-        <fieldset class="action">
-    <input type="submit" value="Submit" /></fieldset>
-</form>
 [% ELSE %]
     <b>No results.</b>
 [% END %]
+</form>
 </div>
 [% END %]
-    </div>
 [% END %]
 
 [% UNLESS ( op_save ) %]
                       [% ELSE %]
                           <option value="__NONE__">None</option>
                       [% END %]
-                    [% FOREACH budgetid_loo IN budgetid_loop %]
-                        [% IF ( budgetid_loo.selected ) %] <option value="[% budgetid_loo.code | html %]" selected="selected">[% budgetid_loo.desc | html %]</option>[% ELSE %]<option value="[% budgetid_loo.code | html %]">[% budgetid_loo.desc | html %]</option>[% END %]
+                    [% FOREACH budgetsloo IN budgetsloop %]
+                        [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>[% END %]
                         [% END %]
                     </select></li>
                     <li><label for="branchcode">Library:</label>
 [% MACRO jsinclude BLOCK %]
     [% INCLUDE 'calendar.inc' %]
     [% IF ( op == 'show' || op_else ) %]
-        <script type="text/javascript">
+        <script>
             $(document).ready(function(){
                 $(".deletesuggestion").on("click",function(){
                     return confirm(_("Are you sure you want to delete this suggestion?"));
     [% END %]
     [% IF ( op_else ) %]
         [% INCLUDE 'datatables.inc' %]
+        [% INCLUDE 'columns_settings.inc' %]
         [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
-        <script type="text/javascript">
-            /**
-            *  displayOther.
-            *  This function display the select or an textaera to write a reason.
-            */
-            function displayOther(id,show,hide){
-                $("#"+hide+id).hide();
-                $("#"+show+id).show();
-            }
+
+        <script>
             $(document).ready(function() {
-                $('#suggestiontabs').tabs({
-                    // Correct table sizing for tables hidden in tabs
-                    // http://www.datatables.net/examples/api/tabs_and_scrolling.html
-                    "activate": function(event, ui) {
-                        $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
-                    }
-                });
-                $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
-                    "aoColumnDefs": [
-                        { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
-                        { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
-                    ],
-                    "sPaginationType": "four_button"
-                }));
-            [% FOREACH suggestion IN suggestions %]
-                // functions for [% suggestion.suggestiontype | html %] interactions
-                $("#CheckAll[% suggestion.suggestiontype | html %]").click(function(e){
-                    $("#[% suggestion.suggestiontype | html %]t").checkCheckboxes();
+                $('#suggestiontabs').tabs();
+
+                columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
+                [% FOREACH suggestion IN suggestions %]
+                    [% IF ( suggestion.suggestions_loop ) %]
+                        KohaTable("table_[% loop.count| html %]", {
+                            "sorting": [[ 1, "asc" ]],
+                            "autoWidth": false,
+                            "columnDefs": [
+                                { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
+                                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
+                            ]
+                        }, columns_settings );
+                    [% END %]
+                [% END %]
+
+                $(".checkall").click(function(e){
                     e.preventDefault();
+                    $(this).parents('form').checkCheckboxes();
+                    return false;
                 });
-                $("#UncheckAll[% suggestion.suggestiontype | html %]").click(function(e){
-                    $("#[% suggestion.suggestiontype | html %]t").unCheckCheckboxes();
+                $(".uncheckall").click(function(e){
                     e.preventDefault();
+                    $(this).parents('form').unCheckCheckboxes();
+                    return false;
                 });
-                $("#other_reason[% suggestion.suggestiontype | html %]").hide();
-                $("#reason[% suggestion.suggestiontype | html %]").change(function(){
+                $(".other_reason").hide();
+                $("select[name='reason']").change(function(){
                     if($(this).val() == "other"){
                         $(this).hide();
-                        $("#other_reason[% suggestion.suggestiontype | html %]").show();
-                }
-                });
-                $("#[% suggestion.suggestiontype | html %]delete").change(function(){
-                    if(this.checked){
-                        $("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","delete");
-                    } else {
-                        $("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","change");
+                        $(this).siblings(".other_reason").show();
                     }
                 });
 
-            [% END %]
-                $("a[href*=back]").click(function(){
-                var sid = $(this).attr("href").replace(/#back/,"");
-                    $("#reason"+sid).show().find("option[value='']").attr("selected","selected");
-                    $("#other_reason"+sid).hide();
+                $("a.cancel_note").click(function(e) {
+                    $(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected");
+                    $(this).siblings("input[name='other_reason']").hide();
+                    e.preventDefault();
                 });
                 $("h4.local_collapse a").click(function(){
                     $(this).parent().parent().find("ol").toggle();
                     }
                 });
 
-                $("form.update_suggestions").on("submit", function(e){
-                    var form = this;
-                    var action_delete_selected = $(this).find("input[value='delete']").is(":checked");
-                    if ( action_delete_selected ) {
-                        var suggestions_to_delete = $(this).find("input[name='edit_field']:checked");
-                        if ( suggestions_to_delete.length == 0 ) {
-                            alert(_("Please select at least one suggestion to delete"));
-                            e.preventDefault();
-                            return false;
-                        } else if ( suggestions_to_delete.length == 1 ) {
+                $("button[type='submit']").on("click", function(e) {
+                    var form = $(this).parents("form");
+                    var action = $(this).val();
+                    var selected_suggestions = $(form).find("input[name='suggestionid']:checked");
+                    if ( selected_suggestions.length == 0 ) {
+                        alert(_("Please select at least one suggestion"));
+                        e.preventDefault();
+                        return false;
+                    }
+                    if ( action == "delete" ) {
+                        if ( selected_suggestions.length == 1 ) {
                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
                                 e.preventDefault();
                                 return false;
                             }
-                        } else if ( suggestions_to_delete.length > 1 ) {
+                        } else if ( selected_suggestions.length > 1 ) {
                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
                                 e.preventDefault();
                                 return false;
                             }
                         }
                     }
+
+                    $('<input />').attr('type', 'hidden')
+                                  .attr('name', "op")
+                                  .attr('value', action)
+                                  .appendTo(form);
                     return true;
                 });
             });
         </script>
     [% END %]
     [% IF ( op_save )  %]
-        <script type="text/javascript">
+        <script>
+
+            function editManagerPopup() {
+                window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
+                    'PatronPopup',
+                    'width=740,height=450,location=yes,toolbar=no,'
+                    + 'scrollbars=yes,resize=yes'
+                );
+            }
+            function select_user(borrowernumber, borrower) {
+                $("#managedby_name").empty();
+                $("#managedby").val('');
+                var borrowername = borrower.firstname + ' ' + borrower.surname;
+                if (borrowernumber) {
+                    var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
+                        + '?borrowernumber=' + borrowernumber + '">'
+                        + borrowername + '</a>';
+                    $('#managedby_name').html(managerlink);
+                    $('#managedby').val(borrowernumber);
+                }
+            }
+
             $(document).ready(function(){
                 calcNewsuggTotal();
                 $("#quantity,#price,#currency").on("change",function(){
                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
                     $("#other_reason").hide();
                 });
+
+                $("#edit_manager").on("click",function(e){
+                    e.preventDefault();
+                    editManagerPopup();
+                });
+                $("#restore_previous_manager").on("click",function(e){
+                    e.preventDefault();
+
+                    $("#managedby_name").empty();
+                    $("#managedby").val('');
+                    var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]";
+                    var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
+                        + '?borrowernumber=[% managedby_patron.borrowernumber | html %]">'
+                        + borrowername + '</a>';
+                    $('#managedby_name').html(managerlink);
+                    $('#managedby').val([% managedby_patron.borrowernumber | html %]);
+                });
             });
         </script>
     [% END %]