b37fdd595bbe711f4af8a48df40f980bf6ec7389
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / pendingreserves.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE ColumnsSettings %]
5 [% USE AuthorisedValues %]
6 [%- USE Branches -%]
7 [%- USE ItemTypes -%]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Koha &rsaquo; Circulation &rsaquo; Holds to pull</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% Asset.css("css/datatables.css") %]
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 id="doc3" class="yui-t2">
23
24    <div id="bd">
25     <div id="yui-main">
26     <div class="yui-b">
27         [% FOR m IN messages %]
28             <div class="dialog [% m.type %]">
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 %]
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 class="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</td>
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 %]</b></p></td>
74             <td>[% reserveloo.count %]</td>
75             <td>[% reserveloo.rcount %]</td>
76             <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrowernumber %]">[% reserveloo.firstname %] [%reserveloo.surname %]</a></td>
77             <td>
78             <p>
79                 [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
80                 [% reserveloo.title |html %] [% FOREACH s IN reserveloo.subtitle %] [% s %][% END %]</a></p>
81                 [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author %]</p>[% END %]
82             </td>
83         [% ELSE %]
84             <td>"</td>
85             <td>"</td>
86             <td>"</td>
87             <td>"</td>
88             <td>"</td>
89         [% END %]
90         <td>
91             [% FOREACH holdingbranch IN reserveloo.holdingbranches %]
92                 [% Branches.GetName ( holdingbranch ) %]
93             [% END %]
94         </td>
95         <td><p>[% reserveloo.itemcallnumber %]</p></td>
96         <td><p>[% reserveloo.copyno %]</p></td>
97         <td><p>[% reserveloo.enumchron %]</p></td>
98         <td>
99         [% FOREACH itemType IN reserveloo.itemTypes %]
100             [% ItemTypes.GetDescription( itemType ) %]
101         [% END %]
102         </td>
103         <td>
104         [% FOREACH loc IN reserveloo.locations %]
105             [% AuthorisedValues.GetByCode('LOC', loc) %]
106         [% END %]
107         </td>
108         <td>
109             <span title="[% reserveloo.reservedate %]">[% reserveloo.reservedate | $KohaDates %] in [% Branches.GetName ( reserveloo.branch ) %]</span>
110         </td>
111         <td>
112             <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
113                 <input type="hidden" name="op" value="cancel_reserve" />
114                 <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id %]" />
115                 [% IF reserveloo.holdingbranch != reserveloo.homebranch %]
116                     <input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.homebranch ) %]" />
117                 [% ELSE %]
118                     <input type="submit" value="Cancel hold" />
119                 [% END %]
120             </form>
121
122         [% IF Koha.Preference('CanMarkHoldsToPullAsLost') != 'do_not_allow' %]
123             [% IF reserveloo.itemnumber %]
124                 <form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
125                     <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id %]" />
126                     [% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %]
127                         <input type="hidden" name="op" value="mark_as_lost" />
128                         <input type="submit" value="Mark item as lost" />
129                     [% ELSIF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow_and_notify' %]
130                         <input type="hidden" name="op" value="mark_as_lost_and_notify" />
131                         <input type="submit" value="Mark lost and notify patron" />
132                     [% END %]
133                 </form>
134             [% ELSE %]
135                 <span>Biblio level hold.</span>
136             [% END %]
137         [% END %]
138         </tr>
139         [% END %]
140     </tbody>
141     <tfoot>
142         <tr>
143         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
144         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
145         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
146         <td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
147         <td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
148         <td id="homebranchfilter"></td>
149         <td><input type="text" class="filter" data-column_num="6" placeholder="Call number" style="width:95%"/></td>
150         <td><input type="text" class="filter" data-column_num="7" placeholder="Available copy" style="width:95%"/></td>
151         <td><input type="text" class="filter" data-column_num="8" placeholder="Available enumeration" style="width:95%"/></td>
152         <td id="type-filter"></td>
153         <td id="locationfilter"></td>
154         <td></td>
155         <td></td>
156         </tr>
157     </tfoot>
158     </table>
159     [% ELSE %]
160         <b>No items found.</b>
161     [% END %]
162 </div>
163
164 </div>
165 </div>
166 <div class="yui-b">
167 <div id="filters">
168
169 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
170 <fieldset class="brief">
171 <h4>Refine results</h4>
172 <ol>
173 <li>
174 <label for="from">
175     Start date:
176 </label>
177 <input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
178 </li>
179 <li><label for="to">
180     End date:
181 </label>
182 <input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
183 </li>
184 </ol>
185
186 [% IF ( HoldsToPullEndDate ) %]
187     <p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% HoldsToPullEndDate %] days ahead. Set other date ranges as needed.)</i></p>
188 [% ELSE %]
189     <p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to today. Set other date ranges as needed.)</i></p>
190 [% END %]
191
192 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
193 </fieldset>
194 </form>
195
196 </div>
197 </div>
198 </div>
199
200 [% MACRO jsinclude BLOCK %]
201     [% INCLUDE 'calendar.inc' %]
202     [% INCLUDE 'datatables.inc' %]
203     [% INCLUDE 'columns_settings.inc' %]
204     <script type="text/javascript">
205         $(document).ready(function() {
206           var columns_settings = [% ColumnsSettings.GetColumns('circ', 'holds', 'holds-to-pull', 'json') %];
207           var holdst = KohaTable("holdst", {
208             "aoColumnDefs": [
209                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
210                 { "sType": "title-string", "aTargets" : [ "title-string" ] },
211                 { "sType": "string", "aTargets": [ "string-sort" ] }
212             ],
213             "sPaginationType": "full_numbers"
214           }, columns_settings);
215           holdst.fnAddFilters("filter");
216           [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
217           function separateData ( ColumnData ){
218             var cD = ColumnData;
219             var new_array = new Array();
220             for ( j=0 ; j<cD.length ; j++ ) {
221                 var split_array = cD[j].split(/\n/gi);
222                 for ( k=0 ; k<split_array.length ; k++ ){
223                     var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
224                     if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
225                         new_array.push(str);
226                     }
227                 }
228             }
229             new_array.sort();
230             return new_array;
231           }
232           [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
233           function createSelect( data ) {
234               data = separateData(data);
235               var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
236               for ( i=0 ; i<len ; i++ ) {
237                   r += '<option value="'+data[i]+'">'+data[i]+'</option>';
238               }
239               return r+'</select>';
240           }
241           $("#homebranchfilter").each( function () {
242               $(this).html( createSelect( holdst.fnGetColumnData(5) ) );
243               $('select', this).change( function () {
244                   var filter_value = $(this).val();
245                   holdst.fnFilter( filter_value, 5, true );
246               });
247           });
248           $("#type-filter").each( function () {
249               $(this).html( createSelect( holdst.fnGetColumnData(9) ) );
250               $('select', this).change( function () {
251                   holdst.fnFilter( $(this).val(), 9 );
252               });
253           });
254           $("#locationfilter").each( function () {
255               $(this).html( createSelect( holdst.fnGetColumnData(10) ) );
256               $('select', this).change( function () {
257                   holdst.fnFilter( $(this).val(), 10 );
258               });
259           });
260         });
261     </script>
262 [% END %]
263
264 [% INCLUDE 'intranet-bottom.inc' %]