Bug 32421: Add collection column to 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 class="string-sort">Available collections</th>
84         <th>Earliest hold date</th>
85         <th>Hold notes</th>
86         <th class="string-sort">Pickup location</th>
87         <th>Action</th>
88         </tr>
89     </thead>
90     <tbody>
91         [% FOREACH hold_info IN holds_info %]
92         <tr>
93         [% SET patron = hold_info.patron %]
94         [% SET item = hold_info.item %]
95         [% SET hold = hold_info.hold %]
96         [% IF patron %]
97             [% SET biblio = hold_info.biblio %]
98             <td><p><strong>[% hold_info.pull_count | html %]</strong></p></td>
99             <td>[% hold_info.items_count | html %]</td>
100             <td>[% hold_info.patrons_count | html %]</td>
101             <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a></td>
102             <td>
103                 <p>
104                     [% INCLUDE 'biblio-title.inc' biblio=biblio link = 1 %]
105                 </p>
106                 [% IF ( biblio.author ) %]<p> by [% biblio.author | html %]</p>[% END %]
107                 [% IF ( biblio.biblioitem.editionstatement ) %]<p>[% biblio.biblioitem.editionstatement | html %]</p>[% END %]
108                 [% IF ( Koha.Preference('marcflavour') == 'MARC21' ) %]
109                     [% IF ( biblio.copyrightdate ) %]<p>[% biblio.copyrightdate | html %]</p>[% END %]
110                 [% ELSE %]
111                     [% IF ( biblio.biblioitem.publicationyear ) %]<p>[% biblio.biblioitem.publicationyear | html %]</p>[% END %]
112                 [% END %]
113             </td>
114         [% ELSE %]
115             <td>"</td>
116             <td>"</td>
117             <td>"</td>
118             <td>"</td>
119             <td>"</td>
120         [% END %]
121         <td>
122             [% IF ( hold_info.holdingbranches.size ) %]
123             <ul>
124                 [% FOREACH holdingbranch IN hold_info.holdingbranches %]
125                     <li>[% Branches.GetName ( holdingbranch ) | html %]</li>
126                 [% END %]
127             </ul>
128             [% END %]
129         </td>
130         <td>
131             [% IF ( hold_info.barcodes.size ) %]
132                 [% SET barcode = hold_info.barcodes.first %]
133                 [% IF ( hold_info.item ) %]
134                     <span>Only [% barcode | html %]</span>
135                 [% ELSE %]
136                     <span>[% barcode | html %] or
137                         [% IF hold_info.item_group %]
138                             any available from item group <em>[% hold_info.item_group.description | html %]</em>.
139                         [% ELSE %]
140                             any available.
141                         [% END %]
142                     </span>
143                 [% END %]
144             [% ELSIF hold_info.item_group %]
145                 Any available from item group <em>[% hold_info.item_group.description | html %]</em>.
146             [% END %]
147         </td>
148         <td>
149             [% IF ( hold_info.callnumbers.size ) %]
150                 <ul>
151                     [% FOREACH callnumber IN hold_info.callnumbers %]
152                         <li>
153                             [% callnumber | html %]
154                         </li>
155                     [% END %]
156                 </ul>
157             [% END %]
158         </td>
159         <td>
160             [% IF ( hold_info.copynumbers.size ) %]
161                 <ul>
162                     [% FOREACH copyno IN hold_info.copynumbers %]
163                         <li>
164                             [% copyno | html %]
165                         </li>
166                     [% END %]
167                 </ul>
168             [% END %]
169         </td>
170         <td>
171             [% IF ( hold_info.enumchrons.size ) %]
172                 <ul>
173                     [% FOREACH enumchron IN hold_info.enumchrons %]
174                         <li>
175                             [% enumchron | html %]
176                         </li>
177                     [% END %]
178                 </ul>
179             [% END %]
180         </td>
181         <td>
182             <ul>
183             [% FOREACH type IN hold_info.itemtypes %]
184                 <li>[% ItemTypes.GetDescription( type ) | html %]</li>
185             [% END %]
186             </ul>
187         </td>
188         <td>
189             <ul>
190             [% FOREACH loc IN hold_info.locations %]
191                 <li>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => loc ) | html %]</li>
192             [% END %]
193             </ul>
194         </td>
195         <td>
196             <ul>
197             [% FOREACH ccode IN hold_info.collections %]
198                 <li>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ccode ) | html %]</li>
199             [% END %]
200             </ul>
201         </td>
202         <td data-order="[% hold.reservedate | html %]">
203             [% hold.reservedate | $KohaDates %] in [% Branches.GetName ( hold.branchcode ) | html %]
204         </td>
205         <td>[% hold.reservenotes | html %]</td>
206         <td>
207             [% Branches.GetName ( hold.branchcode ) | html %]
208         </td>
209         <td>
210             <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
211                 <input type="hidden" name="op" value="cancel_reserve" />
212                 <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
213
214                 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
215                 [% IF hold_cancellation.count %]
216                     <div class="form-group">
217                         <label for="cancellation-reason">Cancellation reason:</label>
218                         <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
219                             <option value="">No reason given</option>
220                             [% FOREACH reason IN hold_cancellation %]
221                                 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
222                             [% END %]
223                         </select>
224                     </div>
225                 [% END %]
226
227                 [% IF item.holdingbranch != item.homebranch %]
228                     <input class="btn btn-default" type="submit" value="Cancel hold and return to : [% Branches.GetName( item.homebranch ) | html %]" />
229                 [% ELSE %]
230                     <input class="btn btn-default" type="submit" value="Cancel hold" />
231                 [% END %]
232             </form>
233
234         [% IF Koha.Preference('CanMarkHoldsToPullAsLost') != 'do_not_allow' %]
235             [% IF hold.itemnumber %]
236                 <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
237                     <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
238                     [% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %]
239                         <input type="hidden" name="op" value="mark_as_lost" />
240                         <input type="submit" class="btn btn-primary" value="Mark item as lost" />
241                     [% ELSIF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow_and_notify' %]
242                         <input type="hidden" name="op" value="mark_as_lost_and_notify" />
243                         <input type="submit" class="btn btn-primary" value="Mark lost and notify patron" />
244                     [% END %]
245                 </form>
246             [% ELSE %]
247                 <span>Biblio level hold.</span>
248             [% END %]
249         [% END %]
250             </td>
251         </tr>
252         [% END %]
253     </tbody>
254     <tfoot>
255         <tr>
256         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
257         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
258         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
259         <td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
260         <td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
261         <td id="homebranchfilter"></td>
262         <td></td>
263         <td><input type="text" class="filter" data-column_num="7" placeholder="Call number" style="width:95%"/></td>
264         <td><input type="text" class="filter" data-column_num="8" placeholder="Available copy" style="width:95%"/></td>
265         <td><input type="text" class="filter" data-column_num="9" placeholder="Available enumeration" style="width:95%"/></td>
266         <td id="itemtype-filter"></td>
267         <td id="locationfilter"></td>
268         <td></td>
269         <td></td>
270         <td></td>
271         <td id="pickup-location"></td>
272         <td></td>
273         </tr>
274     </tfoot>
275     </table>
276     [% ELSE %]
277         <strong>No items found.</strong>
278     [% END %]
279 </div>
280
281
282             </main>
283         </div> <!-- /.col-sm-10.col-sm-push-2 -->
284
285         <div class="col-sm-2 col-sm-pull-10">
286             <aside>
287
288 <div id="filters">
289
290 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
291 <fieldset class="brief">
292 <h4>Refine results</h4>
293 <ol>
294 <li>
295 <label for="from">
296     Start date:
297 </label>
298 <input type="text" size="10" id="from" name="from" value="[% from | html %]" class="flatpickr" data-date_to="to" />
299 </li>
300 <li><label for="to">
301     End date:
302 </label>
303 <input type="text" size="10" id="to" name="to" value="[% to | html %]" class="flatpickr" />
304 </li>
305 </ol>
306
307 [% IF ( HoldsToPullEndDate ) %]
308     <p><em>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to [% HoldsToPullEndDate | html %] days ahead. Set other date ranges as needed.)</em></p>
309 [% ELSE %]
310     <p><em>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to today. Set other date ranges as needed.)</em></p>
311 [% END %]
312 </fieldset>
313
314     <fieldset class="action">
315         <input type="submit" name="run_report" value="Submit" class="btn btn-primary" />
316     </fieldset>
317 </form>
318
319 </div>
320             </aside>
321         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
322      </div> <!-- /.row -->
323
324 [% MACRO jsinclude BLOCK %]
325     [% INCLUDE 'calendar.inc' %]
326     [% INCLUDE 'datatables.inc' %]
327     [% INCLUDE 'columns_settings.inc' %]
328     <script>
329         $(document).ready(function() {
330           var table_settings = [% TablesSettings.GetTableSettings('circ', 'holds', 'holds-to-pull', 'json') | $raw %];
331           var holdst = KohaTable("holdst", {
332             "sPaginationType": "full_numbers"
333           }, table_settings);
334           holdst.fnAddFilters("filter");
335           [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
336           function separateData ( ColumnData ){
337             var cD = ColumnData;
338             var new_array = new Array();
339             for ( j=0 ; j<cD.length ; j++ ) {
340                 var split_array = cD[j].split(/\n/gi);
341                 for ( k=0 ; k<split_array.length ; k++ ){
342                     var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
343                     if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
344                         new_array.push(str);
345                     }
346                 }
347             }
348             new_array.sort();
349             return new_array;
350           }
351           [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
352           function createSelect( data ) {
353               data = separateData(data);
354               var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
355               var regex = /(<([^>]+)>)/ig; // Remove html tags
356               for ( i=0 ; i<len ; i++ ) {
357                   var cell_val = data[i].replace(regex, '');
358                   if ( cell_val.length < 1 ) continue;
359                   r += '<option value="'+cell_val+'">'+cell_val+'</option>';
360               }
361               return r+'</select>';
362           }
363           $("#homebranchfilter").each( function () {
364               $(this).html( createSelect( holdst.fnGetColumnData(5) ) );
365               $('select', this).change( function () {
366                   holdst.fnFilter( $(this).val(), 5 );
367               });
368           });
369           $("#itemtype-filter").each( function () {
370               $(this).html( createSelect( holdst.fnGetColumnData(10) ) );
371               $('select', this).change( function () {
372                   holdst.fnFilter( $(this).val(), 10 );
373               });
374           });
375           $("#locationfilter").each( function () {
376               $(this).html( createSelect( holdst.fnGetColumnData(11) ) );
377               $('select', this).change( function () {
378                   holdst.fnFilter( $(this).val(), 11 );
379               });
380           });
381           $("#pickup-location").each( function () {
382               $(this).html( createSelect( holdst.fnGetColumnData(14) ) );
383               $('select', this).change( function () {
384                   holdst.fnFilter( $(this).val(), 14 );
385               });
386           });
387         });
388     </script>
389 [% END %]
390
391 [% INCLUDE 'intranet-bottom.inc' %]