88decc7ad0c86bf80b61d23e69fc76c18a12708f
[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 ColumnsSettings %]
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>
14
15 <body id="circ_pendingreserves" class="circ">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'circ-search.inc' %]
18
19
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>
21
22 <div class="main container-fluid">
23     <div class="row">
24         <div class="col-sm-10 col-sm-push-2">
25             <main>
26
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 %]
45
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 call numbers</th>
61         <th>Available copy numbers</th>
62         <th>Available enumeration</th>
63         <th class="string-sort">Available item types</th>
64         <th class="string-sort">Available locations</th>
65         <th class="title-string">Earliest hold date</th>
66         <th>Action</th>
67         </tr>
68     </thead>
69     <tbody>
70         [% FOREACH reserveloo IN reserveloop %]
71         <tr>
72         [% IF ( reserveloo.borrowernumber ) %]
73             <td><p><b>[% reserveloo.pullcount | html %]</b></p></td>
74             <td>[% reserveloo.count | html %]</td>
75             <td>[% reserveloo.rcount | html %]</td>
76             <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrowernumber | uri %]">[% reserveloo.firstname | html %] [% reserveloo.surname | html %]</a></td>
77             <td>
78             <p>
79                 [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
80                     [% INCLUDE 'biblio-title.inc' biblio=reserveloo %]
81                 </a></p>
82                 [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author | html %]</p>[% END %]
83                 [% IF ( reserveloo.editionstatement ) %]<p>[% reserveloo.editionstatement | html %]</p>[% END %]
84             </td>
85         [% ELSE %]
86             <td>"</td>
87             <td>"</td>
88             <td>"</td>
89             <td>"</td>
90             <td>"</td>
91         [% END %]
92         <td>
93             [% IF ( reserveloo.holdingbranches ) %]
94                <ul>
95                     [% FOREACH holdingbranch IN reserveloo.holdingbranches %]
96                         <li>
97                             [% Branches.GetName ( holdingbranch ) | html %]
98                         </li>
99                     [% END %]
100                </ul>
101             [% END %]
102         </td>
103         <td>
104             [% IF ( reserveloo.itemcallnumber ) %]
105                 <ul>
106                     [% FOREACH itemcallnumber IN reserveloo.itemcallnumber  %]
107                         <li>
108                             [% itemcallnumber | html %]
109                         </li>
110                     [% END %]
111                 </ul>
112             [% END %]
113         </td>
114         <td>
115             [% IF ( reserveloo.copyno ) %]
116                 <ul>
117                     [% FOREACH copyno IN reserveloo.copyno %]
118                         <li>
119                             [% copyno | html %]
120                         </li>
121                     [% END %]
122                 </ul>
123             [% END %]
124         </td>
125         <td>
126             [% IF ( reserveloo.enumchron ) %]
127                 <ul>
128                     [% FOREACH enumchron IN reserveloo.enumchron %]
129                         <li>
130                             [% enumchron | html %]
131                         </li>
132                     [% END %]
133                 </ul>
134             [% END %]
135         </td>
136         <td>
137         [% FOREACH itemType IN reserveloo.itemTypes %]
138             [% ItemTypes.GetDescription( itemType ) | html %]
139         [% END %]
140         </td>
141         <td>
142         [% FOREACH loc IN reserveloo.locations %]
143             [% AuthorisedValues.GetByCode('LOC', loc) | html %]
144         [% END %]
145         </td>
146         <td>
147             <span title="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %] in [% Branches.GetName ( reserveloo.branch ) | html %]</span>
148         </td>
149         <td>
150             <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
151                 <input type="hidden" name="op" value="cancel_reserve" />
152                 <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id | html %]" />
153                 [% IF reserveloo.holdingbranch != reserveloo.homebranch %]
154                     <input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.homebranch ) | html %]" />
155                 [% ELSE %]
156                     <input type="submit" value="Cancel hold" />
157                 [% END %]
158             </form>
159
160         [% IF Koha.Preference('CanMarkHoldsToPullAsLost') != 'do_not_allow' %]
161             [% IF reserveloo.itemnumber %]
162                 <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
163                     <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id | html %]" />
164                     [% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %]
165                         <input type="hidden" name="op" value="mark_as_lost" />
166                         <input type="submit" value="Mark item as lost" />
167                     [% ELSIF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow_and_notify' %]
168                         <input type="hidden" name="op" value="mark_as_lost_and_notify" />
169                         <input type="submit" value="Mark lost and notify patron" />
170                     [% END %]
171                 </form>
172             [% ELSE %]
173                 <span>Biblio level hold.</span>
174             [% END %]
175         [% END %]
176             </td>
177         </tr>
178         [% END %]
179     </tbody>
180     <tfoot>
181         <tr>
182         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
183         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
184         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
185         <td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
186         <td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
187         <td id="homebranchfilter"></td>
188         <td><input type="text" class="filter" data-column_num="6" placeholder="Call number" style="width:95%"/></td>
189         <td><input type="text" class="filter" data-column_num="7" placeholder="Available copy" style="width:95%"/></td>
190         <td><input type="text" class="filter" data-column_num="8" placeholder="Available enumeration" style="width:95%"/></td>
191         <td id="itemtype-filter"></td>
192         <td id="locationfilter"></td>
193         <td></td>
194         <td></td>
195         </tr>
196     </tfoot>
197     </table>
198     [% ELSE %]
199         <b>No items found.</b>
200     [% END %]
201 </div>
202
203
204             </main>
205         </div> <!-- /.col-sm-10.col-sm-push-2 -->
206
207         <div class="col-sm-2 col-sm-pull-10">
208             <aside>
209
210 <div id="filters">
211
212 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
213 <fieldset class="brief">
214 <h4>Refine results</h4>
215 <ol>
216 <li>
217 <label for="from">
218     Start date:
219 </label>
220 <input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
221 </li>
222 <li><label for="to">
223     End date:
224 </label>
225 <input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
226 </li>
227 </ol>
228
229 [% IF ( HoldsToPullEndDate ) %]
230     <p><i>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to [% HoldsToPullEndDate | html %] days ahead. Set other date ranges as needed.)</i></p>
231 [% ELSE %]
232     <p><i>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to today. Set other date ranges as needed.)</i></p>
233 [% END %]
234
235 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
236 </fieldset>
237 </form>
238
239 </div>
240             </aside>
241         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
242      </div> <!-- /.row -->
243
244 [% MACRO jsinclude BLOCK %]
245     [% INCLUDE 'calendar.inc' %]
246     [% INCLUDE 'datatables.inc' %]
247     [% INCLUDE 'columns_settings.inc' %]
248     <script>
249         $(document).ready(function() {
250           var columns_settings = [% ColumnsSettings.GetColumns('circ', 'holds', 'holds-to-pull', 'json') | $raw %];
251           var holdst = KohaTable("holdst", {
252             "aoColumnDefs": [
253                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
254                 { "sType": "title-string", "aTargets" : [ "title-string" ] },
255                 { "sType": "string", "aTargets": [ "string-sort" ] }
256             ],
257             "sPaginationType": "full_numbers"
258           }, columns_settings);
259           holdst.fnAddFilters("filter");
260           [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
261           function separateData ( ColumnData ){
262             var cD = ColumnData;
263             var new_array = new Array();
264             for ( j=0 ; j<cD.length ; j++ ) {
265                 var split_array = cD[j].split(/\n/gi);
266                 for ( k=0 ; k<split_array.length ; k++ ){
267                     var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
268                     if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
269                         new_array.push(str);
270                     }
271                 }
272             }
273             new_array.sort();
274             return new_array;
275           }
276           [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
277           function createSelect( data ) {
278               data = separateData(data);
279               var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
280               var regex = /(<([^>]+)>)/ig; // Remove html tags
281               for ( i=0 ; i<len ; i++ ) {
282                   var cell_val = data[i].replace(regex, '');
283                   if ( cell_val.length < 1 ) continue;
284                   r += '<option value="'+cell_val+'">'+cell_val+'</option>';
285               }
286               return r+'</select>';
287           }
288           $("#homebranchfilter").each( function () {
289               $(this).html( createSelect( holdst.fnGetColumnData(5) ) );
290               $('select', this).change( function () {
291                   var filter_value = $(this).val();
292                   holdst.fnFilter( filter_value, 5, true );
293               });
294           });
295           $("#itemtype-filter").each( function () {
296               $(this).html( createSelect( holdst.fnGetColumnData(9) ) );
297               $('select', this).change( function () {
298                   holdst.fnFilter( $(this).val(), 9 );
299               });
300           });
301           $("#locationfilter").each( function () {
302               $(this).html( createSelect( holdst.fnGetColumnData(10) ) );
303               $('select', this).change( function () {
304                   holdst.fnFilter( $(this).val(), 10 );
305               });
306           });
307         });
308     </script>
309 [% END %]
310
311 [% INCLUDE 'intranet-bottom.inc' %]