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