Bug 29311: Forbid editing biblio info when creating suggestion for biblio
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-suggestions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% USE AdditionalContents %]
8 [% SET opacsuggestion = AdditionalContents.get( location => "OpacSuggestioninstructions", lang => lang, library => logged_in_user.branchcode || default_branch ) %]
9 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
10 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
13 [% IF ( op_else ) %]Purchase suggestions[% END %] &rsaquo;
14 [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
15 [% INCLUDE 'doc-head-close.inc' %]
16 [% BLOCK cssinclude %][% END %]
17 </head>
18 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %]
19 [% INCLUDE 'masthead.inc' %]
20
21     <div class="main">
22         <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
23             <ol class="breadcrumb">
24                 <li class="breadcrumb-item">
25                     <a href="/cgi-bin/koha/opac-main.pl">Home</a>
26                 </li>
27                 [% IF ( logged_in_user ) %]
28                     <li class="breadcrumb-item">
29                         <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
30                     </li>
31                 [% END %]
32                 <li class="breadcrumb-item active">
33                     <a href="#" aria-current="page">Purchase suggestions</a>
34                 </li>
35             </ol>
36         </nav> <!-- /#breadcrumbs -->
37
38         <div class="container-fluid">
39             <div class="row">
40                 <div class="col col-lg-2 order-2 order-lg-1">
41                     <div id="navigation">
42                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
43                     </div>
44                 </div>
45                 <div class="col-md-12 col-lg-10 order-1">
46
47                     <div id="usersuggestions" class="maincontent">
48                         [% IF ( op_add ) %]
49                             <h1>Your purchase suggestions</h1>
50                             [% IF ( Koha.Preference('MaxTotalSuggestions') != '' && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]
51                                     <h2 class="TooManySuggestions">You cannot place any more suggestions</h2>
52                                     <p class="TooManySuggestionsText">You may only add up to [% Koha.Preference('MaxTotalSuggestions') | html %] suggestions in [% Koha.Preference('NumberOfSuggestionDays') | html %] days.</p>
53                             [% ELSIF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
54                                     <h2 class="TooManySuggestions">You cannot place any more suggestions</h2>
55                                     <p class="TooManySuggestionsText">You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.</p>
56                             [% ELSE %]
57
58                             [% IF ( opacsuggestion ) %]
59                                 [% PROCESS koha_news_block news => opacsuggestion %]
60                             [% ELSE %]
61                                 <h2>Enter a new purchase suggestion</h2>
62
63                                 <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion.</p>
64                                 <p>Only certain fields (marked in red) are required, but the more information you enter the easier it will be for the librarians to find the title you're requesting. The "Notes" field can be used to provide any additional information.</p>
65                             [% END %]
66                             [% FOR m IN messages %]
67                                 <div class="alert alert-[% m.type | html %]">
68                                     [% SWITCH m.code %]
69                                     [% CASE 'biblio_exists' %]
70                                         <span>A similar document already exists: <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.</span>
71                                     [% CASE %]
72                                         <span>[% m.code | html %]</span>
73                                     [% END %]
74                                 </div>
75                             [% END %]
76
77                             <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
78                                 <fieldset class="rows">
79                                     <ol>
80                                         [% IF Koha.Preference( 'OPACSuggestionAutoFill' ) %]
81                                             <li>
82                                                 <label for="isbn">Standard number (ISBN, ISSN or other):</label>
83                                                 <input type="text" id="isbn" name="isbn" maxlength="80" style="margin-right:10px;margin-top:10px;" size="15"/>
84                                             </li>
85                                         [% END %]
86                                         <li>
87                                             [% IF biblionumber %]
88                                                 <label>Title:</label>
89                                                 <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]">[% title | html %]</a>
90                                             [% ELSIF ( title_required ) %]
91                                                 <label for="title" class="required">Title:</label>
92                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
93                                                 <div class="required_label required">Required</div>
94                                             [% ELSE %]
95                                                 <label for="title">Title:</label>
96                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
97                                             [% END %]
98                                         </li>
99                                         [% UNLESS ( author_hidden ) %]
100                                             <li>
101                                                     [% IF biblionumber %]
102                                                         <label>Author:</label>
103                                                         <span>[% author | html %]</span>
104                                                     [% ELSIF ( author_required ) %]
105                                                         <label for="author" class="required">Author:</label>
106                                                         <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
107                                                         <div class="required_label required">Required</div>
108                                                     [% ELSE %]
109                                                         <label for="author">Author:</label>
110                                                         <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
111                                                     [% END %]
112                                             </li>
113                                         [% END %]
114                                         [% UNLESS ( copyrightdate_hidden )%]
115                                             <li>
116                                                 <div title="Copyright or publication year, for example: 2022">
117                                                     [% IF biblionumber %]
118                                                         <label>Publication year:</label>
119                                                         <span>[% copyrightdate | html %]</span>
120                                                     [% ELSIF ( copyrightdate_required ) %]
121                                                         <label for="copyrightdate" class="required">Publication year:</label>
122                                                         <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" maxlength="4" value="[% copyrightdate | html %]" required="required" />
123                                                         <div class="required_label required">Required</div>
124                                                         <span class="hint">Copyright or publication year, for example: 2022</span>
125                                                     [% ELSE %]
126                                                         <label for="copyrightdate">Publication year:</label>
127                                                         <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" maxlength="4" value="[% copyrightdate | html %]" />
128                                                         <span class="hint">Copyright or publication year, for example: 2022</span>
129                                                     [% END %]
130                                                 </div>
131                                             </li>
132                                         [% END %]
133                                         [% UNLESS ( isbn_hidden or Koha.Preference('OPACSuggestionAutoFill') ) %]
134                                             <li>
135                                                 [% IF biblionumber %]
136                                                     <label>Standard number (ISBN, ISSN or other):</label>
137                                                     <span>[% isbn | html %]</span>
138                                                 [% ELSIF ( isbn_required ) %]
139                                                     <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
140                                                     <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
141                                                     <div class="required_label required">Required</div>
142                                                 [% ELSE %]
143                                                     <label for="isbn">Standard number (ISBN, ISSN or other):</label>
144                                                     <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
145                                                 [% END %]
146                                             </li>
147                                         [% END %]
148                                         [% UNLESS ( publishercode_hidden ) %]
149                                             <li>
150                                                 [% IF biblionumber %]
151                                                     <label>Publisher:</label>
152                                                     <span>[% publishercode | html %]</span>
153                                                 [% ELSIF ( publishercode_required ) %]
154                                                     <label for="publishercode" class="required">Publisher:</label>
155                                                     <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
156                                                     <div class="required_label required">Required</div>
157                                                 [% ELSE %]
158                                                     <label for="publishercode">Publisher:</label>
159                                                     <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
160                                                 [% END %]
161                                             </li>
162                                         [% END %]
163                                         [% UNLESS ( collectiontitle_hidden ) %]
164                                             <li>
165                                                 [% IF biblionumber %]
166                                                     <label for="collectiontitle" class="required">Collection title:</label>
167                                                     <span>[% collectiontitle | html %]</span>
168                                                 [% ELSIF ( collectiontitle_required ) %]
169                                                     <label for="collectiontitle" class="required">Collection title:</label>
170                                                     <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
171                                                     <div class="required_label required">Required</div>
172                                                 [% ELSE %]
173                                                     <label for="collectiontitle">Collection title:</label>
174                                                     <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
175                                                 [% END %]
176                                             </li>
177                                         [% END %]
178                                         [% UNLESS ( place_hidden ) %]
179                                             <li>
180                                                 [% IF biblionumber %]
181                                                     <label for="place" class="required">Publication place:</label>
182                                                     <span>[% place | html %]</span>
183                                                 [% ELSIF ( place_required ) %]
184                                                     <label for="place" class="required">Publication place:</label>
185                                                     <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
186                                                     <div class="required_label required">Required</div>
187                                                 [% ELSE %]
188                                                     <label for="place">Publication place:</label>
189                                                     <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
190                                                 [% END %]
191                                             </li>
192                                         [% END %]
193                                         [% UNLESS ( quantity_hidden ) %]
194                                             <li id="opac-suggestion-quantity">
195                                                 [% IF ( quantity_required ) %]
196                                                     <label for="quantity" class="required">Quantity:</label>
197                                                     <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" value="[% quantity | html %]" />
198                                                     <div class="required_label required">Required</div>
199                                                 [% ELSE %]
200                                                     <label for="quantity">Quantity:</label>
201                                                     <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" value="[% quantity | html %]" />
202                                                 [% END %]
203                                             </li>
204                                         [% END %]
205                                         [% UNLESS ( itemtype_hidden )%]
206                                             <li>
207                                             [% IF ( itemtype_required ) %]
208                                                 <label for="itemtype" class="required">Item type:</label>
209                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, required = 1, blank = 1, default=itemtype %]
210                                                 <div class="required_label required">Required</div>
211                                             [% ELSE %]
212                                                 <label for="itemtype">Item type:</label>
213                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, blank = 1, default=itemtype %]
214                                             [% END %]
215                                             </li>
216                                         [% END %]
217                                         [% UNLESS ( branchcode_hidden )%]
218                                             <li>
219                                                 [% IF ( branchcode_required ) %]
220                                                     <label for="branch" class="required">Library:</label>
221                                                     <select name="branchcode" id="branch" required="required">
222                                                         <option value=""></option>
223                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => logged_in_user.branchcode ) %]
224                                                     </select>
225                                                     <div class="required_label required">Required</div>
226                                                 [% ELSE %]
227                                                     <label for="branch">Library:</label>
228                                                     <select name="branchcode" id="branch">
229                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => logged_in_user.branchcode ) %]
230                                                     </select>
231                                                 [% END %]
232                                             </li>
233                                         [% END %]
234                                         [% IF ( patron_reason_loop ) %]
235                                         [% UNLESS ( patronreason_hidden )%]
236                                             <li>
237                                                 [% IF ( patronreason_required ) %]
238                                                     <label for="patronreason" class="required">Reason for suggestion: </label>
239                                                     <select name="patronreason" id="patronreason" required="required">
240                                                         <option value="">-- Choose --</option>
241                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
242                                                             [% IF patron_reason_loo.authorised_value == patronreason %]
243                                                                 <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
244                                                             [% ELSE %]
245                                                                 <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
246                                                             [% END %]
247                                                         [% END %]
248                                                     </select>
249                                                     <div class="required_label required">Required</div>
250                                                 [% ELSE %]
251                                                     <label for="patronreason">Reason for suggestion: </label>
252                                                     <select name="patronreason" id="patronreason">
253                                                         <option value="">-- Choose --</option>
254                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
255                                                             [% IF patron_reason_loo.authorised_value == patronreason %]
256                                                                 <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
257                                                             [% ELSE %]
258                                                                 <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
259                                                             [% END %]
260                                                         [% END %]
261                                                     </select>
262                                                 [% END %]
263                                             </li>
264                                         [% END %]
265                                         [% END %]
266                                         [% UNLESS ( note_hidden ) %]
267                                             <li>
268                                                 [% IF ( note_required ) %]
269                                                     <label for="note" class="required">Notes:</label>
270                                                     <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
271                                                     <div class="required_label required">Required</div>
272                                                 [% ELSE %]
273                                                     <label for="note">Notes:</label>
274                                                     <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
275                                                 [% END %]
276                                             </li>
277                                         [% END %]
278
279                                         <!--  Add a hidden 'negcap' field -->
280                                         <li id="negcap" style="position: absolute; left: -2000px;">
281                                             negcap <input type="text" name="negcap"/>
282                                         </li>
283
284                                     </ol>
285                                 </fieldset>
286                                 <fieldset class="action">
287                                     <input type="hidden" name="suggested_by_anyone" value="[% suggested_by_anyone | html %]" />
288                                     [% IF need_confirm # Confirm that we want a duplicate %]
289                                         <input type="hidden" name="op" value="add_confirm" />
290                                         <input type="submit" class="btn btn-primary" value="Confirm your suggestion" />
291                                     [% ELSIF biblionumber # Create from an existing title %]
292                                         <input type="hidden" name="op" value="add_confirm" />
293                                         <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
294                                         <input type="submit" class="btn btn-primary" value="Submit your suggestion" />
295                                     [% ELSE # Not created from an existing title, search for possible duplicate %]
296                                         <input type="hidden" name="op" value="add_validate" />
297                                         <input type="submit" class="btn btn-primary" value="Submit your suggestion" />
298                                     [% END %]
299                                     <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a>
300                                 </fieldset>
301                             </form>
302                             [% END %]
303                         [% END #  IF op_add %]
304
305                         [% IF ( op_else ) %]
306                             <h1>
307                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
308                                     <span>Purchase suggestions</span>
309                                 [% ELSE %]
310                                     [% IF ( loggedinusername ) %]
311                                         <span>Your purchase suggestions</span>
312                                     [% ELSE %]
313                                         <span>Purchase suggestions</span>
314                                     [% END %]
315                                 [% END %]
316                             </h1>
317                             [% FOR m IN messages %]
318                                 <div class="alert alert-[% m.type | html %]">
319                                     [% SWITCH m.code %]
320                                     [% CASE 'total_suggestions' %]
321                                         <span>The suggestion has not been added. You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxTotalSuggestions') | html %] in [% Koha.Preference('NumberOfSuggestionDays') | html %] days).</span>
322                                     [% CASE 'too_many' %]
323                                         <span>The suggestion has not been added. You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.</span>
324                                     [% CASE 'already_exists' %]
325                                         <span>The suggestion has not been added. A suggestion with this title already exists.</span>
326                                     [% CASE 'success_on_inserted' %]
327                                         <span>Your suggestion has been submitted.</span>
328                                     [% CASE %]
329                                         <span>[% m.code | html %]</span>
330                                     [% END %]
331                                 </div>
332                             [% END %]
333
334                             [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
335
336                             [% IF (Koha.Preference( 'OPACViewOthersSuggestions' ) || loggedinusername) && (suggestions.size > 0 OR title_filter) %]
337                                 [% SET can_delete_suggestion = 0 %]
338                                 <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" id="search_suggestions_form" method="get">
339                                     <div class="form-row">
340                                         <div class="col-auto my-1">
341                                             <label for="title_filter">Search for:</label>
342                                         </div>
343                                         <div class="col-auto my-1">
344                                             <input type="text" name="title_filter" id="title_filter" value="[% title_filter | html %]" size="30" class="form-control form-control-sm" />
345                                         </div>
346                                         [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) %]
347                                             [% IF loggedinusername %]
348                                                 <div class="col-auto my-1">
349                                                     <label class="sr-only" for="suggested_by_anyone">Suggested by:</label>
350                                                     <select class="form-control form-control-sm" name="suggested_by_anyone" id="suggested_by_anyone">
351                                                         [% IF suggested_by_anyone %]
352                                                             <option value="0">Suggested by me</option>
353                                                             <option value="1" selected="selected">Suggested by anyone</option>
354                                                         [% ELSE %]
355                                                             <option value="0" selected="selected">Suggested by me</option>
356                                                             <option value="1">Suggested by anyone</option>
357                                                         [% END %]
358                                                     </select>
359                                                 </div>
360                                             [% END %]
361                                         [% END %]
362                                         <div class="col-auto my-1">
363                                             <button type="submit" class="btn btn-sm btn-primary">Go</button>
364                                         </div>
365                                     </div>
366                                 </form>
367                             [% END %]
368                             [% IF suggestions.size > 0 %]
369                                 [% SET can_delete_suggestion = 0 %]
370                                 <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions">
371                                     <input type="hidden" name="op" value="delete_confirm" />
372                                     [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
373                                         <div id="toolbar" class="toolbar clearfix">
374                                         [% IF ( Koha.Preference('MaxTotalSuggestions') != '' && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]
375                                                 <p class="TooManySuggestionsText">You may only add up to [% Koha.Preference('MaxTotalSuggestions') | html %] suggestions in [% Koha.Preference('NumberOfSuggestionDays') | html %] days.</p>
376                                         [% ELSIF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
377                                                 <p class="TooManySuggestionsText">You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]).</br>Once the library has processed those suggestions you will be able to place more.</p>
378                                         [% ELSE %]
379                                                 <a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus"  aria-hidden="true"></i> New purchase suggestion</a>
380                                         [% END %]
381                                         </div>
382                                     [% END %]
383
384                                     [% IF ( loggedinusername ) %]
385                                         <div class="selections-toolbar toolbar">
386                                             <div class="check_control">
387                                                 <span class="checkall"></span> <span class="clearall"></span>
388                                             </div>
389                                             <div class="links">
390                                                 <span class="selections">Select suggestions to: </span>
391                                                 <span id="removeitems">
392                                                     <a href="#" class="btn btn-link removeitems tag_hides disabled"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
393                                                 </span>
394                                             </div>
395                                         </div>
396                                     [% END %]
397
398                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 || loggedinusername %]
399                                     <table id="suggestt" class="table table-bordered tabled">
400                                         <caption class="sr-only">Your purchase suggestions<caption>
401                                         <thead>
402                                             <tr>
403                                                 [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
404                                                 <th>Summary</th>
405                                                 <th>Suggested on</th>
406                                                 <th>Note</th>
407                                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %]
408                                                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %]
409                                                 <th>Status</th>
410                                             </tr>
411                                         </thead>
412                                         <tbody>
413                                             [% FOREACH suggestion IN suggestions %]
414                                                 <tr>
415                                                     [% IF logged_in_user %]
416                                                         <td class="selectcol">
417                                                             [% IF logged_in_user.borrowernumber == suggestion.suggester.borrowernumber %]
418                                                                 [% SET can_delete_suggestion = 1 %]
419                                                                 <input type="checkbox" class="cb" id="id[% suggestion.suggestionid | html %]" name="delete_field" data-title="[% suggestion.title | html %]" value="[% suggestion.suggestionid | html %]" />
420                                                             [% END %]
421                                                         </td>
422                                                     [% END %]
423                                                     <td>
424                                                         <p>
425                                                             <label for="id[% suggestions_loo.suggestionid | html %]">
426                                                                 [% IF suggestion.biblionumber %]
427                                                                     <strong><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a></strong>
428                                                                 [% ELSE %]
429                                                                     <strong>[% suggestion.title | html %]</strong>
430                                                                 [% END %]
431                                                             </label>
432                                                         </p>
433                                                             <p>[% IF ( suggestion.author ) %][% suggestion.author | html %],[% END %]
434                                                                 [% IF ( suggestion.copyrightdate ) %] - [% suggestion.copyrightdate | html %],[% END %]
435                                                                 [% IF ( suggestion.publishercode ) %] - [% suggestion.publishercode | html %][% END %]
436                                                                 [% IF ( suggestion.place ) %]([% suggestion.place | html %])[% END %]
437                                                                 [% IF ( suggestion.collectiontitle ) %] , [% suggestion.collectiontitle | html %][% END %]
438                                                                 [% IF ( suggestion.itemtype ) %] - [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestion.itemtype, 1 ) | html %][% END %]
439                                                         </p>
440                                                     </td>
441                                                     <td data-order="[% suggestion.suggesteddate | html %]">
442                                                         [% IF ( suggestion.suggesteddate ) %][% suggestion.suggesteddate |$KohaDates %][% END %]
443                                                     </td>
444                                                     <td>
445                                                         [% IF ( suggestion.note ) %]
446                                                             <span class="tdlabel">Note: </span>
447                                                             [% suggestion.note | html %]
448                                                         [% END %]
449                                                     </td>
450                                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
451                                                         <td>
452                                                             [% IF suggestion.suggestedby %]
453                                                                 <span class="tdlabel">Suggested for:</span>
454                                                                 [% Branches.GetName(suggestion.suggester.branchcode) | html %]
455                                                             [% END %]
456                                                         </td>
457                                                     [% END %]
458                                                     [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]
459                                                     <td>
460                                                         [% IF suggestion.managedby %]
461                                                             <span class="tdlabel">Managed by:</span>
462                                                             [% INCLUDE 'patron-title.inc' patron = suggestion.manager %]
463                                                             [% IF ( suggestion.manageddate ) %] - [% suggestion.manageddate | $KohaDates %][% END %]
464                                                         [% END %]
465                                                     </td>
466                                                     [% END %]
467                                                     <td>
468                                                         <span class="tdlabel">Status:</span>
469                                                         [% IF ( suggestion.STATUS == 'ASKED' ) %]<span>Requested</span>
470                                                         [% ELSIF ( suggestion.STATUS == 'CHECKED' ) %]<span>Checked by the library</span>
471                                                         [% ELSIF ( suggestion.STATUS == 'ACCEPTED' ) %]<span>Accepted by the library</span>
472                                                         [% ELSIF ( suggestion.STATUS == 'ORDERED' ) %]<span>Ordered by the library</span>
473                                                         [% ELSIF ( suggestion.STATUS == 'REJECTED' ) %]<span>Suggestion declined</span>
474                                                         [% ELSIF ( suggestion.STATUS == 'AVAILABLE' ) %]<span>Available in the library</span>
475                                                         [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS, 1 ) | html %] [% END %]
476                                                         [% IF ( suggestion.reason ) %]([% suggestion.reason | html %])[% END %]
477                                                     </td>
478                                                 </tr>
479                                             [% END # / FOREACH suggestions %]
480                                         </tbody>
481                                     </table>
482                                     [% END %]
483
484                                     [% IF ( loggedinusername && can_delete_suggestion ) %]
485                                         <fieldset class="action">
486                                             <input type="submit" class="btn btn-danger removeitems" value="Delete selected" />
487                                         </fieldset>
488                                     [% END %]
489                                 </form>
490                             [% ELSE %]
491                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) %]
492                                     [% IF title_filter %]
493                                         <div class="alert alert-info" role="alert">There are no pending purchase suggestions matching your search.</div>
494                                     [% ELSIF loggedinusername AND NOT suggested_by_anyone %]
495                                         <div class="alert alert-info" role="alert">You have no pending purchase suggestions. <a href="/cgi-bin/koha/opac-suggestions.pl?suggested_by_anyone=1">View all suggestions</a></div>
496                                     [% ELSE %]
497                                         <div class="alert alert-info" role="alert">There are no pending purchase suggestions.</div>
498                                     [% END %]
499                                 [% ELSE %]
500                                     [% IF ( loggedinusername ) %]
501                                         [% IF title_filter %]
502                                             <div class="alert alert-info" role="alert">There are no pending purchase suggestions matching your search.</div>
503                                         [% ELSE %]
504                                             <div class="alert alert-info" role="alert">You have no pending purchase suggestions.</div>
505                                         [% END %]
506                                     [% ELSE %]
507                                         <div class="alert alert-warning" role="alert">You are not authorized to see pending purchase suggestions.</div>
508                                     [% END %]
509                                 [% END %]
510                                 [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
511                                     [% IF ( Koha.Preference('MaxTotalSuggestions') != ''  && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]
512                                         <p class="TooManySuggestionsText">You may only add up to [% Koha.Preference('MaxTotalSuggestions') | html %] suggestions in [% Koha.Preference('NumberOfSuggestionDays') | html %] days.</p>
513                                     [% ELSIF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
514                                         <p class="TooManySuggestionsText">You have reached your limit for suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more.</p>
515                                     [% ELSE %]
516                                         <p><a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus" aria-hidden="true"></i> New purchase suggestion</a></p>
517                                     [% END %]
518                                 [% END %]
519                             [% END # / IF suggestions.size %]
520
521                         [% END # IF op_else %]
522                     </div> <!-- / #usersuggestions -->
523                 </div> <!-- / .col-lg-10 -->
524             </div> <!-- / .row -->
525         </div> <!-- / .container-fluid -->
526     </div> <!-- / .main -->
527
528 [% INCLUDE 'opac-bottom.inc' %]
529 [% BLOCK jsinclude %]
530 [% IF Koha.Preference("OPACSuggestionAutoFill") %]
531     [% Asset.js("js/autofill.js") | $raw %]
532 [% END %]
533 [% INCLUDE 'datatables.inc' %]
534 <script>
535     [% IF ( loggedinusername ) %]
536         function enableCheckboxActions(){
537             // Enable/disable controls if checkboxes are checked
538             var checkedBoxes = $(".cb:checked");
539             if ($(checkedBoxes).size()) {
540               $(".selections").html(_("With selected suggestions: "));
541               $(".selections-toolbar .links a").removeClass("disabled");
542             } else {
543               $(".selections").html(_("Select suggestions to: "));
544               $(".selections-toolbar .links a").addClass("disabled");
545             }
546         }
547     [% END %]
548
549     [% IF Koha.Preference( 'OPACSuggestionAutoFill' ) %]
550     $(function() {
551         $('#isbn').autofill({
552             'volumeInfo.title': {target: 'title', effect: 'flash'},
553             'volumeInfo.authors': {target: 'author', effect: 'flash'},
554             'volumeInfo.publisher': {target: 'publishercode', effect: 'flash'},
555             'volumeInfo.publishedDate': {target: 'copyrightdate', effect: 'flash'},
556             /* google books api seem to only have books, so if we got a result
557              * item, type will be a book, so set to BK (book). */
558             'kind': {target: 'itemtype', handle: function(t,v) { t.val('BK'); },},
559         });
560     });
561     [% END %]
562
563     $(function() {
564         $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, {
565             "order": [[ 1, "asc" ]],
566             "autoWidth": false,
567             "columnDefs": [
568               [% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %]
569             ],
570             "columns": [
571                 [% IF ( loggedinusername ) %]null,[% END %]
572                 { "type": "anti-the" },
573                 null,
574                 null,
575                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %]
576                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %]
577                 null
578             ]
579         }));
580         [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Clear all")+"<\/a>");
581         $("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Select all")+"<\/a>");
582         $("#CheckAll").on("click",function(e){
583             e.preventDefault();
584             $(".cb").prop("checked", true);
585             enableCheckboxActions();
586         });
587         $("#CheckNone").on("click",function(e){
588             e.preventDefault();
589             $(".cb").prop("checked", false);
590             enableCheckboxActions();
591         });
592         $(".cb").click(function(){
593           enableCheckboxActions();
594         });
595
596         enableCheckboxActions();
597
598         $(".removeitems").on("click", function(e) {
599             e.preventDefault();
600             var selected_titles = $("input:checked");
601             var title;
602             var yes_label;
603             var no_label;
604             var message = "";
605             if ( selected_titles.size() < 1 ) {
606                 alert(MSG_NO_SUGGESTION_SELECTED);
607                 return false;
608             } else {
609                 if( selected_titles.size() > 1 ){
610                     message = $("<ul></ul>");
611                     title = _("Are you sure you want to delete these suggestions?");
612                     yes_label = _("Yes, delete suggestions");
613                     no_label = _("No, do not delete suggestions");
614                     selected_titles.each(function(){
615                         message.append( "<li>" +  $(this).data("title") + "</li>" );
616                     });
617                 } else {
618                     title = _("Are you sure you want to delete this suggestion?");
619                     yes_label = _("Yes, delete suggestion");
620                     no_label = _("No, do not delete suggestion");
621                     selected_titles.each(function(){
622                         message += $(this).data("title");
623                     });
624                 }
625                 confirmModal( message, title, yes_label, no_label, function( result ){
626                     if( result ){
627                         $("#delete_suggestions").submit();
628                     }
629                 });
630             }
631         });
632         [% END %]
633     });
634 </script>
635 [% END %]