Bug 35307: Add a hidden input for expired holds
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / patron_messages.inc
1 [% USE raw %]
2 [% USE Branches %]
3 [% SET ClaimReturnedWarningThreshold = Koha.Preference('ClaimReturnedWarningThreshold') %]
4 [% SET return_claims = patron.return_claims %]
5 [% SET logged_in_branchcode = Branches.GetLoggedInBranchcode() %]
6
7 [% IF ( has_modifications || warndeparture || returnbeforeexpiry || expired || patron.gonenoaddress || patron.lost || userdebarred || odues || ( return_claims.count > ClaimReturnedWarningThreshold ) || age_limitations || charges || charges_guarantors_guarantees || charges_guarantees || credits ) %]
8     <h3>Attention</h3>
9     <ul>
10         [% IF ( has_modifications ) %]
11             <li class="has_modifications">
12                 <span class="circ-hlt">Pending modifications:</span>
13                 [% IF CAN_user_borrowers_edit_borrowers && ( !Koha.Preference('IndependentBranchesPatronModifications') || borrower.branch == branch ) %]
14                     <a href="/cgi-bin/koha/members/members-update.pl?active=[% patron.borrowernumber | uri %]">Review pending modifications</a>
15                 [% ELSE %]
16                     <span>Patron has pending modifications</span>
17                 [% END %]
18             </li>
19         [% END %]
20
21         [% IF ( warndeparture ) %]
22             <li class="warndeparture">
23                 <span class="circ-hlt">Expiration:</span>
24                 <span>Patron's card expires on [% patron.dateexpiry | $KohaDates %].</span>
25                 <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% patron.borrowernumber | html %]">Edit details</a>
26             </li>
27         [% END %]
28
29         [% IF ( returnbeforeexpiry ) %]
30             <li class="returnbeforeexpiry">
31                 <span class="circ-hlt">Set due date to expiry:</span> You have the ReturnBeforeExpiry system preference enabled this means if the expiry date is before the date due, the date due will be set to the expiry date
32             </li>
33         [% END %]
34
35         [% IF ( expired ) %]
36             <li class="expired">
37                 <span class="circ-hlt">Expiration:</span>
38                 <span>Patron's card has expired.</span>
39                 [% IF ( expiry ) %]
40                     <span>Patron's card expired on [% expiry | $KohaDates %]</span>
41                 [% END %]
42                 <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% patron.borrowernumber | html %]">Edit details</a>
43             </li>
44         [% END %]
45
46         [% IF ( patron.gonenoaddress ) %]
47             <li class="gonenoaddress blocker">
48                 <span title="gonenoaddress flag is set in patron record"><span class="circ-hlt">Address:</span> Patron's address flagged as in doubt</span>
49             </li>
50         [% END %]
51
52         [% IF ( patron.lost ) %]
53             <li class="lost blocker">
54                 <span title="lost flag is set in patron record"><span class="circ-hlt">Lost: </span> Patron's card is flagged as lost</span>
55             </li>
56         [% END %]
57
58         [% IF ( userdebarred ) %]
59             <li class="userdebarred blocker">
60                 <span class="circ-hlt"> Restricted since [% debarredsince | $KohaDates %]:</span> Patron's account is restricted
61
62                 [% IF ( userdebarreddate ) %]
63                     until [% userdebarreddate | $KohaDates %]
64                 [% END %]
65
66                 [% IF ( debarredcomment ) %]
67                     with the explanation: <br/>
68                     <em>
69                         [% IF debarredcomment.search('OVERDUES_PROCESS') %]
70                             Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %]
71                         [% ELSE %]
72                             [% debarredcomment | $raw | html_line_break %]
73                         [% END %]
74                     </em><br/>
75                 [% END %]
76                 <a class="btn btn-xs btn-default" href="#reldebarments-tab" onclick="$('#reldebarments-tab').click()"><i class="fa fa-ban"></i> View restrictions</a>
77
78                 [% IF (noissues && CAN_user_circulate_force_checkout) %]
79                     <span class="override_debarment">
80                         <a href="/cgi-bin/koha/circ/circulation.pl?forceallow=1&amp;borrowernumber=[% patron.borrowernumber | uri %]" class="btn btn-xs btn-default">Override restriction temporarily</a>
81                     </span>
82                 [% END %]
83             </li> <!-- /.blocker -->
84         [% END # /IF userdebarred %]
85
86         [% IF ( odues ) %]
87             <li class="odues blocker">
88                 <span class="circ-hlt">Overdues:</span>  Patron has ITEMS OVERDUE <a href="#checkouts">See highlighted items below</a>
89             </li>
90         [% END %]
91
92         [% IF return_claims.count > ClaimReturnedWarningThreshold %]
93             <li class="return_claims blocker">
94                 <span class="circ-hlt return-claims">Return claims:</span> Patron has [% return_claims.count | html %] RETURN CLAIMS
95             </li>
96         [% END %]
97
98         [% IF age_limitations %]
99             [% INCLUDE 'category-out-of-age-limit.inc' %]
100         [% END %]
101
102         [% IF ( charges ) %]
103             [% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
104         [% END %]
105
106         [% IF ( charges_guarantors_guarantees ) %]
107             <li class="charges_guarantors_guarantees">
108                 <span class="circ-hlt">Charges:</span> Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %].
109                 [% IF noissues %]
110                     <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
111                 [% END %]
112             </li>
113         [% END %]
114
115         [% IF ( charges_guarantees ) %]
116             <li class="charges_guarantees">
117                 <span class="circ-hlt">Charges:</span> Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %].
118                     [% IF noissues %]
119                         <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
120                     [% END %]
121             </li>
122         [% END %]
123
124         [% IF ( credits ) %]
125             <li class="credits">
126                 <span class="circ-hlt">Credits:</span> Patron has a credit[% IF ( creditsamount ) %] of <span class="credit"><strong>[% creditsamount | $Price %]</strong></span>[% END %]
127             </li>
128         [% END %]
129
130     </ul>
131
132 [% END # /F ( has_modifications || warndeparture... %]
133
134 [% IF waiting_recalls.count %]
135     <div id="recallswaiting" class="circmessage">
136         [% SET waiting_here = 0 %]
137         [% SET waiting_elsewhere = 0 %]
138         [% FOREACH w IN waiting_recalls %]
139             [% IF ( w.pickup_library_id == logged_in_branchcode  ) %]
140                 [% waiting_here = waiting_here + 1 %]
141             [% ELSE %]
142                 [% waiting_elsewhere = waiting_elsewhere + 1 %]
143             [% END %]
144         [% END %]
145
146         [% IF ( waiting_here > 0 ) %]
147             <h4>Recalls waiting here ([% waiting_here | html %])</h4>
148             <ul>
149                 [% FOREACH w IN waiting_recalls %]
150                     [% IF ( w.pickup_library_id == logged_in_branchcode  ) %]
151                         <li>
152                             <a href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% w.biblio_id | uri %]">[% w.biblio.title | html %]</a>
153                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
154                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
155                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
156                             <span>Recall placed on [% w.created_date | $KohaDates %].</span>
157                             <br />
158                             <strong class="waitinghere">
159                                 [% SET expires_on = w.expiration_date %]
160                                 Waiting here [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
161                             </strong>
162                         </li>
163                     [% END %]
164                 [% END %]
165             </ul>
166         [% END %]
167
168         [% IF ( waiting_elsewhere > 0 ) %]
169             <h4>Recalls waiting at other libraries ([% waiting_elsewhere | html %])</h4>
170             <ul>
171                 [% FOREACH w IN waiting_recalls %]
172                     [% IF ( w.pickup_library_id != logged_in_branchcode  ) %]
173                         <li>
174                             <a href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% w.biblio_id | uri %]">[% w.biblio.title | html %]</a>
175                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
176                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
177                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
178                             <span>Recall placed on [% w.created_date | $KohaDates %].</span>
179                             <br />
180                             <strong>
181                                 [% SET expires_on = w.expiration_date %]
182                                 Waiting at [% Branches.GetName( w.pickup_library_id ) | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
183                             </strong>
184                         </li>
185                     [% END %]
186                 [% END %]
187             </ul>
188         [% END %]
189     </div>
190 [% END # /IF waiting_recalls.count %]
191
192 [% IF WaitingHolds.count %]
193     <div id="holdswaiting" class="circmessage">
194         [% SET waiting_here = 0 %]
195         [% SET waiting_elsewhere = 0 %]
196         [% FOREACH w IN WaitingHolds %]
197             [% IF ( w.branch.branchcode == logged_in_branchcode  ) %]
198                 [% waiting_here = waiting_here + 1 %]
199             [% ELSE %]
200                 [% waiting_elsewhere = waiting_elsewhere + 1 %]
201             [% END %]
202         [% END %]
203
204         [% IF ( waiting_here > 0 ) %]
205             <h4>Holds waiting here ([% waiting_here | html %])</h4>
206             <ul>
207                 [% FOREACH w IN WaitingHolds %]
208                     [% IF ( w.branch.branchcode == logged_in_branchcode  ) %]
209                         <li>
210                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber | uri %]">[% w.biblio.title | html %]</a>
211                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
212                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
213                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
214                             <span>Hold placed on [% w.reservedate | $KohaDates %].</span>
215                             <br />
216                             <strong class="waitinghere">
217                                 [% SET expires_on = w.expirationdate %]
218                                 Waiting here [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
219                             </strong>
220                         </li>
221                     [% END %]
222                 [% END %]
223             </ul>
224         [% END %]
225
226         [% IF ( waiting_elsewhere > 0 ) %]
227             <h4>Holds waiting at other libraries ([% waiting_elsewhere | html %])</h4>
228             <ul>
229                 [% FOREACH w IN WaitingHolds %]
230                     [% IF ( w.branch.branchcode != logged_in_branchcode  ) %]
231                         <li>
232                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber | uri %]">[% w.biblio.title | html %]</a>
233                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
234                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
235                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
236                             <span>Hold placed on [% w.reservedate | $KohaDates %].</span>
237                             <br />
238                             <strong>
239                                 [% SET expires_on = w.expirationdate %]
240                                 Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
241                             </strong>
242                         </li>
243                     [% END %]
244                 [% END %]
245             </ul>
246         [% END %]
247     </div>
248 [% END # /IF WaitingHolds.count %]
249
250 [% IF Koha.Preference("CurbsidePickup") %]
251     [% SET curbside_pickups = patron.curbside_pickups.search( branchcode => Branches.GetLoggedInBranchcode ) %]
252     [% IF curbside_pickups.count %]
253         <div id="curbside_pickups" class="circmessage">
254             <h4>Curbside pickups scheduled here</h4>
255             <ul>
256             [% FOR cp IN curbside_pickups %]
257                 <li>On [% cp.scheduled_pickup_datetime | $KohaDates %]:
258                     [% SWITCH cp.status %]
259                     [% CASE 'to-be-staged' %]
260                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=to-be-staged">
261                         To be staged</a>
262                     [% CASE 'staged-and-ready' %]
263                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=staged-and-ready">
264                         Staged and ready</a>
265                     [% CASE 'patron-is-outside' %]
266                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=patron-is-outside">
267                         Patron is outside!</a>
268                     [% CASE 'delivered' %]
269                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=delivered-today">
270                         Delivered</a>
271                     [% CASE %]<span>Unknown status "[% cp.status | html %]"</span>
272                     [% END %]
273                 </li>
274             [% END %]
275             </ul>
276         </div>
277     [% END %]
278 [% END %]
279
280 [% IF ( patron.borrowernotes ) %]
281     <div id="circnotes" class="circmessage">
282         <h4>Notes</h4>
283         <ul>
284             <li>
285                 <span class="circ-hlt">
286                     [% patron.borrowernotes | $raw | html_line_break %]
287                 </span>
288             </li>
289         </ul>
290     </div> <!-- /#circnotes -->
291 [% END # /IF patron.borrowernotes %]
292
293 [% IF ( patron_messages ) %]
294     <div id="messages" class="circmessage">
295         <h4>Messages</h4>
296         <ul>
297             [% FOREACH patron_message IN patron_messages %]
298                 <li>
299                     [% IF(patron_message.message_type == "L") %]
300                         <span class="circ-hlt">
301                     [% ELSE %]
302                         <span>
303                     [% END %]
304                         [% patron_message.message_date | $KohaDates %]
305                         [% Branches.GetName( patron_message.branchcode ) | html %]
306                         [% IF patron_message.manager_id %]
307                             ( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron_message.manager_id | uri %]">[% patron_message.get_column('manager_firstname') | html %] [% patron_message.get_column('manager_surname') | html %]</a> )
308                         [% END %]
309                         <em>"[% patron_message.message | html %]"</em>
310                         [% IF patron_message.patron_read_date %]
311                             Read: <em>[% patron_message.patron_read_date | $KohaDates %]</em>
312                         [% END %]
313                     </span>
314                     [% IF patron_message.branchcode == Branches.GetLoggedInBranchcode OR Koha.Preference('AllowAllMessageDeletion') %]
315                         [% IF moremember %]
316                             <a id="#edit_message_form_[% patron_message.message_id | html %]" class="btn btn-link edit_message" href="#edit_message_form_[% patron_message.message_id | uri %]" data-target="#edit_message_form_[% patron_message.message_id | html %]" data-toggle="modal" class="btn btn-default"><i class="fa fa-edit"></i> Edit</a>
317                             <a class="btn btn-link delete_message" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&amp;borrowernumber=[% patron_message.borrowernumber | html %]&amp;from=moremember"><i class="fa fa-trash"></i> Delete</a>
318                         [% ELSE %]
319                             <a id="#edit_message_form_[% patron_message.message_id | html %]" class="btn btn-link edit_message" href="#edit_message_form_[% patron_message.message_id | uri %]" data-target="#edit_message_form_[% patron_message.message_id | html %]" data-toggle="modal" class="btn btn-default"><i class="fa fa-edit"></i> Edit</a>
320                             <a class="btn btn-link delete_message" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&amp;borrowernumber=[% patron_message.borrowernumber | html %]"><i class="fa fa-trash"></i> Delete</a>
321                         [% END %]
322                     [% END %]
323                 </li>
324             [% END %]
325         </ul>
326         <a id="addnewmessageLabel" href="#add_message_form" class="btn btn-link" data-toggle="modal"><i class="fa fa-plus"></i> Add a new message</a>
327     </div> <!-- /#messages -->
328
329     [% FOREACH pm IN patron_messages %]
330         <div id="edit_message_form_[% pm.message_id | html %]" class="modal" tabindex="-1" role="dialog" aria-labelledby="#edit_message_form_[% patron_message.message_id | html %]" aria-hidden="true">
331             <div class="modal-dialog">
332                 <div class="modal-content">
333                     <form method="post" action="/cgi-bin/koha/circ/add_message.pl" id="message_form" name="message_f">
334                         <input type="hidden" name="message_id" value="[% pm.message_id | html %]"/>
335                         <div class="modal-header">
336                             <h3>Edit message</h3>
337                         </div>
338                         <div class="modal-body">
339                             <div class="form-group">
340                                 <label for="message_type">Message is for:</label>
341                                 <select name="message_type" id="message_type" disabled>
342                                     [% IF pm.message_type == "L" %]
343                                         <option value="L" selected="selected">Staff - Internal note</option>
344                                     [% ELSE %]
345                                         <option value="L">Staff - Internal note</option>
346                                     [% END %]
347
348                                     [% IF pm.message_type == "B" %]
349                                         <option value="B" selected="selected">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
350                                     [% ELSE %]
351                                         <option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
352                                     [% END %]
353                                 </select>
354                             </div>
355                             <div class="form-group">
356                                 <textarea rows="3" class="modal-textarea" name="borrower_message" id="borrower_message" >[% pm.message | html %]</textarea>
357                             </div>
358                         </div>
359                         <div class="modal-footer">
360                             <button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button>
361                             <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
362                         </div>
363                     </form>
364                 </div>
365             </div>
366         </div>
367     [% END %]
368
369 [% END # /IF patron_messages %]