Bug 26592: [20.05] Prevent XSS vulnerabilities when circ/ysearch.pl is used
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% PROCESS 'i18n.inc' %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% USE Price %]
8 [% USE ColumnsSettings %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Koha &rsaquo; Acquisitions  &rsaquo;
12     [% IF op == 'save' %]
13         [% IF ( suggestionid ) %]
14             Suggestions &rsaquo;  Edit suggestion #[% suggestionid | html %]
15         [% ELSE %]
16             Suggestions &rsaquo; Add suggestion
17         [% END %]
18     [% ELSIF ( op == 'show' ) %]
19            Suggestions &rsaquo; Show suggestion #[% suggestionid | html %]
20     [% ELSE %]
21         Suggestions management
22     [% END %]
23 </title>
24 [% INCLUDE 'doc-head-close.inc' %]
25 [% IF op == 'else' %]
26     <style>
27         h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
28         .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; }
29     </style>
30 [% END %]
31 </head>
32
33 <body id="acq_suggestion" class="acq">
34 [% INCLUDE 'header.inc' %]
35 [% INCLUDE 'cat-search.inc' %]
36 <div id="breadcrumbs">
37     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
38     [% IF op == 'save' %]
39         [% IF ( suggestionid ) %]
40             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid | html %]
41         [% ELSE %]
42             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
43         [% END %]
44     [% ELSIF ( op == 'show' ) %]
45            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid | html %]
46     [% ELSE %]
47         Suggestions management
48     [% END %]
49 </div>
50
51 [% IF ( op == 'show' ) %]
52     <div class="main container-fluid">
53         <div class="row">
54             <div class="col-md-8 col-md-offset-2">
55
56     <div id="toolbar" class="btn-toolbar">
57         <a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a>
58         <a class="btn btn-default deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
59     </div>
60
61     <fieldset class="rows">
62       <legend>Bibliographic information</legend>
63       <ol>
64             [% IF ( title ) %]
65                 <li>
66                     <span class="label">Title:</span>
67                     [% IF suggestion.biblionumber %]
68                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
69                     [% ELSE %]
70                         [% title | html %]
71                     [% END %]
72                 </li>
73             [% END %]
74             [% IF ( author ) %]
75                 <li>
76                     <span class="label">Author:</span>
77                     [% author | html %]
78                 </li>
79             [% END %]
80             [% IF ( copyrightdate ) %]
81                 <li>
82                     <span class="label">Copyright date:</span>
83                     [% copyrightdate | html %]
84                 </li>
85             [% END %]
86             [% IF ( isbn ) %]
87                 <li>
88                     <span class="label">ISBN or ISSN or other standard number:</span>
89                     [% isbn | html %]
90                 </li>
91             [% END %]
92             [% IF ( publishercode ) %]
93                 <li>
94                     <span class="label">Publisher:</span>
95                     [% publishercode | html %]
96                 </li>
97             [% END %]
98             [% IF ( place ) %]
99                 <li>
100                     <span class="label">Publication place:</span>
101                     [% place | html %]
102                 </li>
103             [% END %]
104             [% IF ( collectiontitle ) %]
105                 <li>
106                     <span class="label">Collection title:</span>
107                     [% collectiontitle | html %]
108                 </li>
109             [% END %]
110             [% IF ( itemtype ) %]
111                 <li>
112                     <span class="label">Document type:</span>
113                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
114                 </li>
115             [% END %]
116         [% IF ( patron_reason_loop ) %]
117           <li><span class="label">Reason for suggestion: </span>
118             [% FOREACH patron_reason_loo IN patron_reason_loop %]
119               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib | html %][% END %]
120             [% END %]
121           </li>
122         [% END %]
123             [% IF ( note ) %]
124                 <li>
125                     <span class="label">Notes:</span>
126                     [% note | html %]
127                 </li>
128             [% END %]
129       </ol>
130     </fieldset>
131     <fieldset class="rows"> <legend>Suggestion management</legend>
132       <ol>
133         <li>
134           <span class="label">Status:</span>
135           [% SET status_found = 0 %]
136           [% IF ( STATUS == 'ASKED' ) %]
137               Pending
138               [% SET status_found = 1 %]
139           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
140               Accepted
141               [% SET status_found = 1 %]
142           [% ELSIF ( STATUS == 'CHECKED' ) %]
143               Checked
144               [% SET status_found = 1 %]
145           [% ELSIF ( STATUS == 'REJECTED' ) %]
146               Rejected
147               [% SET status_found = 1 %]
148           [% ELSIF ( STATUS == 'ORDERED' ) %]
149               Ordered
150               [% SET status_found = 1 %]
151           [% ELSIF ( STATUS == 'AVAILABLE' ) %]
152               Available
153               [% SET status_found = 1 %]
154           [% ELSE %]
155               [% FOREACH s IN SuggestionStatuses %]
156                   [% IF STATUS == s.authorised_value %]
157                       [% s.lib | html %]
158                       [% SET status_found = 1 %]
159                   [% END %]
160               [% END %]
161           [% END %]
162
163         </li>
164         <li>
165          <span class="label">Reason:</span>
166             [% IF ( reason ) %]
167                 [% AuthorisedValues.GetByCode( 'SUGGEST', reason, 0 ) | html %]
168             [% END %]
169         </li>
170         <li>
171           <table>
172             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
173             <tbody>
174             <tr>
175                 <th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
176                 <td>[% suggesteddate | $KohaDates %]</td>
177                 <td>
178                     [% IF ( suggestedby_patron.borrowernumber ) %]
179                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]">[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>
180                         [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
181                     [% END %]
182                 </td>
183             </tr>
184             <tr>
185                 <th>Managed by:</th>
186                 <td>[% manageddate | $KohaDates %]</td>
187                 <td>
188                         [% IF ( managedby_patron.borrowernumber ) %]
189                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_patron.borrowernumber | uri %]">[% managedby_patron.surname | html %], [% managedby_patron.firstname | html %] ([% managedby_patron.cardnumber | html %])</a>
190                             [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
191                         [% END %]
192                 </td>
193             </tr>
194             <tr>
195                 <th>Accepted on:</th>
196                 <td>[% accepteddate | $KohaDates %]</td>
197                 <td>
198                     [% IF ( acceptedby_patron.borrowernumber ) %]
199                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]">[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% acceptedby_patron.cardnumber | html %])</a>
200                         [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
201                     [% END %]
202                 </td>
203             </tr>
204             <tr>
205                 <th>Last modification on:</th>
206                 <td>[% lastmodificationdate | $KohaDates %]</td>
207                 <td>
208                     [% IF ( lastmodificationby_patron.borrowernumber ) %]
209                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% lastmodificationby_patron.borrowernumber | uri %]">[% lastmodificationby_patron.surname | html %], [% lastmodificationby_patron.firstname | html %] ([% lastmodificationby_patron.cardnumber | html %])</a>
210                         [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
211                     [% END %]
212                 </td>
213             </tr>
214             </tbody>
215         </table></li></ol>
216     </fieldset>
217     <fieldset class="rows"> <legend>Acquisition information</legend>
218       <ol>
219         <li>
220           <span class="label">Library:</span> [% Branches.GetName( branchcode ) | html %]
221         </li>
222         <li>
223           <span class="label">Fund:</span> [% budgetname | html %]
224         </li>
225         <li>
226           <span class="label">Copies:</span>[% quantity | html %]
227         </li>
228         <li>
229           <span class="label">Currency:</span>[% currency | html %]
230         </li>
231         <li>
232           <span class="label">Price:</span>[% price | $Price %]
233         </li>
234         <li>
235           <span class="label">Total</span>[% total | $Price %]
236         </li>
237       </ol>
238     </fieldset>
239
240     <fieldset class="action">
241         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
242     </fieldset>
243
244     </div>
245     </div>
246 </div>
247 [% ELSE %]
248
249 [% IF op == 'save' %]
250     <div class="main container-fluid">
251         <div class="row">
252             <div class="col-md-8 col-md-offset-2">
253 [% ELSE %]
254     <div class="main container-fluid">
255         <div class="row">
256             <div class="col-sm-10 col-sm-push-2">
257                 <main>
258
259 [% END %]
260
261 [% IF op == 'save' %]
262     [% FOR m IN messages %]
263         <div class="dialog [% m.type | html %]">
264             [% SWITCH m.code %]
265             [% CASE 'biblio_exists' %]
266                 A similar document already exists: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
267             [% CASE %]
268                 [% m.code | html %]
269             [% END %]
270         </div>
271     [% END %]
272     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
273     <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
274     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
275     [% IF ( suggestionid ) %]
276         <h1>Edit purchase suggestion #[% suggestionid | html %]</h1>
277         <input type="hidden" name="suggestionid" value="[% suggestionid | html %]"/>
278     [% ELSE %]
279         <h1>Enter a new purchase suggestion</h1>
280     [% END %]
281     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
282         <li>
283             <label for="title" class="required">Title:</label>
284             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title | html %]" required="required" class="required" />
285             <span class="required">Required</span>
286         </li>
287         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
288         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
289         <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>
290         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
291         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
292         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
293         <li><label for="itemtype">Document type:</label>
294             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
295         </li>
296         [% IF patron_reason_loop %]
297             <li>
298                 <label for="patronreason">Reason for suggestion: </label>
299                 <select name="patronreason" id="patronreason">
300                     <option value=""> -- Choose -- </option>
301                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
302                         [% IF patron_reason_loo.authorised_value == patronreason %]
303                             <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
304                         [% ELSE %]
305                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
306                         [% END %]
307                     [% END %]
308                 </select>
309             </li>
310         [% END %]
311         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea></li>
312         </ol>
313     </fieldset>
314     <fieldset class="rows"> <legend>Suggestion management</legend>
315        <ol>
316             [% IF ( suggestionid ) %]
317                 <li>
318                     <label for="STATUS">Status:</label>
319                     <select id="STATUS" name="STATUS">
320                         <option value="">No status</option>
321
322                         [% IF (statusselected_ASKED ) %]
323                             <option value="ASKED" selected="selected">Pending</option>
324                         [% ELSE %]
325                             <option value="ASKED">Pending</option>
326                         [% END %]
327
328                         [% IF (statusselected_ACCEPTED ) %]
329                             <option value="ACCEPTED" selected="selected">Accepted</option>
330                         [% ELSE %]
331                             <option value="ACCEPTED">Accepted</option>
332                         [% END %]
333
334                         [% IF (statusselected_CHECKED ) %]
335                             <option value="CHECKED" selected="selected">Checked</option>
336                         [% ELSE %]
337                             <option value="CHECKED">Checked</option>
338                         [% END %]
339
340                         [% IF ( statusselected_REJECTED ) %]
341                             <option value="REJECTED" selected="selected">Rejected</option>
342                         [% ELSE %]
343                             <option value="REJECTED">Rejected</option>
344                         [% END %]
345
346                         [% IF ( statusselected_ORDERED ) %]
347                             <option value="ORDERED" selected="selected">Ordered</option>
348                         [% ELSE %]
349                             <option value="ORDERED">Ordered</option>
350                         [% END %]
351
352                         [% FOREACH s IN SuggestionStatuses %]
353                             [% IF s.authorised_value == suggestion.STATUS %]
354                                 <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
355                             [% ELSE %]
356                                 <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
357                             [% END %]
358                         [% END %]
359                     </select>
360                 </li>
361                 <li>
362                     <label for="reason">Reason</label>
363                     <select class="select-reason" id="reason" name="reason">
364                         <option value=""> -- Choose a reason -- </option>
365                         [% FOREACH reasonsloo IN suggestion.reasonsloop %]
366                             [% IF (reasonsloo.lib == suggestion.reason) %]
367                                 <option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
368                             [% ELSE %]
369                                 <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
370                             [% END %]
371                         [% END %]
372                         <option value="other">Others...</option>
373                     </select>
374
375                     <span id="other_reason" name="other_reason">
376                         [% IF other_reason %]
377                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
378                         [% ELSE %]
379                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
380                         [% END %]
381                         <a href="#back">Cancel</a>
382                     </span>
383                 </li>
384             [% END %]
385         <li><table>
386             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th><th>Action</th></tr></thead>
387             <tbody>
388             <tr>
389                 <th><label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label> </th>
390                 <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
391                 <td id="tdsuggestedby"><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]">[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>  [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])[% END %]
392                 </td>
393                 <td><a href="#" id="suggester_search" class="btn btn-default">Set to patron</a></td>
394             </tr>
395             <tr>
396                 <th><label for="accepteddate">Accepted on:</label> </th>
397                 <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
398                 <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]">[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a> [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])[% END %]</td>
399                 <td></td>
400             </tr>
401             <tr>
402                 <th><label for="lastmodificationdate">Last modification on:</label> </th>
403                 <td>[% lastmodificationdate | $KohaDates %]</td>
404                 <td>
405                     [% IF lastmodificationby_patron %]
406                         [% INCLUDE 'patron-title.inc' patron=lastmodificationby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
407                     [% END %]
408                 </td>
409                 <td></td>
410             </tr>
411             </tbody>
412         </table></li>
413
414             <li>
415                 <label for="managedon">Managed on:</label>
416                 <input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
417             </li>
418             <li>
419                 <label for="managedby_name">by:</label>
420                 <div>
421                     <span id="managedby_name" name="managedby_name">
422                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% logged_in_user.borrowernumber | uri %]">You</a>
423                     </span>
424                     [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
425                         | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
426                     [% END %]
427                     <br />
428                     <a id="edit_manager" class="new_window" href="#"><i class="fa fa-search"></i> Select manager</a>
429                     [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
430                         <a id="restore_previous_manager" href="#"><i class="fa fa-trash"></i> Keep existing manager</a>
431                     [% END %]
432                     <input type="hidden" name="managedby" id="managedby" value="[% logged_in_user.borrowernumber | html %]" />
433
434                     <br/>
435                     <label for="notify">Notify manager:</label>
436                     <input type="checkbox" id="notify" name="notify" value="notify" disabled="disabled" title="A NOTIFY_MANAGER notice will be generated and send to the manager if a valid email address is defined. This can be checked if a new manager has been selected." />
437                 </div>
438             </li>
439         </ol>
440     </fieldset>
441     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
442         <li><label for="branchcode">Library:</label>
443             <select name="branchcode" id="branchcode">
444                 <option value="">Any</option>
445                 [% IF branchfilter %]
446                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
447                 [% ELSE %]
448                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
449                 [% END %]
450             </select>
451         </li>
452         <li><label for="budgetid">Fund:</label>
453             <select name="budgetid" id="budgetid">
454                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
455                 [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>[% END %][% END %]
456             </select>
457                 </li><li><label for="quantity">Copies:</label>
458             <input type="text" size="10" id="quantity" name="quantity" value="[% quantity | html %]" />
459                 </li>
460                 <li>
461                     <label for="currency">Currency:</label>
462                     [% FOREACH c IN currencies %]
463                         <input type="hidden" value="[% c.rate | html %]" id="currency_rate_[% c.currency | html %]" name="currency_rate_[% c.currency | html %]" />
464                         <input type="hidden" id="[% c.currency | html %]" name="[% c.currency | html %]" value="[% c.rate | html %]" />
465                     [% END %]
466
467                     <select name="currency" id="currency">
468                         [% FOREACH c IN currencies %]
469                             [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
470                                 <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
471                             [% ELSIF not c.archived %]
472                                 <option value="[% c.currency | html %]">[% c.currency | html %]</option>
473                             [% END %]
474                         [% END %]
475                     </select>
476                 </li>
477                 <li><label for="price">Price:</label>
478             <input type="text" size="20" name="price" id="price" value="[% price | html %]" />
479                 </li><li><label for="total">Total: </label>
480                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]"/>
481                 </li></ol>
482     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]noone[% END %]"/>
483     <fieldset class="action">
484         <input type="hidden" name="op" value="[% op | html %]" />
485         [% IF ( suggestionid ) %]
486             [% IF ( need_confirm ) %]
487                 <input type="hidden" name="save_confirmed" value="1" />
488                 <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
489             [% ELSE %]
490                 <input type="submit" value="Save" />
491             [% END %]
492             <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby | uri %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>
493         [% ELSE %]
494             [% IF ( need_confirm ) %]
495                 <input type="hidden" name="save_confirmed" value="1" />
496                 <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
497             [% ELSE %]
498                 <input type="submit" value="Submit your suggestion" />
499             [% END %]
500             <a class="cancel" href="suggestion.pl">Cancel</a>
501         [% END %]
502     </fieldset>
503     </form>
504 [% END %]
505
506 [% IF op == 'else' %]
507 <div id="toolbar" class="btn-toolbar">
508     <a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
509 </div>
510
511 <h1>Suggestions management</h1>
512
513
514 [% FOR m IN messages %]
515     <div class="dialog [% m.type | html %]">
516         [% SWITCH m.code %]
517         [% CASE 'already_exists' %]
518             The suggestion has not been added. A suggestion with this title already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id | html %]&op=show'>suggestion #[% m.id | html %]</a>)
519         [% CASE 'biblio_exists' %]
520             A similar document already exists: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
521         [% CASE %]
522             [% m.code | html %]
523         [% END %]
524     </div>
525 [% END %]
526
527 [% UNLESS ( notabs ) %]
528     <div id="suggestiontabs" class="toptabs">
529     <ul class="ui-tabs-nav">
530         [% FOREACH suggestion IN suggestions %]
531                 <li>
532             <a href="#[% suggestion.suggestiontype | uri %]">
533             [% IF ( suggestion.suggestiontypelabel ) %]
534                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
535                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
536                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
537                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
538                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
539                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
540                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Status unknown
541                 [% ELSE %][% suggestion.suggestiontypelabel | html %][% END %]
542             [% ELSE %]
543                 [% IF ( suggestion.suggestiontype ) %]
544                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) | html %]
545                 [% ELSE %]
546                     No name
547                 [% END %]
548             [% END %]
549             ([% suggestion.suggestions_loop.size | html %])</a></li>
550
551         [% END %]
552     </ul>
553 [% END %]
554
555 [% FOREACH suggestion IN suggestions %]
556 <div id="[% suggestion.suggestiontype | html %]">
557 <form class="update_suggestions" name="f" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype| uri %]">
558
559 [% IF ( suggestion.suggestions_loop ) %]
560 <p><a class="checkall" href="#">Check all</a> | <a class="uncheckall" href="#">Uncheck all</a></p>
561     <table id="table_[% loop.count | html %]" class="sorted">
562         <thead>
563             <tr>
564                 <th class="NoSort noExport">&nbsp;</th>
565                 <th class="anti-the">Suggestion</th>
566                 <th>Suggested by</th>
567                 <th>Suggested on</th>
568                 <th>Managed by</th>
569                 <th>Managed on</th>
570                 <th>Last modification by</th>
571                 <th>Last modification on</th>
572                 <th>Library</th>
573                 <th>Fund</th>
574                 <th>Status</th>
575                 <th class="NoSort noExport">&nbsp;</th>
576             </tr>
577     </thead>
578         <tbody>
579             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
580                 <tr>
581                 <td>
582                     <input type="checkbox" name="suggestionid" value="[% suggestions_loo.suggestionid | html %]" />
583                 </td>
584                 <td>
585                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&amp;op=show" title="suggestion" >
586                         [% suggestions_loo.title | html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author | html %][% END %]</a>
587                     <br />
588                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate | html %] [% END %]
589                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %]
590                         [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<div class="suggestion_note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>[% END %]
591                         [% IF suggestions_loo.archived %]<br /><i class="fa fa-archive"></i> Archived[% END %]
592                 </td>
593                 <td>
594                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamesuggestedby | html %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby | html %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby | html %])[% END %]</a>
595                 </td>
596                 <td data-order="[% suggestions_loo.suggesteddate | html %]">
597                     [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate | $KohaDates %][% END %]
598                 </td>
599                 <td>
600                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.managedby | uri %]">[% suggestions_loo.surnamemanagedby | html %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby | html %][% END %]</a>
601                 </td>
602                 <td data-order="[% suggestions_loo.manageddate | html %]">
603                     [% IF ( suggestions_loo.manageddate ) %][% suggestions_loo.manageddate | $KohaDates %][% END %]
604                 </td>
605                 <td>
606                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.lastmodificationby | uri %]">[% suggestions_loo.surnamelastmodificationby | html %][% IF ( suggestions_loo.firstnamelastmodificationby ) %], [% suggestions_loo.firstnamelastmodificationby | html %][% END %]</a>
607                 </td>
608                 <td data-order="[% suggestions_loo.lastmodificationdate | html %]">
609                     [% IF ( suggestions_loo.lastmodificationdate ) %][% suggestions_loo.lastmodificationdate | $KohaDates %][% END %]
610                 </td>
611                 <td>
612                     [% Branches.GetName( suggestions_loo.branchcode ) | html %]
613                 </td>
614                 <td>
615                     [% suggestions_loo.budget_name | html %]
616                 </td>
617                 <td>
618                     [% IF ( suggestions_loo.ASKED ) %]
619                         Pending
620                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
621                         Accepted
622                     [% ELSIF ( suggestions_loo.ORDERED ) %]
623                         Ordered
624                     [% ELSIF ( suggestions_loo.REJECTED ) %]
625                         Rejected
626                     [% ELSIF ( suggestions_loo.CHECKED ) %]
627                         Checked
628                     [% ELSIF ( suggestions_loo.AVAILABLE ) %]
629                         Available
630                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
631                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) | html %]
632                     [% ELSE %]
633                         Status unknown
634                     [% END %]
635
636                     [% IF ( suggestions_loo.reason ) %]
637                         <br />([% suggestions_loo.reason | html %])
638                     [% END %]
639                 </td>
640                 <td class="actions">
641                     <div class="btn-group dropup">
642                         <a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" id="more_actions_[% suggestions_loo.suggestionid | html %]" role="button" data-toggle="dropdown" href="#"><b class="caret"></b></a>
643                         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="more_actions_[% suggestions_loo.suggestionid | html %]">
644                             <li><a class="deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a></li>
645                             [% UNLESS suggestions_loo.archived %]
646                                 <li><a class="archivesuggestion" href="suggestion.pl?op=archive&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Archive</a></li>
647                             [% ELSE %]
648                                 <li><a class="unarchivesuggestion" href="suggestion.pl?op=unarchive&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Unarchive</a></li>
649                             [% END %]
650                         </ul>
651                     </div>
652                 </td>
653         </tr>
654         [% END %]</tbody>
655         </table>
656
657         <div class="row">
658             <h2 style="padding-left:1em;">Change selected suggestions</h3>
659             <div class="col-sm-4">
660                 <fieldset>
661                     <div id="select-reason">
662                        <label for="STATUS">Mark selected as: </label>
663                        <select name="STATUS" id="STATUS">
664                            <option value=""> -- Choose a status --</option>
665
666                            [% IF (statusselected_ASKED ) %]
667                                <option value="ASKED" selected="selected">Pending</option>
668                            [% ELSE %]
669                                <option value="ASKED">Pending</option>
670                            [% END %]
671
672                            [% IF (statusselected_ACCEPTED ) %]
673                                <option value="ACCEPTED" selected="selected">Accepted</option>
674                            [% ELSE %]
675                                <option value="ACCEPTED">Accepted</option>
676                            [% END %]
677
678                            [% IF (statusselected_CHECKED ) %]
679                                <option value="CHECKED" selected="selected">Checked</option>
680                            [% ELSE %]
681                                <option value="CHECKED">Checked</option>
682                            [% END %]
683
684                            [% IF ( statusselected_REJECTED ) %]
685                                <option value="REJECTED" selected="selected">Rejected</option>
686                            [% ELSE %]
687                                <option value="REJECTED">Rejected</option>
688                            [% END %]
689
690                            [% IF ( statusselected_ORDERED ) %]
691                                <option value="ORDERED" selected="selected">Ordered</option>
692                            [% ELSE %]
693                                <option value="ORDERED">Ordered</option>
694                            [% END %]
695
696                            [% FOREACH s IN SuggestionStatuses %]
697                                <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
698                            [% END %]
699                        </select>
700
701                        <label for="reason">with this reason:</label>
702                        <select name="reason">
703                            <option value=""> -- Choose a reason -- </option>
704                            [% FOREACH reasonsloo IN suggestion.reasonsloop %]
705                                <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
706                            [% END %]
707                            <option value="other">Others...</option>
708                        </select>
709
710                        <span class="other_reason">
711                            <input type="text" size="31" name="other_reason" placeholder="please note your reason here..." />
712                            <a href="#" class="cancel_note">Cancel</a>
713                        </span>
714                     </div>
715
716                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
717                     <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
718                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset>
719                 </fieldset>
720             </div>
721             <div class="col-sm-4">
722                 <fieldset>
723                     <label for="itemtype">Update item types with: </label>
724                     [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20  %]
725                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
726                     <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
727                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset>
728                 </fieldset>
729             </div>
730
731             <div class="col-sm-2">
732                 <fieldset>
733                     <label for="set_manager_[% loop.count | html %]">Update manager</label><br/>
734                     <a id="set_manager_[% loop.count | html %]" data-tab="[% loop.count | html %]" class="set_manager" href="#"><i class="fa fa-search"></i> Select manager</a>
735                     <span id="managedby_name[% loop.count | html %]"></span>
736                     <input type="hidden" name="suggestion_managedby" id="managedby[% loop.count | html %]" value="[% logged_in_user.borrowernumber | html %]" />
737                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
738                     <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
739                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_manager"/>Submit</button></fieldset>
740                 </fieldset>
741             </div>
742
743             <div class="col-sm-2">
744                 <fieldset>
745                     <label for="delete_[% loop.count | html %]">Delete selected</label>
746                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
747                     <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
748                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset>
749                 </fieldset>
750             </div>
751
752         </div>
753
754 [% ELSE %]
755     <b>No results.</b>
756 [% END %]
757 </form>
758 </div>
759 [% END %]
760 [% END %]
761
762 [% UNLESS op == 'save' %]
763     [% UNLESS ( op == 'show' ) %]
764
765             </main>
766         </div> <!-- /.col-sm-10.col-sm-push-2 -->
767
768         <div class="col-sm-2 col-sm-pull-10">
769             <aside>
770
771 <form name="suggestionfilter" action="suggestion.pl" method="get">
772 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
773                 <select name="displayby" id="displayby" style="width:auto;">
774                     [% IF ( displayby == "STATUS" ) %]
775                         <option value="STATUS" selected="selected">Status</option>
776                     [% ELSE %]
777                         <option value="STATUS">Status</option>
778                     [% END %]
779                     [% IF ( displayby == "branchcode" ) %]
780                         <option value="branchcode" selected="selected">Library</option>
781                     [% ELSE %]
782                         <option value="branchcode">Library</option>
783                     [% END %]
784                     [% IF ( displayby == "itemtype" ) %]
785                         <option value="itemtype" selected="selected">Item type</option>
786                     [% ELSE %]
787                         <option value="itemtype">Item type</option>
788                     [% END %]
789                     [% IF ( displayby == "managedby" ) %]
790                         <option value="managedby" selected="selected">Managed by</option>
791                     [% ELSE %]
792                         <option value="managedby">Managed by</option>
793                     [% END %]
794                     [% IF ( displayby == "acceptedby" ) %]
795                         <option value="acceptedby" selected="selected">Accepted by</option>
796                     [% ELSE %]
797                         <option value="acceptedby">Accepted by</option>
798                     [% END %]
799                 </select>
800                 <input type="submit" value="Go" />
801                 </li>
802                 </ol>
803                 </fieldset>
804
805 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
806                 <div style="display:block;" id="limits">
807
808                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
809                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title | html %]" /></li>
810                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
811                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
812                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
813                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
814                     <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>
815                 </fieldset>
816                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
817                     <ol>
818                         <li>
819                             <label for="archived" style="display: inline;">Include archived:</label>
820                             [% IF filter_archived %]
821                                 <input type="checkbox" id="archived" name="filter_archived" checked="checked" title="Include archived suggestions in the search" />
822                             [% ELSE %]
823                                 <input type="checkbox" id="archived" name="filter_archived" title="Include archived suggestions in the search" />
824                             [% END %]
825                       </li>
826                       <li>
827                           <label for="STATUS"> Status:</label>
828
829                           <select name="STATUS" id="STATUS">
830                               <option value="">Any</option>
831
832                               [% IF (statusselected_ASKED ) %]
833                                   <option value="ASKED" selected="selected">Pending</option>
834                               [% ELSE %]
835                                   <option value="ASKED">Pending</option>
836                               [% END %]
837
838                               [% IF (statusselected_ACCEPTED ) %]
839                                   <option value="ACCEPTED" selected="selected">Accepted</option>
840                               [% ELSE %]
841                                   <option value="ACCEPTED">Accepted</option>
842                               [% END %]
843
844                               [% IF (statusselected_CHECKED ) %]
845                                   <option value="CHECKED" selected="selected">Checked</option>
846                               [% ELSE %]
847                                   <option value="CHECKED">Checked</option>
848                               [% END %]
849
850                               [% IF ( statusselected_REJECTED ) %]
851                                   <option value="REJECTED" selected="selected">Rejected</option>
852                               [% ELSE %]
853                                   <option value="REJECTED">Rejected</option>
854                               [% END %]
855
856                                [% IF ( statusselected_ORDERED ) %]
857                                    <option value="ORDERED" selected="selected">Ordered</option>
858                                [% ELSE %]
859                                    <option value="ORDERED">Ordered</option>
860                                [% END %]
861
862                               [% FOREACH s IN SuggestionStatuses %]
863                                   [% IF s.authorised_value == selected_status %]
864                                       <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
865                                   [% ELSE %]
866                                       <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
867                                   [% END %]
868                               [% END %]
869                           </select>
870                       </li>
871
872                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
873 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code | html %]" selected="selected">[% suggestedby_loo.desc | html %]</option>[% ELSE %]<option value="[% suggestedby_loo.code | html %]">[% suggestedby_loo.desc | html %]</option>[% END %][% END %]
874                                                                      </select></li>
875                     <li>
876                         <label for="suggesteddate_from">Suggested date from:</label>
877                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" />
878                     </li>
879                     <li>
880                         <label for="suggesteddate_to">To:</label>
881                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" />
882                     </li>
883                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
884 [% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code | html %]" selected="selected">[% managedby_loo.desc | html %]</option>[% ELSE %]<option value="[% managedby_loo.code | html %]">[% managedby_loo.desc | html %]</option>[% END %][% END %]
885                                                                      </select></li>
886                     <li>
887                         <label for="manageddate_from">Management date from:</label>
888                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from | html %]" />
889                     </li>
890                     <li>
891                         <label for="manageddate_to">To:</label>
892                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to | html %]" />
893                     </li>
894                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
895 [% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code | html %]" selected="selected">[% acceptedby_loo.desc | html %]</option>[% ELSE %]<option value="[% acceptedby_loo.code | html %]">[% acceptedby_loo.desc | html %]</option>[% END %][% END %]
896                                                       </select></li>
897                     <li>
898                         <label for="accepteddate_from">Accepted date from:</label>
899                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from | html %]" />
900                     </li>
901                     <li>
902                         <label for="accepteddate_to">To:</label>
903                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" />
904                     </li>
905                     <li>
906                         <input type="submit" value="Go" />
907                     </li>
908                 </ol>
909                 </fieldset>
910
911                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
912                     <ol><li><label for="budgetid"> Book fund:</label>
913                     <select name="budgetid" id="budgetid">
914                       <option value="__ANY__">Any</option>
915                       [% IF budgetid == '__NONE__' %]
916                           <option value="__NONE__" selected="selected">None</option>
917                       [% ELSE %]
918                           <option value="__NONE__">None</option>
919                       [% END %]
920                     [% FOREACH budgetsloo IN budgetsloop %]
921                         [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>[% END %]
922                         [% END %]
923                     </select></li>
924                     <li><label for="branchcode">Library:</label>
925                     <select name="branchcode" id="branchcode">
926                         <option value="__ANY__">Any</option>
927                         [% IF branchfilter %]
928                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
929                         [% ELSE %]
930                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
931                         [% END %]
932                     </select></li>
933                     <li>
934                         <input type="submit" value="Go" />
935                     </li>
936                 </ol>
937                 </fieldset>
938             </form>
939         [% INCLUDE 'acquisitions-menu.inc' %]
940
941             </aside>
942         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
943      </div> <!-- /.row -->
944
945     [% END %]
946     [% END %]
947 </div>
948 [% END %]
949
950 [% MACRO jsinclude BLOCK %]
951     [% INCLUDE 'calendar.inc' %]
952
953     <script>
954         var tab = '';
955         function editManagerPopup(selected_tab) {
956             tab = selected_tab;
957             window.open("/cgi-bin/koha/suggestion/add_user_search.pl?selection_type=select",
958                 'PatronPopup',
959                 'width=740,height=450,location=yes,toolbar=no,'
960                 + 'scrollbars=yes,resize=yes'
961             );
962         }
963         function select_user(borrowernumber, borrower) {
964             var managedby_name = $("#managedby_name"+tab);
965             var managedby = $("#managedby"+tab);
966             managedby_name.empty();
967             managedby.val('');
968             var borrowername = borrower.firstname + ' ' + borrower.surname;
969             if (borrowernumber) {
970                 var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
971                     + '?borrowernumber=' + borrowernumber + '">'
972                     + borrowername + '</a>';
973                 managedby_name.html(managerlink);
974                 managedby.val(borrowernumber);
975             }
976
977             [% IF op == "save" %]
978                 var notify = $('#notify');
979                 if ( notify.length ) {
980                     [% IF managedby_patron %]
981                         if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% managedby_patron.borrowernumber | html %] ) {
982                     [% ELSE %]
983                         if ( borrowernumber == [% logged_in_user.borrowernumber | html %] ) {
984                     [% END %]
985                         $(notify).prop('checked', false).prop('disabled', true);
986                     } else {
987                         $(notify).prop('disabled', false);
988                     }
989                 }
990             [% END %]
991         }
992
993         $(document).ready(function(){
994             $("#edit_manager").on("click",function(e){
995                 e.preventDefault();
996                 editManagerPopup('');
997             });
998             $(".set_manager").on("click",function(e){
999                 e.preventDefault();
1000                 var selected_tab = $(this).data('tab');
1001                 editManagerPopup(selected_tab);
1002             });
1003
1004         });
1005     </script>
1006
1007     [% IF ( op == 'show' || op == 'else' ) %]
1008         <script>
1009             $(document).ready(function(){
1010                 $(".deletesuggestion").on("click",function(){
1011                     return confirm(_("Are you sure you want to delete this suggestion?"));
1012                 });
1013             });
1014         </script>
1015     [% END %]
1016     [% IF op == 'else' %]
1017         [% INCLUDE 'datatables.inc' %]
1018         [% INCLUDE 'columns_settings.inc' %]
1019         <script>
1020             $(document).ready(function() {
1021                 $('#suggestiontabs').tabs();
1022
1023                 columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
1024                 [% FOREACH suggestion IN suggestions %]
1025                     [% IF ( suggestion.suggestions_loop ) %]
1026                         KohaTable("table_[% loop.count| html %]", {
1027                             "sorting": [[ 1, "asc" ]],
1028                             "autoWidth": false,
1029                             "columnDefs": [
1030                                 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
1031                                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
1032                             ]
1033                         }, columns_settings );
1034                     [% END %]
1035                 [% END %]
1036
1037                 $(".checkall").click(function(e){
1038                     e.preventDefault();
1039                     $(this).parents('form').find("input:checkbox").each(function(){
1040                         $(this).prop("checked", true);
1041                     });
1042                 });
1043                 $(".uncheckall").click(function(e){
1044                     e.preventDefault();
1045                     $(this).parents('form').find("input:checkbox").each(function(){
1046                         $(this).prop("checked", false);
1047                     });
1048                 });
1049                 $(".other_reason").hide();
1050                 $("select[name='reason']").change(function(){
1051                     if($(this).val() == "other"){
1052                         $(this).hide();
1053                         $(this).siblings(".other_reason").show();
1054                     }
1055                 });
1056
1057                 $("a.cancel_note").click(function(e) {
1058                     $(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected");
1059                     $(this).siblings("input[name='other_reason']").hide();
1060                     e.preventDefault();
1061                 });
1062                 $("h4.local_collapse a").click(function(){
1063                     $(this).parent().parent().find("ol").toggle();
1064                     return false;
1065                 });
1066                 // http://jqueryui.com/demos/datepicker/#date-range
1067                 var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
1068                     changeMonth: true,
1069                     numberOfMonths: 1,
1070                     onSelect: function( selectedDate ) {
1071                         var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
1072                             instance = $( this ).data( "datepicker" );
1073                             date = $.datepicker.parseDate(
1074                                 instance.settings.dateFormat ||
1075                                 $.datepicker._defaults.dateFormat,
1076                                 selectedDate, instance.settings );
1077                         dates.not( this ).datepicker( "option", option, date );
1078                     }
1079                 });
1080                 var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
1081                     changeMonth: true,
1082                     numberOfMonths: 1,
1083                     onSelect: function( selectedDate ) {
1084                         var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
1085                             instance = $( this ).data( "datepicker" );
1086                             date = $.datepicker.parseDate(
1087                                 instance.settings.dateFormat ||
1088                                 $.datepicker._defaults.dateFormat,
1089                                 selectedDate, instance.settings );
1090                         datesMD.not( this ).datepicker( "option", option, date );
1091                     }
1092                 });
1093                 var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
1094                     changeMonth: true,
1095                     numberOfMonths: 1,
1096                     onSelect: function( selectedDate ) {
1097                         var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
1098                             instance = $( this ).data( "datepicker" );
1099                             date = $.datepicker.parseDate(
1100                                 instance.settings.dateFormat ||
1101                                 $.datepicker._defaults.dateFormat,
1102                                 selectedDate, instance.settings );
1103                         datesAD.not( this ).datepicker( "option", option, date );
1104                     }
1105                 });
1106
1107                 $("button[type='submit']").on("click", function(e) {
1108                     var submit_button = this;
1109                     var form = $(submit_button).parents("form");
1110                     var action = $(submit_button).val();
1111                     var selected_suggestions = $(form).find("input[name='suggestionid']:checked");
1112                     if ( selected_suggestions.length == 0 ) {
1113                         alert(_("Please select at least one suggestion"));
1114                         e.preventDefault();
1115                         return false;
1116                     }
1117                     if ( action == "delete" ) {
1118                         if ( selected_suggestions.length == 1 ) {
1119                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
1120                                 e.preventDefault();
1121                                 return false;
1122                             }
1123                         } else if ( selected_suggestions.length > 1 ) {
1124                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
1125                                 e.preventDefault();
1126                                 return false;
1127                             }
1128                         }
1129                     } else if ( action == "update_manager" ) {
1130                         var managedby = $(submit_button).siblings("suggestion_managedby");
1131                         if ( managedby.val() == "" ) {
1132                             alert(_("Please select a manager to assign to the selected suggestions"));
1133                             e.preventDefault();
1134                             return false;
1135                         }
1136                     }
1137
1138                     $('<input />').attr('type', 'hidden')
1139                                   .attr('name', "op")
1140                                   .attr('value', action)
1141                                   .appendTo(form);
1142                     return true;
1143                 });
1144             });
1145         </script>
1146     [% END %]
1147     [% IF op == 'save'  %]
1148         <script>
1149
1150             $(document).ready(function(){
1151                 calcNewsuggTotal();
1152                 $("#quantity,#price,#currency").on("change",function(){
1153                     calcNewsuggTotal();
1154                 });
1155
1156                 [% IF other_reason %]
1157                     $(".select-reason").hide();
1158                     $(".select-reason").find("option[value='other']").attr("selected","selected");
1159                     $("#other_reason").show();
1160                 [% ELSE %]
1161                     $("#other_reason").hide();
1162                 [% END %]
1163                 $(".select-reason").change(function(){
1164                     if($(this).val() == "other"){
1165                         $(this).hide();
1166                         $("#other_reason").show();
1167                     }
1168                 });
1169                 $("a[href*=back]").click(function(){
1170                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
1171                     $("#other_reason").hide();
1172                 });
1173
1174                 $("#restore_previous_manager").on("click",function(e){
1175                     e.preventDefault();
1176
1177                     $("#managedby_name").empty();
1178                     $("#managedby").val('');
1179                     var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]";
1180                     var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1181                         + '?borrowernumber=[% managedby_patron.borrowernumber | html %]">'
1182                         + borrowername + '</a>';
1183                     $('#managedby_name').html(managerlink);
1184                     $('#managedby').val([% managedby_patron.borrowernumber | html %]);
1185                     $('#notify').prop('checked', false).prop('disabled', true);
1186                 });
1187
1188             });
1189         </script>
1190     [% END %]
1191     [% Asset.js("js/acq.js") | $raw %]
1192     [% Asset.js("js/acquisitions-menu.js") | $raw %]
1193     [% Asset.js("js/suggestions.js") | $raw %]
1194 [% END %]
1195 [% INCLUDE 'intranet-bottom.inc' %]