Bug 32373: Show patron restriction date
[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 will expire soon.</span>
25                 <span>Patron's card expires on [% expiry | $KohaDates %]</span>
26                 <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>
27             </li>
28         [% END %]
29
30         [% IF ( returnbeforeexpiry ) %]
31             <li class="returnbeforeexpiry">
32                 <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
33             </li>
34         [% END %]
35
36         [% IF ( expired ) %]
37             <li class="expired">
38                 <span class="circ-hlt">Expiration:</span>
39                 <span>Patron's card has expired.</span>
40                 [% IF ( expiry ) %]
41                     <span>Patron's card expired on [% expiry | $KohaDates %]</span>
42                 [% END %]
43                 <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>
44             </li>
45         [% END %]
46
47         [% IF ( patron.gonenoaddress ) %]
48             <li class="gonenoaddress blocker">
49                 <span title="gonenoaddress flag is set in patron record"><span class="circ-hlt">Address:</span> Patron's address flagged as in doubt</span>
50             </li>
51         [% END %]
52
53         [% IF ( patron.lost ) %]
54             <li class="lost blocker">
55                 <span title="lost flag is set in patron record"><span class="circ-hlt">Lost: </span> Patron's card is flagged as lost</span>
56             </li>
57         [% END %]
58
59         [% IF ( userdebarred ) %]
60             <li class="userdebarred blocker">
61                 <span class="circ-hlt"> Restricted since [% debarredsince | $KohaDates %]:</span> Patron's account is restricted
62
63                 [% IF ( userdebarreddate ) %]
64                     until [% userdebarreddate | $KohaDates %]
65                 [% END %]
66
67                 [% IF ( debarredcomment ) %]
68                     with the explanation: <br/>
69                     <em>
70                         [% IF debarredcomment.search('OVERDUES_PROCESS') %]
71                             Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %]
72                         [% ELSE %]
73                             [% debarredcomment | $raw | html_line_break %]
74                         [% END %]
75                     </em><br/>
76                 [% END %]
77                 <a class="btn btn-xs btn-default" href="#reldebarments" onclick="$('#debarments-tab-link').click()"><i class="fa fa-ban"></i> View restrictions</a>
78
79                 [% IF (noissues && CAN_user_circulate_force_checkout) %]
80                     <span class="override_debarment">
81                         <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>
82                     </span>
83                 [% END %]
84             </li> <!-- /.blocker -->
85         [% END # /IF userdebarred %]
86
87         [% IF ( odues ) %]
88             <li class="odues blocker">
89                 <span class="circ-hlt">Overdues:</span>  Patron has ITEMS OVERDUE <a href="#checkouts">See highlighted items below</a>
90             </li>
91         [% END %]
92
93         [% IF return_claims.count > ClaimReturnedWarningThreshold %]
94             <li class="return_claims blocker">
95                 <span class="circ-hlt return-claims">Return claims:</span> Patron has [% return_claims.count | html %] RETURN CLAIMS
96             </li>
97         [% END %]
98
99         [% IF age_limitations %]
100             [% INCLUDE 'category-out-of-age-limit.inc' %]
101         [% END %]
102
103         [% IF ( charges ) %]
104             [% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
105         [% END %]
106
107         [% IF ( charges_guarantors_guarantees ) %]
108             <li class="charges_guarantors_guarantees">
109                 <span class="circ-hlt">Charges:</span> Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %].
110                 [% IF noissues %]
111                     <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
112                 [% END %]
113             </li>
114         [% END %]
115
116         [% IF ( charges_guarantees ) %]
117             <li class="charges_guarantees">
118                 <span class="circ-hlt">Charges:</span> Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %].
119                     [% IF noissues %]
120                         <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
121                     [% END %]
122             </li>
123         [% END %]
124
125         [% IF ( credits ) %]
126             <li class="credits">
127                 <span class="circ-hlt">Credits:</span> Patron has a credit[% IF ( creditsamount ) %] of <span class="credit"><strong>[% creditsamount | $Price %]</strong></span>[% END %]
128             </li>
129         [% END %]
130
131     </ul>
132
133 [% END # /F ( has_modifications || warndeparture... %]
134
135 [% IF waiting_recalls.count %]
136     <div id="recallswaiting" class="circmessage">
137         [% SET waiting_here = 0 %]
138         [% SET waiting_elsewhere = 0 %]
139         [% FOREACH w IN waiting_recalls %]
140             [% IF ( w.pickup_library_id == logged_in_branchcode  ) %]
141                 [% waiting_here = waiting_here + 1 %]
142             [% ELSE %]
143                 [% waiting_elsewhere = waiting_elsewhere + 1 %]
144             [% END %]
145         [% END %]
146
147         [% IF ( waiting_here > 0 ) %]
148             <h4>Recalls waiting here ([% waiting_here | html %])</h4>
149             <ul>
150                 [% FOREACH w IN waiting_recalls %]
151                     [% IF ( w.pickup_library_id == logged_in_branchcode  ) %]
152                         <li>
153                             <a href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% w.biblio_id | uri %]">[% w.biblio.title | html %]</a>
154                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
155                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
156                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
157                             <span>Recall placed on [% w.created_date | $KohaDates %].</span>
158                             <br />
159                             <strong class="waitinghere">
160                                 [% SET expires_on = w.expiration_date %]
161                                 Waiting here [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
162                             </strong>
163                         </li>
164                     [% END %]
165                 [% END %]
166             </ul>
167         [% END %]
168
169         [% IF ( waiting_elsewhere > 0 ) %]
170             <h4>Recalls waiting at other libraries ([% waiting_elsewhere | html %])</h4>
171             <ul>
172                 [% FOREACH w IN waiting_recalls %]
173                     [% IF ( w.pickup_library_id != logged_in_branchcode  ) %]
174                         <li>
175                             <a href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% w.biblio_id | uri %]">[% w.biblio.title | html %]</a>
176                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
177                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
178                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
179                             <span>Recall placed on [% w.created_date | $KohaDates %].</span>
180                             <br />
181                             <strong>
182                                 [% SET expires_on = w.expiration_date %]
183                                 Waiting at [% Branches.GetName( w.pickup_library_id ) | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
184                             </strong>
185                         </li>
186                     [% END %]
187                 [% END %]
188             </ul>
189         [% END %]
190     </div>
191 [% END # /IF waiting_recalls.count %]
192
193 [% IF WaitingHolds.count %]
194     <div id="holdswaiting" class="circmessage">
195         [% SET waiting_here = 0 %]
196         [% SET waiting_elsewhere = 0 %]
197         [% FOREACH w IN WaitingHolds %]
198             [% IF ( w.branch.branchcode == logged_in_branchcode  ) %]
199                 [% waiting_here = waiting_here + 1 %]
200             [% ELSE %]
201                 [% waiting_elsewhere = waiting_elsewhere + 1 %]
202             [% END %]
203         [% END %]
204
205         [% IF ( waiting_here > 0 ) %]
206             <h4>Holds waiting here ([% waiting_here | html %])</h4>
207             <ul>
208                 [% FOREACH w IN WaitingHolds %]
209                     [% IF ( w.branch.branchcode == logged_in_branchcode  ) %]
210                         <li>
211                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber | uri %]">[% w.biblio.title | html %]</a>
212                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
213                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
214                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
215                             <span>Hold placed on [% w.reservedate | $KohaDates %].</span>
216                             <br />
217                             <strong class="waitinghere">
218                                 [% SET expires_on = w.expirationdate %]
219                                 Waiting here [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
220                             </strong>
221                         </li>
222                     [% END %]
223                 [% END %]
224             </ul>
225         [% END %]
226
227         [% IF ( waiting_elsewhere > 0 ) %]
228             <h4>Holds waiting at other libraries ([% waiting_elsewhere | html %])</h4>
229             <ul>
230                 [% FOREACH w IN WaitingHolds %]
231                     [% IF ( w.branch.branchcode != logged_in_branchcode  ) %]
232                         <li>
233                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber | uri %]">[% w.biblio.title | html %]</a>
234                             ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]),
235                             [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
236                             [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %]
237                             <span>Hold placed on [% w.reservedate | $KohaDates %].</span>
238                             <br />
239                             <strong>
240                                 [% SET expires_on = w.expirationdate %]
241                                 Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %]
242                             </strong>
243                         </li>
244                     [% END %]
245                 [% END %]
246             </ul>
247         [% END %]
248     </div>
249 [% END # /IF WaitingHolds.count %]
250
251 [% IF Koha.Preference("CurbsidePickup") %]
252     [% SET curbside_pickups = patron.curbside_pickups.search( branchcode => Branches.GetLoggedInBranchcode ) %]
253     [% IF curbside_pickups.count %]
254         <div id="curbside_pickups" class="circmessage">
255             <h4>Curbside pickups scheduled here</h4>
256             <ul>
257             [% FOR cp IN curbside_pickups %]
258                 <li>On [% cp.scheduled_pickup_datetime | $KohaDates %]:
259                     [% SWITCH cp.status %]
260                     [% CASE 'to-be-staged' %]
261                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=to-be-staged">
262                         To be staged</a>
263                     [% CASE 'staged-and-ready' %]
264                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=staged-and-ready">
265                         Staged and ready</a>
266                     [% CASE 'patron-is-outside' %]
267                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=patron-is-outside">
268                         Patron is outside!</a>
269                     [% CASE 'delivered' %]
270                         <a href="/cgi-bin/koha/circ/curbside_pickups.pl?tab=delivered-today">
271                         Delivered</a>
272                     [% CASE %]<span>Unknown status "[% cp.status | html %]"</span>
273                     [% END %]
274                 </li>
275             [% END %]
276             </ul>
277         </div>
278     [% END %]
279 [% END %]
280
281 [% IF ( patron.borrowernotes ) %]
282     <div id="circnotes" class="circmessage">
283         <h4>Notes</h4>
284         <ul>
285             <li>
286                 <span class="circ-hlt">
287                     [% patron.borrowernotes | $raw | html_line_break %]
288                 </span>
289             </li>
290         </ul>
291     </div> <!-- /#circnotes -->
292 [% END # /IF patron.borrowernotes %]
293
294 [% IF ( patron_messages ) %]
295     <div id="messages" class="circmessage">
296         <h4>Messages</h4>
297         <ul>
298             [% FOREACH patron_message IN patron_messages %]
299                 <li>
300                     [% IF(patron_message.message_type == "L") %]
301                         <span class="circ-hlt">
302                     [% ELSE %]
303                         <span>
304                     [% END %]
305                         [% patron_message.message_date | $KohaDates %]
306                         [% Branches.GetName( patron_message.branchcode ) | html %]
307                         [% IF patron_message.manager_id %]
308                             ( <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> )
309                         [% END %]
310                         <em>"[% patron_message.message | html %]"</em>
311                     </span>
312                     [% IF patron_message.branchcode == Branches.GetLoggedInBranchcode OR Koha.Preference('AllowAllMessageDeletion') %]
313                         [% IF moremember %]
314                         <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>
315                         [% ELSE %]
316                         <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>
317                         [% END %]
318                     [% END %]
319                 </li>
320             [% END %]
321         </ul>
322         <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>
323     </div> <!-- /#messages -->
324 [% END # /IF patron_messages %]