Bug 22536: Display problem in Holds to Pull report
[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 [% Asset.css("css/datatables.css") | $raw %]
14 </head>
15
16 <body id="circ_pendingreserves" class="circ">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'circ-search.inc' %]
19
20
21 <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
23 <div id="doc3" class="yui-t2">
24
25    <div id="bd">
26     <div id="yui-main">
27     <div class="yui-b">
28         [% FOR m IN messages %]
29             <div class="dialog [% m.type | html %]">
30                 [% SWITCH m.code %]
31                 [% CASE 'letter_enqueued' %]
32                     <span>The notice has been correctly enqueued.</span>
33                 [% CASE 'no_email_address' %]
34                     <span>The patron does not have an email address defined.</span>
35                 [% CASE 'no_template_notice' %]
36                     <span>There is no notice template with a code 'CANCEL_HOLD_ON_LOST' defined in your system.</span>
37                 [% CASE 'hold_cancelled' %]
38                     <span>The hold has been correctly cancelled.</span>
39                 [% CASE 'hold_placed_at_biblio_level' %]
40                     <span>The hold has been placed on biblio level. It is not possible to determine the item to mark as lost.</span>
41                 [% CASE %]
42                     [% m.code | html %]
43                 [% END %]
44             </div>
45         [% END %]
46
47 <h2>Holds to pull placed between [% from | $KohaDates %] and [% to | $KohaDates %]</h2>
48 <h3>Reported on [% todaysdate | $KohaDates %]</h3>
49 <p>The following holds have not been filled. Please retrieve them and check them in.</p>
50 <div id="searchresults">
51     [% IF ( reserveloop ) %]
52     <table id="holdst">
53     <thead>
54         <tr>
55         <th>Pull this many items</th>
56         <th>Items available</th>
57         <th>Patrons with holds</th>
58         <th>First patron</th>
59         <th class="anti-the">Title</th>
60         <th class="string-sort">Libraries</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><b>[% reserveloo.pullcount | html %]</b></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-default-view.inc' biblionumber = reserveloo.biblionumber %]
81                 [% reserveloo.title | html %] [% FOREACH s IN reserveloo.subtitle %] [% s | html %][% END %]</a></p>
82                 [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author | html %]</p>[% END %]
83             </td>
84         [% ELSE %]
85             <td>"</td>
86             <td>"</td>
87             <td>"</td>
88             <td>"</td>
89             <td>"</td>
90         [% END %]
91         <td>
92             [% IF ( reserveloo.holdingbranches ) %]
93                <ul>
94                     [% FOREACH holdingbranch IN reserveloo.holdingbranches %]
95                         <li>
96                             [% Branches.GetName ( holdingbranch ) | html %]
97                         </li>
98                     [% END %]
99                </ul>
100             [% END %]
101         </td>
102         <td>
103             [% IF ( reserveloo.itemcallnumber ) %]
104                 <ul>
105                     [% FOREACH itemcallnumber IN reserveloo.itemcallnumber  %]
106                         <li>
107                             [% itemcallnumber | html %]
108                         </li>
109                     [% END %]
110                 </ul>
111             [% END %]
112         </td>
113         <td>
114             [% IF ( reserveloo.copyno ) %]
115                 <ul>
116                     [% FOREACH copyno IN reserveloo.copyno %]
117                         <li>
118                             [% copyno | html %]
119                         </li>
120                     [% END %]
121                 </ul>
122             [% END %]
123         </td>
124         <td>
125             [% IF ( reserveloo.enumchron ) %]
126                 <ul>
127                     [% FOREACH enumchron IN reserveloo.enumchron %]
128                         <li>
129                             [% enumchron | html %]
130                         </li>
131                     [% END %]
132                 </ul>
133             [% END %]
134         </td>
135         <td>
136         [% FOREACH itemType IN reserveloo.itemTypes %]
137             [% ItemTypes.GetDescription( itemType ) | html %]
138         [% END %]
139         </td>
140         <td>
141         [% FOREACH loc IN reserveloo.locations %]
142             [% AuthorisedValues.GetByCode('LOC', loc) | html %]
143         [% END %]
144         </td>
145         <td>
146             <span title="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %] in [% Branches.GetName ( reserveloo.branch ) | html %]</span>
147         </td>
148         <td>
149             <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
150                 <input type="hidden" name="op" value="cancel_reserve" />
151                 <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id | html %]" />
152                 [% IF reserveloo.holdingbranch != reserveloo.homebranch %]
153                     <input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.homebranch ) | html %]" />
154                 [% ELSE %]
155                     <input type="submit" value="Cancel hold" />
156                 [% END %]
157             </form>
158
159         [% IF Koha.Preference('CanMarkHoldsToPullAsLost') != 'do_not_allow' %]
160             [% IF reserveloo.itemnumber %]
161                 <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
162                     <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id | html %]" />
163                     [% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %]
164                         <input type="hidden" name="op" value="mark_as_lost" />
165                         <input type="submit" value="Mark item as lost" />
166                     [% ELSIF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow_and_notify' %]
167                         <input type="hidden" name="op" value="mark_as_lost_and_notify" />
168                         <input type="submit" value="Mark lost and notify patron" />
169                     [% END %]
170                 </form>
171             [% ELSE %]
172                 <span>Biblio level hold.</span>
173             [% END %]
174         [% END %]
175             </td>
176         </tr>
177         [% END %]
178     </tbody>
179     <tfoot>
180         <tr>
181         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
182         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
183         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
184         <td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
185         <td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
186         <td id="homebranchfilter"></td>
187         <td><input type="text" class="filter" data-column_num="6" placeholder="Call number" style="width:95%"/></td>
188         <td><input type="text" class="filter" data-column_num="7" placeholder="Available copy" style="width:95%"/></td>
189         <td><input type="text" class="filter" data-column_num="8" placeholder="Available enumeration" style="width:95%"/></td>
190         <td id="itemtype-filter"></td>
191         <td id="locationfilter"></td>
192         <td></td>
193         <td></td>
194         </tr>
195     </tfoot>
196     </table>
197     [% ELSE %]
198         <b>No items found.</b>
199     [% END %]
200 </div>
201
202 </div>
203 </div>
204 <div class="yui-b">
205 <div id="filters">
206
207 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
208 <fieldset class="brief">
209 <h4>Refine results</h4>
210 <ol>
211 <li>
212 <label for="from">
213     Start date:
214 </label>
215 <input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
216 </li>
217 <li><label for="to">
218     End date:
219 </label>
220 <input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
221 </li>
222 </ol>
223
224 [% IF ( HoldsToPullEndDate ) %]
225     <p><i>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to [% HoldsToPullEndDate | html %] days ahead. Set other date ranges as needed.)</i></p>
226 [% ELSE %]
227     <p><i>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to today. Set other date ranges as needed.)</i></p>
228 [% END %]
229
230 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
231 </fieldset>
232 </form>
233
234 </div>
235 </div>
236 </div>
237
238 [% MACRO jsinclude BLOCK %]
239     [% INCLUDE 'calendar.inc' %]
240     [% INCLUDE 'datatables.inc' %]
241     [% INCLUDE 'columns_settings.inc' %]
242     <script type="text/javascript">
243         $(document).ready(function() {
244           var columns_settings = [% ColumnsSettings.GetColumns('circ', 'holds', 'holds-to-pull', 'json') | $raw %];
245           var holdst = KohaTable("holdst", {
246             "aoColumnDefs": [
247                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
248                 { "sType": "title-string", "aTargets" : [ "title-string" ] },
249                 { "sType": "string", "aTargets": [ "string-sort" ] }
250             ],
251             "sPaginationType": "full_numbers"
252           }, columns_settings);
253           holdst.fnAddFilters("filter");
254           [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
255           function separateData ( ColumnData ){
256             var cD = ColumnData;
257             var new_array = new Array();
258             for ( j=0 ; j<cD.length ; j++ ) {
259                 var split_array = cD[j].split(/\n/gi);
260                 for ( k=0 ; k<split_array.length ; k++ ){
261                     var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
262                     if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
263                         new_array.push(str);
264                     }
265                 }
266             }
267             new_array.sort();
268             return new_array;
269           }
270           [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
271           function createSelect( data ) {
272               data = separateData(data);
273               var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
274               for ( i=0 ; i<len ; i++ ) {
275                   r += '<option value="'+data[i]+'">'+data[i]+'</option>';
276               }
277               return r+'</select>';
278           }
279           $("#homebranchfilter").each( function () {
280               $(this).html( createSelect( holdst.fnGetColumnData(5) ) );
281               $('select', this).change( function () {
282                   var filter_value = $(this).val();
283                   holdst.fnFilter( filter_value, 5, true );
284               });
285           });
286           $("#itemtype-filter").each( function () {
287               $(this).html( createSelect( holdst.fnGetColumnData(9) ) );
288               $('select', this).change( function () {
289                   holdst.fnFilter( $(this).val(), 9 );
290               });
291           });
292           $("#locationfilter").each( function () {
293               $(this).html( createSelect( holdst.fnGetColumnData(10) ) );
294               $('select', this).change( function () {
295                   holdst.fnFilter( $(this).val(), 10 );
296               });
297           });
298         });
299     </script>
300 [% END %]
301
302 [% INCLUDE 'intranet-bottom.inc' %]