Bug 33568: Fix patron_to_html display
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / holds_table.inc
1 [% USE Koha %]
2 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
3 [% USE AuthorisedValues %]
4 <table id="patron_holds_table" class="holds_table">
5     <thead>
6         <tr>
7             <th id="checkbox" data-colname="checkbox"><input type="checkbox" class="select_hold_all"/></th>
8             <th id="priority" data-colname="priority">Priority</th>
9             [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
10                 <th id="change_priority" data-colname="change_priority">Change priority</th>
11             [% END %]
12             <th id="patron" data-colname="patron">Patron</th>
13             <th id="notes" data-colname="notes">Notes</th>
14             <th id="date" data-colname="date">Date</th>
15             <th id="expiration" data-colname="expiration">Expiration</th>
16             <th id="pickup_library" data-colname="pickup_library">Pickup library</th>
17             <th id="details" data-colname="details">Details</th>
18             [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
19                 <th id="set_lowest_priority" data-colname="set_lowest_priority"><span style="display:none;">Set lowest priority</span><i class="fa fa-lg fa-rotate-90 fa-fast-forward" title="Toggle set to lowest priority"></i></th>
20             [% END %]
21             <th id="delete" data-colname="delete">Delete</th>
22             <th id="suspend" data-colname="suspend">Suspend</th>
23             <th id="print_slip" data-colname="print_slip">Print hold/transfer slip</th>
24         </tr>
25     </thead>
26     [%- SET first_priority = 0 -%]
27     [%- SET found_holds = 0 -%]
28     [%- SET last_priority  = holds.last.priority -%]
29
30     [% BLOCK priority_dropdown %]
31         [%- SET loop_priority = 1 -%]
32         [%- WHILE loop_priority <= last_priority -%]
33             [%- IF this_priority == loop_priority -%]
34                 <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option>
35             [%- ELSE -%]
36                 <option value="[% loop_priority | html %]">[% loop_priority | html %]</option>
37             [%- END -%]
38             [%- loop_priority = loop_priority + 1- %]
39         [%- END -%]
40     [% END %]
41     <tbody>
42         [% FOREACH hold IN holds %]
43         [%- IF !hold.found && first_priority == 0 -%]
44             [%- first_priority = hold.priority -%]
45             [%- found_holds = loop.index() -%]
46         [%- END -%]
47         [%- IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' -%]
48             [%- this_priority = hold.priority -%]
49         [%- ELSE -%]
50             [%- this_priority = loop.count() - found_holds -%]
51         [%- END -%]
52             [% IF hold.suspend %]
53                 <tr class="suspend">
54             [% ELSE %]
55                 <tr>
56             [% END %]
57                 <td><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]"/></td>
58                 <td>
59                     <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
60                     <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
61                     <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
62                     [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
63                         [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
64                             <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id | html %]">
65                             [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
66                                 [% PROCESS priority_dropdown %]
67                             [% ELSE %]
68                                 <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
69                             [% END %]
70                                 <option value="del">del</option>
71                             </select>
72                         [% ELSE %]
73                             <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
74                             <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
75                             [% IF ( hold.found ) %]
76                                 [% IF ( hold.intransit ) %]
77                                     <option value="T" selected="selected">In transit</option>
78                                 [% ELSIF (hold.inprocessing) %]
79                                     <option value="P" selected="selected">In processing</option>
80                                 [% ELSE %]
81                                     <option value="W" selected="selected">Waiting</option>
82                                 [% END %]
83                             [% ELSE %]
84                                 <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
85                             [% END %]
86                             </select>
87                         [% END %]
88                     [% ELSE %]
89                         <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
90                         [% hold.priority | html %]
91                     [% END %]
92                 </td>
93                 [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
94                 [%- UNLESS hold.found -%]
95                         [%- SET prev_priority  = loop.prev.priority -%]
96                         [%- SET next_priority  = loop.next.priority -%]
97                         <td style="white-space:nowrap;">
98                             <a class="hold-arrow" title="Move hold up" data-op="cud-move" data-where="up" data-first_priority="[% first_priority | html %]" data-last_priority="[% last_priority | html %]" data-prev_priority="[% prev_priority | html %]" data-next_priority="[% next_priority | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-reserve_id="[% hold.reserve_id | html %]" data-date="[% hold.date | html %]">
99                                 <i class="fa fa-lg icon-move-hold-up" aria-hidden="true"></i>
100                             </a>
101
102                             <a class="hold-arrow" title="Move hold to top" data-op="cud-move" data-where="top" data-first_priority="[% first_priority | html %]" data-last_priority="[% last_priority | html %]" data-prev_priority="[% prev_priority | html %]" data-next_priority="[% next_priority | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-reserve_id="[% hold.reserve_id | html %]" data-date="[% hold.date | html %]">
103                                 <i class="fa fa-lg icon-move-hold-top" aria-hidden="true"></i>
104                             </a>
105
106                             <a class="hold-arrow" title="Move hold to bottom" data-op="cud-move" data-where="bottom" data-first_priority="[% first_priority | html %]" data-last_priority="[% last_priority | html %]" data-prev_priority="[% prev_priority | html %]" data-next_priority="[% next_priority | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-reserve_id="[% hold.reserve_id | html %]" data-date="[% hold.date | html %]">
107                                 <i class="fa fa-lg icon-move-hold-bottom" aria-hidden="true"></i>
108                             </a>
109
110                             <a class="hold-arrow" title="Move hold down" data-op="cud-move" data-where="down" data-first_priority="[% first_priority | html %]" data-last_priority="[% last_priority | html %]" data-prev_priority="[% prev_priority | html %]" data-next_priority="[% next_priority | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-reserve_id="[% hold.reserve_id | html %]" data-date="[% hold.date | html %]">
111                                 <i class="fa fa-lg icon-move-hold-down" aria-hidden="true"></i>
112                             </a>
113                         </td>
114             [%- ELSE -%]
115                 <td></td>
116             [%- END -%]
117                 [%- END -%]
118                 <td>
119                     [% INCLUDE 'patron-title.inc' patron=hold.patron hide_patron_infos_if_needed=1 %]
120                 </td>
121                 <td>[% hold.notes | html | html_line_break %]</td>
122                 <td data-order="[% hold.date| html %]">
123                     [% IF Koha.Preference('AllowHoldDateInFuture') %]
124                         <input type="text" class="flatpickr" value="[% hold.date | html %]" required="required" size="10" name="reservedate" />
125                     [% ELSE %]
126                         [% hold.date | $KohaDates %]
127                     [% END %]
128                 </td>
129                 <td>
130                     [% UNLESS hold.expired %]
131                         <input type="text" class="flatpickr" data-flatpickr-futuredate="true" value="[% hold.expirationdate | html %]" size="10" name="expirationdate" />
132                     [% ELSE %]
133                         <span class="expiredon"><label>Expired:</label> [% hold.expirationdate | $KohaDates %]</span>
134                         <input type="hidden" value="[% hold.expirationdate | html %]"  name="expirationdate" />
135                     [% END %]
136                 </td>
137                 <td>
138                     [%- IF ( hold.found ) -%]
139                         <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
140                         [%- IF ( hold.atdestination ) -%]
141                                 Item waiting at <strong> [% hold.wbrname | html %]</strong>[% IF hold.desk_name %], [% hold.desk_name | html %],[% END %] since [% hold.waiting_date | $KohaDates %]
142                         [%- ELSIF (hold.intransit) -%]
143                             Item being transferred to <strong> [% hold.wbrname | html %]</strong>
144                         [%- ELSIF (hold.inprocessing) -%]
145                             Item being processed at <strong> [% hold.wbrname | html %]</strong>
146                         [%- ELSE -%]
147                             Hold expected at <strong>[% hold.wbrname | html %]</strong>, please checkin to verify status
148                         [%- END -%]
149                     [%- ELSE -%]
150                         [%- IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 -%]
151                             [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
152                         [%- ELSE -%]
153                             <select class="pickup_location_dropdown"
154                                     data-selected="[% hold.branchcode | html %]"
155                                     data-hold-id="[% hold.reserve_id | html %]"
156                                     data-pickup-location-source="hold"
157                                     name="pickup">
158                                 <option selected="selected" value="[% hold.branchcode | html %]">[% Branches.GetName(hold.branchcode) | html %]</option>
159                                 <option value="" disabled="disabled" class="loading">Loading...</option>
160                             </select>
161                             <img class="loading_[% hold.reserve_id | html %]" src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" style="display:none;"/>
162                         [%- END -%]
163                     [%- END -%]
164                 </td>
165                 <td>
166                     [%- IF ( hold.found ) -%]
167                         <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
168                             [%- IF ( hold.barcodenumber ) -%]
169                                 [%- hold.barcodenumber | html -%]
170                             [%- ELSE -%]
171                                 <span>No barcode</span>
172                             [%- END -%]
173                             <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
174                         </a>
175                     [%- ELSE -%]
176                         [%- IF ( hold.item_level_hold ) -%]
177                             <em>
178                                 [%- IF ! hold.change_hold_type_allowed -%]
179                                     <span>Only item</span>
180                                     <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
181                                         [%- IF ( hold.barcodenumber ) -%]
182                                             [%- hold.barcodenumber | html -%]
183                                         [%- ELSE -%]
184                                             <span>No barcode</span>
185                                         [%- END -%]
186                                         <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
187                                     </a>
188                                 [%- ELSE -%]
189                                         <select name="change_hold_type_[% hold.reserve_id | html %]">
190                                         <option selected="selected" value="">Only item [%- IF ( hold.barcodenumber ) -%]
191                                             [%- hold.barcodenumber | html -%]
192                                         [%- ELSE -%]
193                                             No barcode
194                                         [%- END -%]
195                                         </option>
196                                         <option value="1">Next available</option>
197                                     </select>
198                                     [%- IF ( hold.barcodenumber ) -%]
199                                         <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
200                                     [%- END -%]
201                                     [%- IF hold.itemtype -%]
202                                         <span style="display:none">Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</span>
203                                     [%- ELSE -%]
204                                         <span style="display:none">Next available</span>
205                                     [%- END -%]
206                                 [%- END -%]
207                             </em>
208                         [%- ELSE -%]
209                             [%- IF hold.itemtype -%]
210                                 <em>Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</em>
211                             [%- ELSIF hold.object.item_group -%]
212                                 <em>Next available item from group <strong>[% hold.object.item_group.description | html %]</strong></em>
213                             [%- ELSE -%]
214                                 <em>Next available</em>
215                             [%- END -%]
216
217                             <input type="hidden" name="itemnumber" value="" />
218                         [%- END -%]
219                     [%- END -%]
220                     [%- IF hold.non_priority -%]
221                         <br><i>Non priority hold</i>
222                     [%- END -%]
223                 </td>
224                 [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
225                 [%- UNLESS hold.found -%]
226                         <td>
227                                 [% IF ( hold.lowestPriority ) %]
228                                     <a class="hold-arrow" title="Remove lowest priority" data-op="cud-setLowestPriority" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-reserve_id="[% hold.reserve_id | html %]" data-date="[% hold.date | html %]">
229                                         <i class="fa fa-lg fa-rotate-90 icon-unset-lowest" aria-hidden="true"></i>
230                                 [% ELSE %]
231                                     <a class="hold-arrow" title="Set lowest priority" data-op="cud-setLowestPriority" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-reserve_id="[% hold.reserve_id | html %]" data-date="[% hold.date | html %]">
232                                         <i class="fa fa-lg fa-rotate-90 icon-set-lowest" aria-hidden="true"></i>
233                                 [% END %]
234                             </a>
235                         </td>
236             [%- ELSE -%]
237                 <td></td>
238             [%- END -%]
239                 [%- END -%]
240                 <td>
241                     <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?op=cancel&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
242                         <i class="fa fa-trash" aria-label="Cancel hold"></i>
243                     </a>
244                 </td>
245                 <td>
246                     [% IF Koha.Preference('SuspendHoldsIntranet') %]
247                         [% UNLESS ( hold.found ) %]
248                             <button class="btn btn-default btn-xs toggle-suspend" data-reserve-id="[% hold.reserve_id | html %]" data-biblionumber="[% hold.biblionumber | html %]">
249                                 [% IF ( hold.suspend ) %]
250                                     <i class="fa fa-play" aria-hidden="true"></i> Unsuspend
251                                 [% ELSE %]
252                                     <i class="fa fa-pause" aria-hidden="true"></i> Suspend
253                                 [% END %]
254                             </button>
255
256                             [% IF Koha.Preference('AutoResumeSuspendedHolds') %]
257                                 <label for="suspend_until_[% hold.reserve_id | html %]">[% IF ( hold.suspend ) %] on [% ELSE %] until [% END %]</label>
258                                 <input type="text" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" size="10" value="[% hold.suspend_until | html %]" class="flatpickr" data-flatpickr-futuredate="true" />
259                             [%- ELSE -%]
260                                 <input type="hidden" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" value=""/>
261                             [%- END -%]
262                         [%- END -%]
263                     [%- END # IF SuspendHoldsIntranet -%]
264                     [%- IF ( hold.found ) -%]
265                         <input type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.intransit %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?op=move&amp;where=down&amp;first_priority=[% first_priority | uri %]&amp;last_priority=[% last_priority | uri %]&amp;prev_priority=0&amp;next_priority=1&amp;borrowernumber=[% hold.borrowernumber | uri %]&amp;biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]&amp;reserve_id=[% hold.reserve_id | uri %]&amp;date=[% hold.date | uri %]'">
266                     [%- END -%]
267                 </td>
268                 [% IF ( hold.intransit || hold.atdestination ) %]
269                     <td><input class="printholdslip" type="button" name="printholdslip" value="Print slip" data-reserve_id="[% hold.reserve_id | html %]"></td>
270                 [% ELSE %]
271                     <td></td>
272                 [% END %]
273             </tr>
274         [% END %]
275     </tbody>
276 </table>