Bug 15758: Koha::Libraries - Remove GetBranches
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% USE Branches %]
2 [% USE AuthorisedValues %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions  &rsaquo;
7     [% IF ( op_save ) %]
8         [% IF ( suggestionid ) %]
9             Suggestions &rsaquo;  Edit suggestion #[% suggestionid %]
10         [% ELSE %]
11             Suggestions &rsaquo; Add suggestion
12         [% END %]
13     [% ELSIF ( op == 'show' ) %]
14            Suggestions &rsaquo; Show suggestion #[% suggestionid %]
15     [% ELSE %]
16         Suggestions management
17     [% END %]
18 </title>
19 [% INCLUDE 'doc-head-close.inc' %]
20 [% INCLUDE 'calendar.inc' %]
21 [% IF ( op == 'show' ) %]
22 <script type="text/javascript">
23     // <![CDATA[
24     $(document).ready(function(){
25         $("#deletesuggestion").on("click",function(){
26             return confirm(_("Are you sure you want to delete this suggestion?"));
27         });
28     });
29     // ]]>
30 </script>
31 [% END %]
32 [% IF ( op_else ) %]
33 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
34 [% INCLUDE 'datatables.inc' %]
35 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
36 <script type="text/javascript">
37 // <![CDATA[
38 /**
39 *  displayOther.
40 *  This function display the select or an textaera to write a reason.
41 */
42 function displayOther(id,show,hide){
43         $("#"+hide+id).hide();
44         $("#"+show+id).show();
45 }
46 $(document).ready(function() {
47     $('#suggestiontabs').tabs({
48         // Correct table sizing for tables hidden in tabs
49         // http://www.datatables.net/examples/api/tabs_and_scrolling.html
50         "activate": function(event, ui) {
51             $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
52         }
53     });
54     $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
55         "aoColumnDefs": [
56             { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
57             { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
58         ],
59         "sPaginationType": "four_button"
60     }));
61 [% FOREACH suggestion IN suggestions %]
62 // functions for [% suggestion.suggestiontype %] interactions
63     $("#CheckAll[% suggestion.suggestiontype %]").click(function(e){
64                 $("#[% suggestion.suggestiontype %]t").checkCheckboxes();
65         e.preventDefault();
66     });
67     $("#UncheckAll[% suggestion.suggestiontype %]").click(function(e){
68                 $("#[% suggestion.suggestiontype %]t").unCheckCheckboxes();
69         e.preventDefault();
70         });
71         $("#other_reason[% suggestion.suggestiontype %]").hide();
72     $("#reason[% suggestion.suggestiontype %]").change(function(){
73             if($(this).val() == "other"){
74                         $(this).hide();
75                         $("#other_reason[% suggestion.suggestiontype %]").show();
76     }
77     });
78         $("#[% suggestion.suggestiontype %]delete").change(function(){
79                 if(this.checked){
80                         $("form[name='f[% suggestion.suggestiontype %]'] input[name=op]").attr("value","delete");
81                 } else {
82                         $("form[name='f[% suggestion.suggestiontype %]'] input[name=op]").attr("value","change");
83                 }
84         });
85
86 [% END %]
87     $("a[href*=back]").click(function(){
88     var sid = $(this).attr("href").replace(/#back/,"");
89             $("#reason"+sid).show().find("option[value='']").attr("selected","selected");
90                 $("#other_reason"+sid).hide();
91     });
92     $("h4.local_collapse a").click(function(){
93         $(this).parent().parent().find("ol").toggle();
94         return false;
95     });
96     // http://jqueryui.com/demos/datepicker/#date-range
97     var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
98         changeMonth: true,
99         numberOfMonths: 1,
100         onSelect: function( selectedDate ) {
101             var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
102                 instance = $( this ).data( "datepicker" );
103                 date = $.datepicker.parseDate(
104                     instance.settings.dateFormat ||
105                     $.datepicker._defaults.dateFormat,
106                     selectedDate, instance.settings );
107             dates.not( this ).datepicker( "option", option, date );
108         }
109     });
110     var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
111         changeMonth: true,
112         numberOfMonths: 1,
113         onSelect: function( selectedDate ) {
114             var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
115                 instance = $( this ).data( "datepicker" );
116                 date = $.datepicker.parseDate(
117                     instance.settings.dateFormat ||
118                     $.datepicker._defaults.dateFormat,
119                     selectedDate, instance.settings );
120             datesMD.not( this ).datepicker( "option", option, date );
121         }
122     });
123     var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
124         changeMonth: true,
125         numberOfMonths: 1,
126         onSelect: function( selectedDate ) {
127             var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
128                 instance = $( this ).data( "datepicker" );
129                 date = $.datepicker.parseDate(
130                     instance.settings.dateFormat ||
131                     $.datepicker._defaults.dateFormat,
132                     selectedDate, instance.settings );
133             datesAD.not( this ).datepicker( "option", option, date );
134         }
135     });
136
137     $("form.update_suggestions").on("submit", function(e){
138         var form = this;
139         var action_delete_selected = $(this).find("input[value='delete']").is(":checked");
140         if ( action_delete_selected ) {
141             var suggestions_to_delete = $(this).find("input[name='edit_field']:checked");
142             if ( suggestions_to_delete.length == 0 ) {
143                 alert(_("Please select at least one suggestion to delete"));
144                 e.preventDefault();
145                 return false;
146             } else if ( suggestions_to_delete.length == 1 ) {
147                 if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
148                     e.preventDefault();
149                     return false;
150                 }
151             } else if ( suggestions_to_delete.length > 1 ) {
152                 if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
153                     e.preventDefault();
154                     return false;
155                 }
156             }
157         }
158         return true;
159     });
160 });
161 // ]]>
162 </script>
163 <style type="text/css">
164 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
165 .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 %]/[% theme %]/img/famfamfam/silk/comment.png") top left no-repeat; padding : 1px 3px 1px 18px; font-size : 90%; }
166 </style>[% END %]
167 [% IF ( op_save )  %]
168     <script type="text/javascript">
169         // <![CDATA[
170         $(document).ready(function() { calcNewsuggTotal(); });
171         // ]]>
172     </script>
173 [% END %]
174 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
175 </head>
176 <body id="acq_suggestion" class="acq">
177 [% INCLUDE 'header.inc' %]
178 [% INCLUDE 'cat-search.inc' %]
179 <div id="breadcrumbs">
180     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
181     [% IF ( op_save ) %]
182         [% IF ( suggestionid ) %]
183             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid %]
184         [% ELSE %]
185             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
186         [% END %]
187     [% ELSIF ( op == 'show' ) %]
188            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid %]
189     [% ELSE %]
190         Suggestions management
191     [% END %]
192 </div>
193
194 [% IF ( op == 'show' ) %]
195 <div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> -->
196 <div id="bd">
197     <div id="yui-main">
198     <div class="yui-b">
199
200     <div id="toolbar" class="btn-toolbar">
201         <a class="btn btn-small" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid %]"><i class="fa fa-pencil"></i> Edit</a>
202         <a class="btn btn-small" id="deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestionid %]"><i class="fa fa-trash"></i> Delete</a>
203     </div>
204
205     <fieldset class="rows">
206       <legend>Bibliographic information</legend>
207       <ol>
208         <li><span class="label">Title:</span>[% title |html %]</li>
209         <li><span class="label">Author:</span>[% author |html %]</li>
210         <li><span class="label">Copyright date:</span>[% copyrightdate |html %]</li>
211         <li><span class="label">ISBN or ISSN or other standard number:</span>[% isbn |html %]</li>
212         <li><span class="label">Publisher:</span>[% publishercode |html %]</li>
213         <li><span class="label">Publication place:</span>[% place |html %]</li>
214         <li><span class="label">Collection title:</span>[% collectiontitle |html %]</li>
215         <li><span class="label">Document type:</span>
216             [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) %]
217         </li>
218         [% IF ( patron_reason_loop ) %]
219           <li><span class="label">Reason for suggestion: </span>
220             [% FOREACH patron_reason_loo IN patron_reason_loop %]
221               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib %][% END %]
222             [% END %]
223           </li>
224         [% END %]
225         <li><span class="label">Notes:</span>[% note |html %]</li>
226       </ol>
227     </fieldset>
228     <fieldset class="rows"> <legend>Suggestion management</legend>
229       <ol>
230         <li>
231           <span class="label">Status:</span>
232           [% SET status_found = 0 %]
233           [% IF ( STATUS == 'ASKED' ) %]
234               Pending
235               [% SET status_found = 1 %]
236           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
237               Accepted
238               [% SET status_found = 1 %]
239           [% ELSIF ( STATUS == 'CHECKED' ) %]
240               Checked
241               [% SET status_found = 1 %]
242           [% ELSIF ( STATUS == 'REJECTED' ) %]
243               Rejected
244               [% SET status_found = 1 %]
245           [% ELSE %]
246               [% FOREACH s IN SuggestionStatuses %]
247                   [% IF STATUS == s.authorised_value %]
248                       [% s.lib %]
249                       [% SET status_found = 1 %]
250                   [% END %]
251               [% END %]
252           [% END %]
253
254         </li>
255         <li>
256           <table>
257             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
258             <tbody>
259             <tr>
260                 <th><span class="label">Suggestion creation</span> </th>
261                 <td>[% suggesteddate | $KohaDates %]</td>
262                 <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
263                 </td>
264             </tr>
265             <tr>
266                 <th><span class="label">Suggestion management</span> </th>
267                 <td>[% manageddate | $KohaDates %]</td>
268                 <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
269             </tr>
270             <tr>
271                 <th><span class="label">Suggestion accepted</span> </th>
272                 <td>[% accepteddate | $KohaDates %]</td>
273                 <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
274             </tr>
275             </tbody>
276         </table></li></ol>
277     </fieldset>
278     <fieldset class="rows"> <legend>Acquisition information</legend>
279       <ol>
280         <li>
281           <span class="label">Library:</span> [% Branches.GetName( branchcode ) %]
282         </li>
283         <li>
284           <span class="label">Fund:</span> [% budgetname %]
285         </li>
286         <li>
287           <span class="label">Copies:</span>[% quantity %]
288         </li>
289         <li>
290           <span class="label">Currency:</span>[% currency %]
291         </li>
292         <li>
293           <span class="label">Price:</span>[% price | $Price %]
294         </li>
295         <li>
296           <span class="label">Total</span>[% total | $Price %]
297         </li>
298       </ol>
299     </fieldset>
300
301     <fieldset class="action">
302         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
303     </fieldset>
304
305     </div>
306     </div>
307 </div>
308 [% ELSE %]
309
310 [% IF ( op_save ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
311 <div id="bd">
312     <div id="yui-main">
313     <div class="yui-b">
314 [% IF ( op_save ) %]
315     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
316     <input type="hidden" name="redirect" id="redirect" value="[% redirect %]" />
317     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
318     [% IF ( suggestionid ) %]
319         <h1>Edit purchase suggestion #[% suggestionid %]</h1>
320         <input type="hidden" name="suggestionid" value="[% suggestionid %]"/>
321     [% ELSE %]
322         <h1>Enter a new purchase suggestion</h1>
323     [% END %]
324     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
325         <li>
326             <label for="title" class="required">Title:</label>
327             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title |html %]" required="required" class="required" />
328             <span class="required">Required</span>
329         </li>
330         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
331         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
332         <li><label for="isbn">ISBN or ISSN or other standard number:</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]"/></li>
333         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
334         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
335         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
336         <li><label for="itemtype">Document type:</label>
337             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
338         </li>
339         [% IF patron_reason_loop %]
340             <li>
341                 <label for="patronreason">Reason for suggestion: </label>
342                 <select name="patronreason" id="patronreason">
343                     <option value=""> -- Choose -- </option>
344                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
345                         [% IF patron_reason_loo.authorised_value == patronreason %]
346                             <option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>
347                         [% ELSE %]
348                             <option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
349                         [% END %]
350                     [% END %]
351                 </select>
352             </li>
353         [% END %]
354         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
355         </ol>
356     </fieldset>
357     <fieldset class="rows"> <legend>Suggestion management</legend>
358        <ol>
359             [% IF ( suggestionid ) %]
360                 <li>
361                     <label for="STATUS">Status:</label>
362                     <select id="STATUS" name="STATUS">
363                         <option value="">No Status</option>
364
365                         [% IF (statusselected_ASKED ) %]
366                             <option value="ASKED" selected="selected">Pending</option>
367                         [% ELSE %]
368                             <option value="ASKED">Pending</option>
369                         [% END %]
370
371                         [% IF (statusselected_ACCEPTED ) %]
372                             <option value="ACCEPTED" selected="selected">Accepted</option>
373                         [% ELSE %]
374                             <option value="ACCEPTED">Accepted</option>
375                         [% END %]
376
377                         [% IF (statusselected_CHECKED ) %]
378                             <option value="CHECKED" selected="selected">Checked</option>
379                         [% ELSE %]
380                             <option value="CHECKED">Checked</option>
381                         [% END %]
382
383                         [% IF ( statusselected_REJECTED ) %]
384                             <option value="REJECTED" selected="selected">Rejected</option>
385                         [% ELSE %]
386                             <option value="REJECTED">Rejected</option>
387                         [% END %]
388
389                         [% FOREACH s IN SuggestionStatuses %]
390                             [% IF s.authorised_value == selected_status %]
391                                 <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
392                             [% ELSE %]
393                                 <option value="[% s.authorised_value %]">[% s.lib %]</option>
394                             [% END %]
395                         [% END %]
396                     </select>
397                 </li>
398             [% END %]
399         <li><table>
400             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
401             <tbody>
402             <tr>
403                 <th><label for="suggesteddate">Suggestion creation</label> </th>
404                 <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/></td>
405                 <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
406                 </td>
407             </tr>
408             <tr>
409                 <th><label for="managedon">Suggestion management</label> </th>
410                 <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" /></td>
411                 <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
412             </tr>
413             <tr>
414                 <th><label for="accepteddate">Suggestion accepted</label> </th>
415                 <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" /></td>
416                 <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
417             </tr>
418             </tbody>
419         </table></li></ol>
420     </fieldset>
421     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
422         <li><label for="branchcode">Library:</label>
423             <select name="branchcode" id="branchcode">
424                 <option value="">Any</option>
425                 [% IF branchfilter %]
426                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
427                 [% ELSE %]
428                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
429                 [% END %]
430             </select>
431         </li>
432         <li><label for="budgetid">Fund:</label>
433             <select name="budgetid" id="budgetid">
434                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
435                 [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id %]" selected="selected">[% budgetsloo.budget_name %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id %]">[% budgetsloo.budget_name %]</option>[% END %][% END %]
436             </select>
437                 </li><li><label for="quantity">Copies:</label>
438                         <input type="text" size="10" id="quantity" name="quantity" value="[% quantity %]" onchange="calcNewsuggTotal();" />
439                 </li>
440                 <li>
441                     <label for="currency">Currency:</label>
442                     [% FOREACH c IN currencies %]
443                         <input type="hidden" value="[% c.rate %]" id="currency_rate_[% c.currency %]" name="currency_rate_[% c.currency %]" />
444                         <input type="hidden" id="[% c.currency %]" name="[% c.currency %]" value="[% c.rate %]" />
445                     [% END %]
446
447                     <select name="currency" id="currency" onchange="calcNewsuggTotal();">
448                         [% FOREACH c IN currencies %]
449                             [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
450                                 <option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
451                             [% ELSIF not c.archived %]
452                                 <option value="[% c.currency %]">[% c.currency %]</option>
453                             [% END %]
454                         [% END %]
455                     </select>
456                 </li>
457                 <li><label for="price">Price:</label>
458                         <input type="text" size="20" name="price" id="price" value="[% price %]" onchange="calcNewsuggTotal();" />
459                 </li><li><label for="total">Total: </label>
460                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total %]"/>
461                 </li></ol>
462     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby %][% ELSE %]noone[% END %]"/>
463     <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit your suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
464     </fieldset>
465     </form>
466 [% END %]
467
468 [% IF ( op_else ) %]
469 <div id="toolbar" class="btn-toolbar">
470     <a class="btn btn-small" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
471 </div>
472
473 <h1>Suggestions management</h1>
474
475
476 [% FOR m IN messages %]
477     <div class="dialog [% m.type %]">
478         [% SWITCH m.code %]
479         [% CASE 'already_exists' %]
480             The suggestion has not been added. A suggestion with this title already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id %]&op=show'>suggestion #[% m.id %]</a>)
481         [% CASE %]
482             [% m.code %]
483         [% END %]
484     </div>
485 [% END %]
486
487 [% UNLESS ( notabs ) %]
488     <div id="suggestiontabs" class="toptabs">
489     <ul class="ui-tabs-nav">
490         [% FOREACH suggestion IN suggestions %]
491                 <li>
492             <a href="#[% suggestion.suggestiontype %]">
493             [% IF ( suggestion.suggestiontypelabel ) %]
494                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
495                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
496                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
497                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
498                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
499                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
500                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Status unknown
501                 [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
502             [% ELSE %]
503                 [% IF ( suggestion.suggestiontype ) %]
504                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
505                 [% ELSE %]
506                     No name
507                 [% END %]
508             [% END %]
509             ([% suggestion.suggestions_loop.size %])</a></li>
510
511         [% END %]
512     </ul>
513 [% END %]
514
515 [% FOREACH suggestion IN suggestions %]
516 <div id="[% suggestion.suggestiontype %]">
517 <form class="update_suggestions" name="f[% suggestion.suggestiontype %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype %]">
518
519 [% IF ( suggestion.suggestions_loop ) %]
520 <p><a id="CheckAll[% suggestion.suggestiontype %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype %]" href="#">Uncheck all</a></p>
521     <table id="[% suggestion.suggestiontype %]t" class="sorted">
522         <thead>
523             <tr><th>&nbsp;</th>
524             <th>No.</th>
525             <th class="anti-the">Suggestion</th>
526             <th>Suggested by - on</th>
527             <th>Managed by - on</th>
528             <th>Library</th>
529             <th>Fund</th>
530             <th>Status</th></tr>
531     </thead>
532         <tbody>
533             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
534                 <tr>
535                 <td>
536                     <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid %]" />
537                 </td>
538                 <td>
539                     [% suggestions_loo.suggestionid %]
540                 </td>
541                 <td>
542                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=show" title="suggestion" >
543                         [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]</a>
544                     [<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=edit" title="suggestion" >edit</a>]
545                     <br />
546                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate |html %] [% END %]
547                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc |html %]</i> [% END %]
548                         [% 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 ) %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<span class="note">[% suggestions_loo.note |html%]</span>[% END %]
549                 </td>
550                 <td>
551                     [% IF ( suggestions_loo.emailsuggestedby ) %]<a href="mailto:[% suggestions_loo.emailsuggestedby %]">[% END %][% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby %])[% END %] [% IF ( suggestions_loo.emailsuggestedby ) %]</a>[% END %]
552                     [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %]
553                 </td>
554                 <td>
555                     [% IF ( suggestions_loo.emailmanagedby ) %]<a href="mailto:[% suggestions_loo.emailmanagedby %]">[% END %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby %][% END %] [% IF ( suggestions_loo.emailmanagedby ) %]</a>[% END %]
556                     [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
557                 </td>
558                 <td>
559                     [% Branches.GetName( suggestions_loo.branchcode ) %]
560                 </td>
561                 <td>
562                     [% suggestions_loo.budget_name %]
563                 </td>
564                 <td>
565                     [% IF ( suggestions_loo.ASKED ) %]
566                         Pending
567                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
568                         Accepted
569                     [% ELSIF ( suggestions_loo.ORDERED ) %]
570                         Ordered
571                     [% ELSIF ( suggestions_loo.REJECTED ) %]
572                         Rejected
573                     [% ELSIF ( suggestions_loo.CHECKED ) %]
574                         Checked
575                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
576                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
577                     [% ELSE %]
578                         Status unknown
579                     [% END %]
580
581                     [% IF ( suggestions_loo.reason ) %]
582                         <br />([% suggestions_loo.reason %])
583                     [% END %]
584                 </td>
585         </tr>
586         [% END %]</tbody>
587         </table>  <fieldset>
588     <div id="select-reason[% suggestion.suggestiontype %]">
589         <div id="status[% suggestion.suggestiontype %]">
590             <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label>
591             <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
592                 <option value=""> -- Choose a status --</option>
593
594                 [% IF (statusselected_ASKED ) %]
595                     <option value="ASKED" selected="selected">Pending</option>
596                 [% ELSE %]
597                     <option value="ASKED">Pending</option>
598                 [% END %]
599
600                 [% IF (statusselected_ACCEPTED ) %]
601                     <option value="ACCEPTED" selected="selected">Accepted</option>
602                 [% ELSE %]
603                     <option value="ACCEPTED">Accepted</option>
604                 [% END %]
605
606                 [% IF (statusselected_CHECKED ) %]
607                     <option value="CHECKED" selected="selected">Checked</option>
608                 [% ELSE %]
609                     <option value="CHECKED">Checked</option>
610                 [% END %]
611
612                 [% IF ( statusselected_REJECTED ) %]
613                     <option value="REJECTED" selected="selected">Rejected</option>
614                 [% ELSE %]
615                     <option value="REJECTED">Rejected</option>
616                 [% END %]
617
618                 [% FOREACH s IN SuggestionStatuses %]
619                     <option value="[% s.authorised_value %]">[% s.lib %]</option>
620                 [% END %]
621             </select>
622
623             <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>
624             <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
625                 <option value=""> -- Choose a reason -- </option>
626                 [% FOREACH reasonsloo IN suggestion.reasonsloop %]
627                     <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
628                 [% END %]
629                 <option value="other">Others...</option>
630             </select>
631
632             <span id="other_reason[% suggestion.suggestiontype %]">
633                 <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" placeholder="please note your reason here..." />
634                 <a href="#back[% suggestion.suggestiontype %]">Cancel</a>
635             </span>
636
637             <strong style="padding: 0 1em;">OR:</strong>
638
639             <label for="[% suggestion.suggestiontype %]delete">Delete selected</label>
640             <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" />
641         </div>
642     </div>
643
644     <input type="hidden" name="branchcode" value="[% branchfilter %]" />
645     <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" />
646     <input type="hidden" name="op" value="change" />
647 </fieldset>
648         <fieldset class="action">
649     <input type="submit" value="Submit" /></fieldset>
650 </form>
651 [% ELSE %]
652     <b>No results.</b>
653 [% END %]
654 </div>
655 [% END %]
656     </div>
657 [% END %]
658 </div>
659 </div>
660
661       [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b">
662 <form name="suggestionfilter" action="suggestion.pl" method="get">
663 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
664                 <select name="displayby" id="displayby" style="width:auto;">
665                     [% IF ( displayby == "STATUS" ) %]
666                         <option value="STATUS" selected="selected">Status</option>
667                     [% ELSE %]
668                         <option value="STATUS">Status</option>
669                     [% END %]
670                     [% IF ( displayby == "branchcode" ) %]
671                         <option value="branchcode" selected="selected">Library</option>
672                     [% ELSE %]
673                         <option value="branchcode">Library</option>
674                     [% END %]
675                     [% IF ( displayby == "itemtype" ) %]
676                         <option value="itemtype" selected="selected">Item type</option>
677                     [% ELSE %]
678                         <option value="itemtype">Item type</option>
679                     [% END %]
680                     [% IF ( displayby == "managedby" ) %]
681                         <option value="managedby" selected="selected">Managed by</option>
682                     [% ELSE %]
683                         <option value="managedby">Managed by</option>
684                     [% END %]
685                     [% IF ( displayby == "acceptedby" ) %]
686                         <option value="acceptedby" selected="selected">Accepted by</option>
687                     [% ELSE %]
688                         <option value="acceptedby">Accepted by</option>
689                     [% END %]
690                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
691 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
692                 <div style="display:block;" id="limits">
693
694                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
695                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title |html %]" /></li>
696                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
697                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
698                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
699                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
700                     <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" /></li></ol>
701                 </fieldset>
702                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
703                     <ol>
704                       <li>
705                           <label for="STATUS"> Status:</label>
706                           <select name="STATUS" id="STATUS">
707                               <option value="">Any</option>
708
709                               [% IF (statusselected_ASKED ) %]
710                                   <option value="ASKED" selected="selected">Pending</option>
711                               [% ELSE %]
712                                   <option value="ASKED">Pending</option>
713                               [% END %]
714
715                               [% IF (statusselected_ACCEPTED ) %]
716                                   <option value="ACCEPTED" selected="selected">Accepted</option>
717                               [% ELSE %]
718                                   <option value="ACCEPTED">Accepted</option>
719                               [% END %]
720
721                               [% IF (statusselected_CHECKED ) %]
722                                   <option value="CHECKED" selected="selected">Checked</option>
723                               [% ELSE %]
724                                   <option value="CHECKED">Checked</option>
725                               [% END %]
726
727                               [% IF ( statusselected_REJECTED ) %]
728                                   <option value="REJECTED" selected="selected">Rejected</option>
729                               [% ELSE %]
730                                   <option value="REJECTED">Rejected</option>
731                               [% END %]
732
733                               [% FOREACH s IN SuggestionStatuses %]
734                                   [% IF s.authorised_value == selected_status %]
735                                       <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
736                                   [% ELSE %]
737                                       <option value="[% s.authorised_value %]">[% s.lib %]</option>
738                                   [% END %]
739                               [% END %]
740                           </select>
741                       </li>
742
743                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
744 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
745                                                                      </select></li>
746                     <li>
747                         <label for="suggesteddate_from">Suggested date from:</label>
748                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from %]" />
749                     </li>
750                     <li>
751                         <label for="suggesteddate_to">To:</label>
752                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to %]" />
753                     </li>
754                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
755 [% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code %]" selected="selected">[% managedby_loo.desc %]</option>[% ELSE %]<option value="[% managedby_loo.code %]">[% managedby_loo.desc %]</option>[% END %][% END %]
756                                                                      </select></li>
757                     <li>
758                         <label for="manageddate_from">Management date from:</label>
759                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from %]" />
760                     </li>
761                     <li>
762                         <label for="manageddate_to">To:</label>
763                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to %]" />
764                     </li>
765                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
766 [% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code %]" selected="selected">[% acceptedby_loo.desc %]</option>[% ELSE %]<option value="[% acceptedby_loo.code %]">[% acceptedby_loo.desc %]</option>[% END %][% END %]
767                                                       </select></li>
768                     <li>
769                         <label for="accepteddate_from">Accepted date from:</label>
770                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from %]" />
771                     </li>
772                     <li>
773                         <label for="accepteddate_to">To:</label>
774                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to %]" />
775                     </li>
776                     <li><input type="submit" value="Go" /></li></ol>
777                 </fieldset>
778
779                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
780                     <ol><li><label for="budgetid"> Book fund:</label>
781                     <select name="budgetid" id="budgetid">
782                       <option value="__ANY__">Any</option>
783                       [% IF budgetid == '__NONE__' %]
784                           <option value="__NONE__" selected="selected">None</option>
785                       [% ELSE %]
786                           <option value="__NONE__">None</option>
787                       [% END %]
788                     [% FOREACH budgetid_loo IN budgetid_loop %]
789                         [% IF ( budgetid_loo.selected ) %] <option value="[% budgetid_loo.code %]" selected="selected">[% budgetid_loo.desc %]</option>[% ELSE %]<option value="[% budgetid_loo.code %]">[% budgetid_loo.desc %]</option>[% END %]
790                         [% END %]
791                     </select></li>
792                     <li><label for="branchcode">Library:</label>
793                     <select name="branchcode" id="branchcode">
794                         <option value="__ANY__">Any</option>
795                         [% IF branchfilter %]
796                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
797                         [% ELSE %]
798                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
799                         [% END %]
800                     </select></li><li><input type="submit" value="Go" /></li></ol>
801                 </fieldset>
802     </div>
803             </form>
804         </div>
805     [% END %]
806     [% END %]
807 </div>
808 [% END %]
809 [% INCLUDE 'intranet-bottom.inc' %]
810