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