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