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