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