Bug 24860: (QA follow-up) Show group holds on Holds to pull
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / pendingreserves.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE TablesSettings %]
6 [% USE AuthorisedValues %]
7 [%- USE Branches -%]
8 [%- USE ItemTypes -%]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Holds to pull &rsaquo; Circulation &rsaquo; Koha</title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 </head>
14
15 <body id="circ_pendingreserves" class="circ">
16 [% WRAPPER 'header.inc' %]
17     [% INCLUDE 'circ-search.inc' %]
18 [% END %]
19
20
21 [% WRAPPER 'sub-header.inc' %]
22 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
23     <ol>
24         <li>
25             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
26         </li>
27         <li>
28             <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
29         </li>
30         <li>
31             <a href="#" aria-current="page">
32                 Holds to pull
33             </a>
34         </li>
35     </ol>
36 </nav>
37 [% END %]
38
39 <div class="main container-fluid">
40     <div class="row">
41         <div class="col-sm-10 col-sm-push-2">
42             <main>
43
44         [% FOR m IN messages %]
45             <div class="dialog [% m.type | html %]">
46                 [% SWITCH m.code %]
47                 [% CASE 'letter_enqueued' %]
48                     <span>The notice has been correctly enqueued.</span>
49                 [% CASE 'no_email_address' %]
50                     <span>The patron does not have an email address defined.</span>
51                 [% CASE 'no_template_notice' %]
52                     <span>There is no notice template with a code 'CANCEL_HOLD_ON_LOST' defined in your system.</span>
53                 [% CASE 'hold_cancelled' %]
54                     <span>The hold has been correctly cancelled.</span>
55                 [% CASE 'hold_placed_at_biblio_level' %]
56                     <span>The hold has been placed on biblio level. It is not possible to determine the item to mark as lost.</span>
57                 [% CASE %]
58                     [% m.code | html %]
59                 [% END %]
60             </div>
61         [% END %]
62
63 <h1>Holds to pull placed between [% from | $KohaDates %] and [% to | $KohaDates %]</h1>
64 <h3>Reported on [% todaysdate | $KohaDates %]</h3>
65 <p>The following holds have not been filled. Please retrieve them and check them in.</p>
66 <div id="searchresults">
67     [% IF holds_info %]
68     <table id="holdst">
69     <thead>
70         <tr>
71         <th>Pull this many items</th>
72         <th>Items available</th>
73         <th>Patrons with holds</th>
74         <th>First patron</th>
75         <th class="anti-the">Title</th>
76         <th class="string-sort">Libraries</th>
77         <th>Available barcodes</th>
78         <th>Available call numbers</th>
79         <th>Available copy numbers</th>
80         <th>Available enumeration</th>
81         <th class="string-sort">Available item types</th>
82         <th class="string-sort">Available locations</th>
83         <th>Earliest hold date</th>
84         <th>Hold notes</th>
85         <th class="string-sort">Pickup location</th>
86         <th>Action</th>
87         </tr>
88     </thead>
89     <tbody>
90         [% FOREACH hold_info IN holds_info %]
91         <tr>
92         [% SET patron = hold_info.patron %]
93         [% SET item = hold_info.item %]
94         [% SET hold = hold_info.hold %]
95         [% IF patron %]
96             [% SET biblio = hold_info.biblio %]
97             <td><p><strong>[% hold_info.pull_count | html %]</strong></p></td>
98             <td>[% hold_info.items_count | html %]</td>
99             <td>[% hold_info.patrons_count | html %]</td>
100             <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a></td>
101             <td>
102                 <p>
103                     [% INCLUDE 'biblio-title.inc' biblio=biblio link = 1 %]
104                 </p>
105                 [% IF ( biblio.author ) %]<p> by [% biblio.author | html %]</p>[% END %]
106                 [% IF ( biblio.biblioitem.editionstatement ) %]<p>[% biblio.biblioitem.editionstatement | html %]</p>[% END %]
107                 [% IF ( Koha.Preference('marcflavour') == 'MARC21' ) %]
108                     [% IF ( biblio.copyrightdate ) %]<p>[% biblio.copyrightdate | html %]</p>[% END %]
109                 [% ELSE %]
110                     [% IF ( biblio.biblioitem.publicationyear ) %]<p>[% biblio.biblioitem.publicationyear | html %]</p>[% END %]
111                 [% END %]
112             </td>
113         [% ELSE %]
114             <td>"</td>
115             <td>"</td>
116             <td>"</td>
117             <td>"</td>
118             <td>"</td>
119         [% END %]
120         <td>
121             [% IF ( hold_info.holdingbranches.size ) %]
122             <ul>
123                 [% FOREACH holdingbranch IN hold_info.holdingbranches %]
124                     <li>[% Branches.GetName ( holdingbranch ) | html %]</li>
125                 [% END %]
126             </ul>
127             [% END %]
128         </td>
129         <td>
130             [% IF ( hold_info.barcodes.size ) %]
131                 [% SET barcode = hold_info.barcodes.first %]
132                 [% IF ( hold_info.item ) %]
133                     <span>Only [% barcode | html %]</span>
134                 [% ELSE %]
135                     <span>[% barcode | html %] or
136                         [% IF hold_info.item_group %]
137                             any available from item group <em>[% hold_info.item_group.description | html %]</em>.
138                         [% ELSE %]
139                             any available.
140                         [% END %]
141                     </span>
142                 [% END %]
143             [% END %]
144         </td>
145         <td>
146             [% IF ( hold_info.callnumbers.size ) %]
147                 <ul>
148                     [% FOREACH callnumber IN hold_info.callnumbers %]
149                         <li>
150                             [% callnumber | html %]
151                         </li>
152                     [% END %]
153                 </ul>
154             [% END %]
155         </td>
156         <td>
157             [% IF ( hold_info.copynumbers.size ) %]
158                 <ul>
159                     [% FOREACH copyno IN hold_info.copynumbers %]
160                         <li>
161                             [% copyno | html %]
162                         </li>
163                     [% END %]
164                 </ul>
165             [% END %]
166         </td>
167         <td>
168             [% IF ( hold_info.enumchrons.size ) %]
169                 <ul>
170                     [% FOREACH enumchron IN hold_info.enumchrons %]
171                         <li>
172                             [% enumchron | html %]
173                         </li>
174                     [% END %]
175                 </ul>
176             [% END %]
177         </td>
178         <td>
179             <ul>
180             [% FOREACH type IN hold_info.itemtypes %]
181                 <li>[% ItemTypes.GetDescription( type ) | html %]</li>
182             [% END %]
183             </ul>
184         </td>
185         <td>
186             <ul>
187             [% FOREACH loc IN hold_info.locations %]
188                 <li>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => loc ) | html %]</li>
189             [% END %]
190             </ul>
191         </td>
192         <td data-order="[% hold.reservedate | html %]">
193             [% hold.reservedate | $KohaDates %] in [% Branches.GetName ( hold.branchcode ) | html %]
194         </td>
195         <td>[% hold.reservenotes | html %]</td>
196         <td>
197             [% Branches.GetName ( hold.branchcode ) | html %]
198         </td>
199         <td>
200             <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
201                 <input type="hidden" name="op" value="cancel_reserve" />
202                 <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
203
204                 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
205                 [% IF hold_cancellation.count %]
206                     <div class="form-group">
207                         <label for="cancellation-reason">Cancellation reason:</label>
208                         <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
209                             <option value="">No reason given</option>
210                             [% FOREACH reason IN hold_cancellation %]
211                                 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
212                             [% END %]
213                         </select>
214                     </div>
215                 [% END %]
216
217                 [% IF item.holdingbranch != item.homebranch %]
218                     <input class="btn btn-default" type="submit" value="Cancel hold and return to : [% Branches.GetName( item.homebranch ) | html %]" />
219                 [% ELSE %]
220                     <input class="btn btn-default" type="submit" value="Cancel hold" />
221                 [% END %]
222             </form>
223
224         [% IF Koha.Preference('CanMarkHoldsToPullAsLost') != 'do_not_allow' %]
225             [% IF hold.itemnumber %]
226                 <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
227                     <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
228                     [% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %]
229                         <input type="hidden" name="op" value="mark_as_lost" />
230                         <input type="submit" value="Mark item as lost" />
231                     [% ELSIF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow_and_notify' %]
232                         <input type="hidden" name="op" value="mark_as_lost_and_notify" />
233                         <input type="submit" value="Mark lost and notify patron" />
234                     [% END %]
235                 </form>
236             [% ELSE %]
237                 <span>Biblio level hold.</span>
238             [% END %]
239         [% END %]
240             </td>
241         </tr>
242         [% END %]
243     </tbody>
244     <tfoot>
245         <tr>
246         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
247         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
248         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
249         <td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
250         <td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
251         <td id="homebranchfilter"></td>
252         <td></td>
253         <td><input type="text" class="filter" data-column_num="7" placeholder="Call number" style="width:95%"/></td>
254         <td><input type="text" class="filter" data-column_num="8" placeholder="Available copy" style="width:95%"/></td>
255         <td><input type="text" class="filter" data-column_num="9" placeholder="Available enumeration" style="width:95%"/></td>
256         <td id="itemtype-filter"></td>
257         <td id="locationfilter"></td>
258         <td></td>
259         <td></td>
260         <td id="pickup-location"></td>
261         <td></td>
262         </tr>
263     </tfoot>
264     </table>
265     [% ELSE %]
266         <strong>No items found.</strong>
267     [% END %]
268 </div>
269
270
271             </main>
272         </div> <!-- /.col-sm-10.col-sm-push-2 -->
273
274         <div class="col-sm-2 col-sm-pull-10">
275             <aside>
276
277 <div id="filters">
278
279 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
280 <fieldset class="brief">
281 <h4>Refine results</h4>
282 <ol>
283 <li>
284 <label for="from">
285     Start date:
286 </label>
287 <input type="text" size="10" id="from" name="from" value="[% from | html %]" class="flatpickr" data-date_to="to" />
288 </li>
289 <li><label for="to">
290     End date:
291 </label>
292 <input type="text" size="10" id="to" name="to" value="[% to | html %]" class="flatpickr" />
293 </li>
294 </ol>
295
296 [% IF ( HoldsToPullEndDate ) %]
297     <p><em>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to [% HoldsToPullEndDate | html %] days ahead. Set other date ranges as needed.)</em></p>
298 [% ELSE %]
299     <p><em>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to today. Set other date ranges as needed.)</em></p>
300 [% END %]
301
302 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
303 </fieldset>
304 </form>
305
306 </div>
307             </aside>
308         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
309      </div> <!-- /.row -->
310
311 [% MACRO jsinclude BLOCK %]
312     [% INCLUDE 'calendar.inc' %]
313     [% INCLUDE 'datatables.inc' %]
314     [% INCLUDE 'columns_settings.inc' %]
315     <script>
316         $(document).ready(function() {
317           var table_settings = [% TablesSettings.GetTableSettings('circ', 'holds', 'holds-to-pull', 'json') | $raw %];
318           var holdst = KohaTable("holdst", {
319             "sPaginationType": "full_numbers"
320           }, table_settings);
321           holdst.fnAddFilters("filter");
322           [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
323           function separateData ( ColumnData ){
324             var cD = ColumnData;
325             var new_array = new Array();
326             for ( j=0 ; j<cD.length ; j++ ) {
327                 var split_array = cD[j].split(/\n/gi);
328                 for ( k=0 ; k<split_array.length ; k++ ){
329                     var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
330                     if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
331                         new_array.push(str);
332                     }
333                 }
334             }
335             new_array.sort();
336             return new_array;
337           }
338           [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
339           function createSelect( data ) {
340               data = separateData(data);
341               var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
342               var regex = /(<([^>]+)>)/ig; // Remove html tags
343               for ( i=0 ; i<len ; i++ ) {
344                   var cell_val = data[i].replace(regex, '');
345                   if ( cell_val.length < 1 ) continue;
346                   r += '<option value="'+cell_val+'">'+cell_val+'</option>';
347               }
348               return r+'</select>';
349           }
350           $("#homebranchfilter").each( function () {
351               $(this).html( createSelect( holdst.fnGetColumnData(5) ) );
352               $('select', this).change( function () {
353                   holdst.fnFilter( $(this).val(), 5 );
354               });
355           });
356           $("#itemtype-filter").each( function () {
357               $(this).html( createSelect( holdst.fnGetColumnData(10) ) );
358               $('select', this).change( function () {
359                   holdst.fnFilter( $(this).val(), 10 );
360               });
361           });
362           $("#locationfilter").each( function () {
363               $(this).html( createSelect( holdst.fnGetColumnData(11) ) );
364               $('select', this).change( function () {
365                   holdst.fnFilter( $(this).val(), 11 );
366               });
367           });
368           $("#pickup-location").each( function () {
369               $(this).html( createSelect( holdst.fnGetColumnData(14) ) );
370               $('select', this).change( function () {
371                   holdst.fnFilter( $(this).val(), 14 );
372               });
373           });
374         });
375     </script>
376 [% END %]
377
378 [% INCLUDE 'intranet-bottom.inc' %]