|
Lines 5-10
Link Here
|
| 5 |
[% USE Categories %] |
5 |
[% USE Categories %] |
| 6 |
[% USE KohaDates %] |
6 |
[% USE KohaDates %] |
| 7 |
[% USE ItemTypes %] |
7 |
[% USE ItemTypes %] |
|
|
8 |
[% USE TablesSettings %] |
| 9 |
[% USE To %] |
| 8 |
[% PROCESS 'html_helpers.inc' %] |
10 |
[% PROCESS 'html_helpers.inc' %] |
| 9 |
|
11 |
|
| 10 |
[% INCLUDE 'doc-head-open.inc' %] |
12 |
[% INCLUDE 'doc-head-open.inc' %] |
|
Lines 35-56
Link Here
|
| 35 |
[% END #/ WRAPPER breadcrumbs %] |
37 |
[% END #/ WRAPPER breadcrumbs %] |
| 36 |
[% END #/ WRAPPER sub-header.inc %] |
38 |
[% END #/ WRAPPER sub-header.inc %] |
| 37 |
|
39 |
|
| 38 |
<div class="main container-fluid"> |
40 |
<div class="main container-fluid"> |
| 39 |
<div class="row"> |
41 |
<div class="row"> |
| 40 |
<div class="col-sm-10 order-md-2 order-sm-1"> |
42 |
<div class="col-sm-10 col-sm-push-2 order-sm-1"> |
| 41 |
<main> |
43 |
<main> |
| 42 |
|
44 |
<h1>Batch modify holds</h1> |
| 43 |
<h1>Batch modify holds</h1> |
45 |
[% IF view == "form" %] |
| 44 |
|
46 |
<div id="modify_holds_search"> |
| 45 |
[% IF view == 'form' %] |
|
|
| 46 |
<form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> |
47 |
<form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> |
| 47 |
<fieldset class="rows"> |
48 |
<fieldset class="rows"> |
| 48 |
<legend>Hold search criteria:</legend> |
49 |
<legend>Hold search criteria:</legend> |
| 49 |
<span class="hint">NOTE! Column patron_expiration_date is used as a main filter for expiration date field. Otherwise column expirationdate is used.</span> |
|
|
| 50 |
<ol> |
50 |
<ol> |
| 51 |
<li> |
51 |
<li> |
| 52 |
<label for="expirationdate_from">Expiration date from:</label> |
52 |
<label for="expirationdate_from">Expiration date from:</label> |
| 53 |
<input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" data-date_to="to" /> |
53 |
<input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" data-date_to="expirationdate_to" /> |
| 54 |
</li> |
54 |
</li> |
| 55 |
<li> |
55 |
<li> |
| 56 |
<label for="expirationdate_to">Expiration date to:</label> |
56 |
<label for="expirationdate_to">Expiration date to:</label> |
|
Lines 81-318
Link Here
|
| 81 |
</li> |
81 |
</li> |
| 82 |
<li> |
82 |
<li> |
| 83 |
<label for="suspend_until_from">Suspended until from:</label> |
83 |
<label for="suspend_until_from">Suspended until from:</label> |
| 84 |
<input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="to" /> |
84 |
<input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="suspend_until_to" /> |
| 85 |
</li> |
85 |
</li> |
| 86 |
<li> |
86 |
<li> |
| 87 |
<label for="suspend_until_to">Suspended until to:</label> |
87 |
<label for="suspend_until_to">Suspended until to:</label> |
| 88 |
<input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr"/> |
88 |
<input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr"/> |
| 89 |
</li> |
89 |
</li> |
| 90 |
<li> |
90 |
<li> |
| 91 |
<label for="reservenotes">Hold note:</label> |
91 |
<label for="holdnotes">Hold note:</label> |
| 92 |
<input type="text" id="reservenotes" name="reservenotes"/> |
92 |
<input type="text" id="holdnotes" name="holdnotes"/> |
| 93 |
</li> |
93 |
</li> |
| 94 |
</ol> |
94 |
</ol> |
| 95 |
</fieldset> |
95 |
</fieldset> |
| 96 |
<fieldset class="action"> |
96 |
<fieldset class="action"> |
| 97 |
<input type="hidden" name="op" value="list"/> |
97 |
<input type="submit" class="btn btn-primary" value="Search"/> |
| 98 |
<input type="submit" class="btn btn-primary" value="Continue"/> |
|
|
| 99 |
<a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a> |
| 100 |
</fieldset> |
98 |
</fieldset> |
| 101 |
</form> <!-- /#modify_holds_form --> |
99 |
</form> <!-- /#modify_holds_form --> |
| 102 |
[% ELSIF view == 'list' %] |
100 |
</div> <!-- /#modify_holds_search --> |
| 103 |
<form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process"> |
101 |
[% ELSIF view == "report" %] |
|
|
102 |
<div id="modified_holds_results-wrapper"> |
| 103 |
<div id="modified_holds_results" class="page-section"> |
| 104 |
<table id="modified_holds"></table> |
| 105 |
</div> <!-- /#modified_holds_results --> |
| 106 |
<fieldset class="action"> |
| 107 |
<a href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return to batch hold modification</a> |
| 108 |
</fieldset > |
| 109 |
</div> <!-- /#modified_holds_results-wrapper --> |
| 110 |
[% END %] |
| 111 |
<div id="modify_holds_results-wrapper" style="display:none;"> |
| 112 |
<div id="toolbar" class="btn-toolbar"> |
| 113 |
<a href="#" id="edit_search" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit search</a> |
| 114 |
</div> <!-- /#toolbar --> |
| 115 |
<form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process_mods"> |
| 104 |
[% INCLUDE 'csrf-token.inc' %] |
116 |
[% INCLUDE 'csrf-token.inc' %] |
| 105 |
[% IF holds.count %] |
117 |
<div id="modify_holds_results" class="page-section"> |
| 106 |
<div><p>Found [% holds.count | html %][% IF holds.count > 1 %] holds [% ELSE %] hold [% END %]to modify.</p></div> |
118 |
<div id="searchheader" class="searchheader"> |
| 107 |
<div class="page-section"> |
119 |
<a id="select_all" href="#" class="btn btn-link"><i class="fa fa-check"></i> Select all visible rows</a> |
| 108 |
<div class="btn-toolbar selections-toolbar"> |
120 |
| <a id="clear_all" href="#" class="btn btn-link"><i class="fa fa-times"></i> Clear selections</a> |
| 109 |
<a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a> |
|
|
| 110 |
<a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a> |
| 111 |
</div> |
| 112 |
<table id="found_holds"> |
| 113 |
<thead> |
| 114 |
<tr> |
| 115 |
<th> </th> |
| 116 |
<th>Expiration date</th> |
| 117 |
<th>Patron expiration date</th> |
| 118 |
<th>Title</th> |
| 119 |
<th>Barcode</th> |
| 120 |
<th>Status</th> |
| 121 |
<th>Hold pickup library</th> |
| 122 |
<th>Suspended</th> |
| 123 |
<th>Suspended until</th> |
| 124 |
<th>Note</th> |
| 125 |
</tr> |
| 126 |
</thead> |
| 127 |
<tbody> |
| 128 |
[% FOREACH hold IN holds %] |
| 129 |
<tr> |
| 130 |
<td><input type="checkbox" name="hold_id" value="[% hold.reserve_id | html %]"/></td> |
| 131 |
<td>[% hold.expirationdate | $KohaDates %]</td> |
| 132 |
<td>[% hold.patron_expiration_date | $KohaDates %]</td> |
| 133 |
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> |
| 134 |
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]">[% hold.item.barcode | html %]</a></td> |
| 135 |
<td class="found_status" data-found="[% hold.found | html %]"> |
| 136 |
[% IF hold.found == "T" %] |
| 137 |
In transit |
| 138 |
[% ELSIF hold.found == "P" %] |
| 139 |
In processing |
| 140 |
[% ELSIF hold.found == "W" %] |
| 141 |
Waiting |
| 142 |
[% ELSE %] |
| 143 |
No status |
| 144 |
[% END %] |
| 145 |
</td> |
| 146 |
<td>[% Branches.GetName( hold.branchcode ) | html %]</td> |
| 147 |
<td>[% IF hold.suspend %]Yes[% ELSE %]No[% END %]</td> |
| 148 |
<td>[% hold.suspend_until | $KohaDates %]</td> |
| 149 |
<td>[% hold.reservenotes | html %]</td> |
| 150 |
</tr> |
| 151 |
[% END %] |
| 152 |
</tbody> |
| 153 |
</table> <!-- /#holds --> |
| 154 |
</div> <!-- /.page-section --> |
| 155 |
<h2>Modify holds</h2> |
| 156 |
<div class="page-section"> |
| 157 |
<table id="hold_modifies"> |
| 158 |
<thead> |
| 159 |
<tr> |
| 160 |
<th>New expiration date</th> |
| 161 |
<th>New pickup library</th> |
| 162 |
<th>Suspend holds</th> |
| 163 |
<th>Suspend until</th> |
| 164 |
<th>New reserve note</th> |
| 165 |
</tr> |
| 166 |
</thead> |
| 167 |
<tbody> |
| 168 |
<tr> |
| 169 |
<td> |
| 170 |
<input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true"/> |
| 171 |
</td> |
| 172 |
<td> |
| 173 |
<select id="new_pickup_loc" name="new_pickup_loc"> |
| 174 |
<option value="" selected="selected"></option> |
| 175 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations(selected = "") %] |
| 176 |
</select> |
| 177 |
</td> |
| 178 |
<td> |
| 179 |
<select id="new_suspend_status" name="new_suspend_status"> |
| 180 |
<option value="" selected="selected"></option> |
| 181 |
<option value="not_suspended">Not suspended</option> |
| 182 |
<option value="suspend">Suspend</option> |
| 183 |
</select> |
| 184 |
</td> |
| 185 |
<td> |
| 186 |
<input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true"/> |
| 187 |
</td> |
| 188 |
<td> |
| 189 |
<input type="text" id="new_reserve_note" name="new_reserve_note"/> |
| 190 |
</td> |
| 191 |
</tr> |
| 192 |
</tbody> |
| 193 |
</table> <!-- /#hold_modifies --> |
| 194 |
</div> |
| 195 |
<fieldset class="action"> |
| 196 |
<input type="hidden" name="op" value="cud-modify"/> |
| 197 |
<input type="submit" class="btn btn-primary" value="Modify selected holds"/> |
| 198 |
<a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a> |
| 199 |
</fieldset> |
| 200 |
</form> <!-- /#process --> |
| 201 |
[% ELSE %] |
| 202 |
<div class="dialog message"> |
| 203 |
No holds were found for the selected filters. |
| 204 |
</div> |
121 |
</div> |
| 205 |
<a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return</a> |
122 |
<h3>Holds found for: <span class="searchpattern"></span></h3> |
| 206 |
[% END %] |
123 |
<table id="holds_to_modify"></table> |
| 207 |
[% ELSIF view == 'report' %] |
124 |
</div> <!-- /#modify_holds_results --> |
| 208 |
<div class="dialog message"> |
125 |
<div id="modify_holds_form_options" class="page-section"> |
| 209 |
[% updated_holds.count | html %] holds have been modified! |
126 |
<h2>Modify holds</h2> |
| 210 |
</div> |
127 |
<table id="modify_holds_options"> |
| 211 |
<div class="page-section"> |
|
|
| 212 |
<table id="holds"> |
| 213 |
<thead> |
128 |
<thead> |
| 214 |
<tr> |
129 |
<tr> |
| 215 |
<th>Expiration date</th> |
130 |
<th>New expiration date</th> |
| 216 |
<th>Title</th> |
131 |
<th>New pickup library</th> |
| 217 |
<th>Barcode</th> |
132 |
<th>Suspend holds</th> |
| 218 |
<th>Hold pickup library</th> |
133 |
<th>Suspend until</th> |
| 219 |
<th>Suspended</th> |
134 |
<th>New hold note</th> |
| 220 |
<th>Suspended until</th> |
|
|
| 221 |
<th>Note</th> |
| 222 |
</tr> |
135 |
</tr> |
| 223 |
</thead> |
136 |
</thead> |
| 224 |
<tbody> |
137 |
<tbody> |
| 225 |
[% FOREACH hold IN updated_holds %] |
138 |
<tr> |
| 226 |
<tr> |
139 |
<td> |
| 227 |
<td>[% hold.expirationdate | $KohaDates %]</td> |
140 |
<input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true" /> |
| 228 |
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> |
141 |
</td> |
| 229 |
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]">[% hold.item.barcode | html %]</a></td> |
142 |
<td> |
| 230 |
<td>[% Branches.GetName( hold.branchcode ) | html %]</td> |
143 |
<select name="new_pickup_loc" id="new_pickup_loc"> |
| 231 |
<td>[% IF hold.suspend == 0 %]No[% ELSE %]Yes[% END %]</td> |
144 |
<option value="" selected="selected"></option> |
| 232 |
<td>[% hold.suspend_until | $KohaDates %]</td> |
145 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ selected => "" }) %] |
| 233 |
<td>[% hold.reservenotes | html %]</td> |
146 |
</select> |
| 234 |
</tr> |
147 |
</td> |
| 235 |
[% END %] |
148 |
<td> |
|
|
149 |
<select id="new_suspend_status" name="new_suspend_status"> |
| 150 |
<option value="" selected="selected"></option> |
| 151 |
<option value="0">Not suspended</option> |
| 152 |
<option value="1">Suspend</option> |
| 153 |
</select> |
| 154 |
</td> |
| 155 |
<td> |
| 156 |
<input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true" /> |
| 157 |
</td> |
| 158 |
<td> |
| 159 |
<input type="text" id="new_hold_note" name="new_hold_note"/> |
| 160 |
</td> |
| 161 |
</tr> |
| 236 |
</tbody> |
162 |
</tbody> |
| 237 |
</table> <!-- /#holds --> |
163 |
</table> <!-- /#modify_holds_options --> |
| 238 |
</div> <!-- /.page-section --> |
164 |
</div> <!-- /#modify_holds_options --> |
| 239 |
<a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return to batch hold modification</a> |
165 |
<fieldset class="action"> |
| 240 |
[% END %] |
166 |
<input type="hidden" name="op" value="cud-modify" /> |
| 241 |
</main> |
167 |
<input type="submit" class="btn btn-primary" value="Modify holds" /> |
| 242 |
</div> <!-- /.col-sm-10 col-sm-push-2 --> |
168 |
<a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a> |
| 243 |
|
169 |
</fieldset> |
| 244 |
|
170 |
</form> <!-- /#process_mods --> |
| 245 |
<div class="col-sm-2 col-sm-pull-10"> |
171 |
</div> <!-- /#modify_holds_results-wrapper --> |
| 246 |
<aside> |
172 |
</main> |
| 247 |
[% INCLUDE 'tools-menu.inc' %] |
173 |
</div> <!-- /.col-sm-10 col-sm-push-2 --> |
| 248 |
</aside> |
174 |
<div class="col-sm-2 col-sm-pull-10"> |
| 249 |
</div> <!-- /.col-sm-2 col-sm-pull-10 --> |
175 |
<aside> |
| 250 |
</div> <!-- /.row --> |
176 |
[% INCLUDE 'tools-menu.inc' %] |
|
|
177 |
</aside> |
| 178 |
</div> <!-- /.col-sm-2 col-sm-pull-10 --> |
| 251 |
</div> |
179 |
</div> |
| 252 |
[% MACRO jsinclude BLOCK %] |
180 |
[% MACRO jsinclude BLOCK %] |
| 253 |
[% Asset.js("js/tools-menu.js") | $raw %] |
181 |
[% Asset.js("js/tools-menu.js") | $raw %] |
| 254 |
[% INCLUDE 'calendar.inc' %] |
182 |
[% INCLUDE 'calendar.inc' %] |
| 255 |
[% INCLUDE 'datatables.inc' %] |
183 |
[% INCLUDE 'datatables.inc' %] |
|
|
184 |
[% INCLUDE 'js-patron-format.inc' %] |
| 256 |
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] |
185 |
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] |
| 257 |
<script> |
186 |
<script> |
|
|
187 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
| 188 |
let hold_ids = [% IF updated_holds %] [% updated_holds | $raw %] [% ELSE %] [] [% END %]; |
| 189 |
|
| 258 |
$(document).ready(function() { |
190 |
$(document).ready(function() { |
| 259 |
|
191 |
|
| 260 |
$("#selectall").click(function(e){ |
192 |
$("#select_all").click(function(e){ |
| 261 |
e.preventDefault(); |
193 |
e.preventDefault(); |
| 262 |
$("#found_holds input[type='checkbox']").each(function(){ |
194 |
$("#holds_to_modify input[type='checkbox']").each(function(){ |
| 263 |
$(this).prop("checked", true); |
195 |
$(this).prop("checked", true); |
| 264 |
}); |
196 |
}); |
| 265 |
}); |
197 |
}); |
| 266 |
|
198 |
|
| 267 |
$("#clearall").click(function(e){ |
199 |
$("#clear_all").click(function(e){ |
| 268 |
e.preventDefault(); |
200 |
e.preventDefault(); |
| 269 |
$("#found_holds input[type='checkbox']").each(function(){ |
201 |
$("#holds_to_modify input[type='checkbox']").each(function(){ |
| 270 |
$(this).prop("checked", false); |
202 |
$(this).prop("checked", false); |
| 271 |
}); |
203 |
}); |
| 272 |
}); |
204 |
}); |
| 273 |
|
205 |
|
| 274 |
$("#selectall").click(); |
206 |
$('#modify_holds_form').submit(function() { |
|
|
207 |
var modify_holds_form = $(this); |
| 208 |
search_holds(modify_holds_form); |
| 209 |
$("#modify_holds_search").hide(); |
| 210 |
$('#edit_search').show(); |
| 211 |
return false; |
| 212 |
}); |
| 213 |
|
| 214 |
$("#edit_search").on("click", function(e){ |
| 215 |
e.preventDefault(); |
| 216 |
$('#modify_holds_search').show(); |
| 217 |
$('#edit_search').hide(); |
| 218 |
}); |
| 219 |
|
| 220 |
function search_holds(modify_holds_form){ |
| 221 |
var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'holds_to_modify', 'json' ) | $raw %]; |
| 222 |
var searchpattern = ""; |
| 223 |
var filters = { |
| 224 |
"me.expirationdate": function(){ |
| 225 |
var expirationdate_from = modify_holds_form.find("#expirationdate_from").val(); |
| 226 |
var expirationdate_to = modify_holds_form.find("#expirationdate_to").val(); |
| 227 |
|
| 228 |
searchpattern += expirationdate_from && expirationdate_to ? _("expiration date between ")+ expirationdate_from + " and " + expirationdate_to + " ": ""; |
| 229 |
|
| 230 |
return expirationdate_from && expirationdate_to ? {"-between": [expirationdate_from, expirationdate_to]} : ""; |
| 231 |
}, |
| 232 |
"me.branchcode": function(){ |
| 233 |
var branchcodes = modify_holds_form.find("#branchcodes").val(); |
| 234 |
if( branchcodes.length > 0 ){ |
| 235 |
searchpattern += _("from libraries "); |
| 236 |
var selected_libraries = modify_holds_form.find("#branchcodes option:selected"); |
| 237 |
$.each(selected_libraries, function(key, value) { |
| 238 |
searchpattern += value.text + " "; |
| 239 |
}); |
| 240 |
return {"-in": branchcodes }; |
| 241 |
} |
| 242 |
}, |
| 243 |
"me.status": function(){ |
| 244 |
var found_status = modify_holds_form.find("#found_status").val(); |
| 245 |
if( found_status.length > 0 ){ |
| 246 |
var filters = [{"-in": found_status}]; |
| 247 |
if(jQuery.inArray("NULL", found_status) !== -1){ |
| 248 |
filters.push({"=": null}); |
| 249 |
} |
| 250 |
searchpattern += _("found status in "); |
| 251 |
$.each(found_status, function(key, value) { |
| 252 |
let status = _("No status "); |
| 253 |
if ( value == "T" ) { |
| 254 |
status = _("In transit "); |
| 255 |
} else if( value == "P" ) { |
| 256 |
status = _("In processing "); |
| 257 |
} else if( value == "W" ) { |
| 258 |
status = _("Waiting "); |
| 259 |
} |
| 260 |
searchpattern += status; |
| 261 |
}); |
| 262 |
return filters; |
| 263 |
} |
| 264 |
}, |
| 265 |
"me.suspended": function(){ |
| 266 |
var suspend_status = modify_holds_form.find("#suspend_status").val(); |
| 267 |
|
| 268 |
if(suspend_status != "none"){ |
| 269 |
var suspended_text = suspend_status == 0 ? _("Not suspended") : _("Suspended"); |
| 270 |
searchpattern += _("with suspend status ") + suspended_text; |
| 271 |
|
| 272 |
return {"=": suspend_status}; |
| 273 |
} |
| 274 |
}, |
| 275 |
"me.suspend_until": function(){ |
| 276 |
var suspend_until_from = modify_holds_form.find("#suspend_until_from").val(); |
| 277 |
var suspend_until_to = modify_holds_form.find("#suspend_until_to").val(); |
| 278 |
|
| 279 |
searchpattern += suspend_until_from && suspend_until_to ? _("suspend date between ")+ suspend_until_from +"-"+suspend_until_to : ""; |
| 280 |
|
| 281 |
return suspend_until_from && suspend_until_to ? {"-between": [suspend_until_from, suspend_until_to]} : ""; |
| 282 |
}, |
| 283 |
"me.notes": function(){ |
| 284 |
var holdnotes = modify_holds_form.find("#holdnotes").val(); |
| 285 |
|
| 286 |
searchpattern += holdnotes ? _("hold notes like ") + holdnotes : ""; |
| 287 |
|
| 288 |
return holdnotes ? {"-like": "%"+holdnotes+"%"} : ""; |
| 289 |
} |
| 290 |
} |
| 291 |
|
| 292 |
var holds_modify_table = $("#holds_to_modify").kohaTable({ |
| 293 |
"ajax": { |
| 294 |
"url": "/api/v1/holds" |
| 295 |
}, |
| 296 |
"embed": [ |
| 297 |
"biblio", |
| 298 |
"item", |
| 299 |
"pickup_library", |
| 300 |
"patron" |
| 301 |
], |
| 302 |
"destroy": true, |
| 303 |
"autoWidth": false, |
| 304 |
"processing": true, |
| 305 |
"columns": [ |
| 306 |
{ |
| 307 |
"data": "hold_id", |
| 308 |
"name": "checkbox", |
| 309 |
"orderable": false, |
| 310 |
"render": function(data, type, row, meta) { |
| 311 |
return '<input type="checkbox" name="hold_id" value="'+ encodeURIComponent(data) +'"/>' |
| 312 |
} |
| 313 |
}, |
| 314 |
{ |
| 315 |
"data": "expiration_date", |
| 316 |
"name": "expiration_date", |
| 317 |
"type": "date", |
| 318 |
"title": _("Expiration date"), |
| 319 |
"orderable": true, |
| 320 |
"render": function( data, type, row, meta ) { |
| 321 |
return $date(data); |
| 322 |
} |
| 323 |
}, |
| 324 |
{ |
| 325 |
"data": "biblio.title", |
| 326 |
"name": "title", |
| 327 |
"title": _("Title"), |
| 328 |
"orderable": true, |
| 329 |
"render": function( data, type, row, meta ) { |
| 330 |
return '<a href="/cgi-bin/koha/catalogue/detail.pl?' + |
| 331 |
'biblionumber=' + encodeURIComponent( row.biblio_id ) + '">' + escape_str( data ) + '</a>'; |
| 332 |
} |
| 333 |
}, |
| 334 |
{ |
| 335 |
"data": "item.external_id", |
| 336 |
"name": "barcode", |
| 337 |
"title": _("Barcode"), |
| 338 |
"defaultContent": _(""), |
| 339 |
"orderable": true, |
| 340 |
"render": function( data, type, row, meta ) { |
| 341 |
if( row.item ){ |
| 342 |
let item_id = encodeURIComponent( row.item_id ); |
| 343 |
let biblio_id = encodeURIComponent( row.biblio_id ); |
| 344 |
return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' + |
| 345 |
'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' + |
| 346 |
'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>' |
| 347 |
} |
| 348 |
} |
| 349 |
}, |
| 350 |
{ |
| 351 |
"data": "patron_id", |
| 352 |
"name": "patron", |
| 353 |
"title": _("Patron"), |
| 354 |
"orderable": true, |
| 355 |
"render": function( data, type, row, meta ) { |
| 356 |
let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
| 357 |
return patron_to_html; |
| 358 |
} |
| 359 |
}, |
| 360 |
{ |
| 361 |
"data": "status", |
| 362 |
"name": "status", |
| 363 |
"className": "found_status", |
| 364 |
"title": _("Status"), |
| 365 |
"orderable": true, |
| 366 |
"render": function( data, type, row, meta ) { |
| 367 |
let status = _("No status"); |
| 368 |
if ( data == "T" ) { |
| 369 |
status = _("In transit"); |
| 370 |
} else if( data == "P" ) { |
| 371 |
status = _("In processing"); |
| 372 |
} else if( data == "W" ) { |
| 373 |
status = _("Waiting"); |
| 374 |
} |
| 375 |
return status; |
| 376 |
} |
| 377 |
}, |
| 378 |
{ |
| 379 |
"data": "pickup_library_id", |
| 380 |
"name": "pickup_library", |
| 381 |
"title": _("Hold pickup library"), |
| 382 |
"orderable": true, |
| 383 |
"render": function( data, type, row, meta ) { |
| 384 |
return escape_str( row.pickup_library.name ); |
| 385 |
} |
| 386 |
}, |
| 387 |
{ |
| 388 |
"data": "suspended", |
| 389 |
"name": "suspended", |
| 390 |
"title": _("Suspended"), |
| 391 |
"orderable": true, |
| 392 |
"render": function( data, type, row, meta ) { |
| 393 |
return data == 0 ? _("No") : _("Yes"); |
| 394 |
} |
| 395 |
}, |
| 396 |
{ |
| 397 |
"data": "suspended_until", |
| 398 |
"name": "suspended_until", |
| 399 |
"title": _("Suspended until"), |
| 400 |
"orderable": true, |
| 401 |
"render": function( data, type, row, meta ) { |
| 402 |
return $date( data ); |
| 403 |
} |
| 404 |
}, |
| 405 |
{ |
| 406 |
"data": "notes", |
| 407 |
"name": "notes", |
| 408 |
"title": _("Notes"), |
| 409 |
"orderable": true, |
| 410 |
"render": function( data, type, row, meta ) { |
| 411 |
return escape_str( data ); |
| 412 |
} |
| 413 |
} |
| 414 |
] |
| 415 |
}, table_settings, 0, filters); |
| 416 |
|
| 417 |
$(".searchpattern").text(searchpattern); |
| 275 |
|
418 |
|
| 276 |
$("#found_holds").dataTable($.extend(true, {}, dataTablesDefaults, { |
419 |
$("#modify_holds_results-wrapper").show(); |
| 277 |
"aoColumnDefs": [ |
420 |
} |
| 278 |
{ "aTargets": [0], "bSortable": false, "bSearchable": false }, |
|
|
| 279 |
], |
| 280 |
"sDom": 't', |
| 281 |
"aaSorting": [], |
| 282 |
"bPaginate": false |
| 283 |
})); |
| 284 |
|
421 |
|
| 285 |
$("#process").on('submit', function(e) { |
422 |
$("#process_mods").on('submit', function(e) { |
|
|
423 |
|
| 424 |
var hold_ids = []; |
| 286 |
var errors = []; |
425 |
var errors = []; |
| 287 |
var reserve_ids = $("input[type=checkbox][name='hold_id']:checked"); |
426 |
var holds_checked = $("input[type=checkbox][name='hold_id']:checked"); |
| 288 |
|
427 |
|
| 289 |
var new_pickup_loc = $("#new_pickup_loc").val(); |
428 |
var new_expiration_date = $("#new_expiration_date").val(); |
| 290 |
var new_suspend_status = $("#new_suspend_status").val(); |
429 |
var new_pickup_loc = $("#new_pickup_loc").val(); |
| 291 |
var new_suspend_date = $("#new_suspend_date").val(); |
430 |
var new_suspend_status = $("#new_suspend_status").val(); |
|
|
431 |
var new_suspend_date = $("#new_suspend_date").val(); |
| 432 |
var new_hold_note = $("#new_hold_note").val(); |
| 292 |
|
433 |
|
| 293 |
if ( reserve_ids.length == 0 ) { |
434 |
if ( holds_checked.length == 0 ) { |
| 294 |
e.preventDefault(); |
435 |
e.preventDefault(); |
| 295 |
errors.push(_("Please select at least one hold to process.")); |
436 |
errors.push(_("Please select at least one hold to process.")); |
| 296 |
return false; |
|
|
| 297 |
} |
437 |
} |
|
|
438 |
|
| 298 |
if( new_pickup_loc || new_suspend_status ){ |
439 |
if( new_pickup_loc || new_suspend_status ){ |
| 299 |
reserve_ids.each(function(){ |
440 |
var found = false; |
| 300 |
if($(this).parents("tr").children(".found_status").data("found") != ""){ |
441 |
holds_checked.each(function(){ |
|
|
442 |
if($(this).parents("tr").children(".found_status").html() !== "No status"){ |
| 301 |
e.preventDefault(); |
443 |
e.preventDefault(); |
| 302 |
if( new_suspend_status ){ |
444 |
found = true; |
| 303 |
errors.push(_("One or more holds have found status and can't be suspended.")); |
|
|
| 304 |
} |
| 305 |
if( new_pickup_loc ){ |
| 306 |
errors.push(_("One or more holds have found status and their pick up location can't be changed.")); |
| 307 |
} |
| 308 |
return false; |
| 309 |
} |
445 |
} |
| 310 |
}) |
446 |
}); |
|
|
447 |
if( new_suspend_status && found ){ |
| 448 |
errors.push(_("One or more holds have found status and can't be suspended.")); |
| 449 |
} |
| 450 |
if( new_pickup_loc && found ){ |
| 451 |
errors.push(_("One or more holds have found status and their pick up location can't be changed.")); |
| 452 |
} |
| 311 |
} |
453 |
} |
| 312 |
if( ( !new_suspend_status || new_suspend_status == "not_suspended") && new_suspend_date ){ |
454 |
if( ( !new_suspend_status || new_suspend_status == "0") && new_suspend_date ){ |
| 313 |
e.preventDefault(); |
455 |
e.preventDefault(); |
| 314 |
errors.push(_("You have to suspend holds if new suspend until date is set.")); |
456 |
errors.push(_("You have to suspend holds if new suspend until date is set.")); |
| 315 |
return false; |
|
|
| 316 |
} |
457 |
} |
| 317 |
|
458 |
|
| 318 |
if (errors.length > 0) { |
459 |
if (errors.length > 0) { |
|
Lines 324-329
Link Here
|
| 324 |
|
465 |
|
| 325 |
return true; |
466 |
return true; |
| 326 |
}); |
467 |
}); |
|
|
468 |
|
| 469 |
//Modified holds table |
| 470 |
var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %]; |
| 471 |
var filters = { |
| 472 |
"me.hold_id": function(){ |
| 473 |
return {"-in": hold_ids}; |
| 474 |
} |
| 475 |
} |
| 476 |
|
| 477 |
var holds_modified_table = $("#modified_holds").kohaTable({ |
| 478 |
"ajax": { |
| 479 |
"url": "/api/v1/holds" |
| 480 |
}, |
| 481 |
"embed": [ |
| 482 |
"biblio", |
| 483 |
"item", |
| 484 |
"pickup_library", |
| 485 |
"patron" |
| 486 |
], |
| 487 |
"destroy": true, |
| 488 |
"autoWidth": false, |
| 489 |
"processing": true, |
| 490 |
"columns": [ |
| 491 |
{ |
| 492 |
"data": "expiration_date", |
| 493 |
"name": "expiration_date", |
| 494 |
"type": "date", |
| 495 |
"title": _("Expiration date"), |
| 496 |
"orderable": true, |
| 497 |
"render": function( data, type, row, meta ) { |
| 498 |
return $date(data); |
| 499 |
} |
| 500 |
}, |
| 501 |
{ |
| 502 |
"data": "biblio.title", |
| 503 |
"name": "title", |
| 504 |
"title": _("Title"), |
| 505 |
"orderable": true, |
| 506 |
"render": function( data, type, row, meta ) { |
| 507 |
return '<a href="/cgi-bin/koha/catalogue/detail.pl?' + |
| 508 |
'biblionumber=' + encodeURIComponent( row.biblio_id ) + '">' + escape_str( data ) + '</a>'; |
| 509 |
} |
| 510 |
}, |
| 511 |
{ |
| 512 |
"data": "item.external_id", |
| 513 |
"name": "barcode", |
| 514 |
"title": _("Barcode"), |
| 515 |
"defaultContent": _(""), |
| 516 |
"orderable": true, |
| 517 |
"render": function( data, type, row, meta ) { |
| 518 |
if( row.item ){ |
| 519 |
let item_id = encodeURIComponent( row.item_id ); |
| 520 |
let biblio_id = encodeURIComponent( row.biblio_id ); |
| 521 |
return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' + |
| 522 |
'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' + |
| 523 |
'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>' |
| 524 |
} |
| 525 |
} |
| 526 |
}, |
| 527 |
{ |
| 528 |
"data": "patron_id", |
| 529 |
"name": "patron", |
| 530 |
"title": _("Patron"), |
| 531 |
"orderable": true, |
| 532 |
"render": function( data, type, row, meta ) { |
| 533 |
let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
| 534 |
return patron_to_html; |
| 535 |
} |
| 536 |
}, |
| 537 |
{ |
| 538 |
"data": "status", |
| 539 |
"name": "status", |
| 540 |
"className": "found_status", |
| 541 |
"title": _("Status"), |
| 542 |
"orderable": true, |
| 543 |
"render": function( data, type, row, meta ) { |
| 544 |
let status = _("No status"); |
| 545 |
if ( data == "T" ) { |
| 546 |
status = _("In transit"); |
| 547 |
} else if( data == "P" ) { |
| 548 |
status = _("In processing"); |
| 549 |
} else if( data == "W" ) { |
| 550 |
status = _("Waiting"); |
| 551 |
} |
| 552 |
return status; |
| 553 |
} |
| 554 |
}, |
| 555 |
{ |
| 556 |
"data": "pickup_library_id", |
| 557 |
"name": "pickup_library", |
| 558 |
"title": _("Hold pickup library"), |
| 559 |
"orderable": true, |
| 560 |
"render": function( data, type, row, meta ) { |
| 561 |
return escape_str( row.pickup_library.name ); |
| 562 |
} |
| 563 |
}, |
| 564 |
{ |
| 565 |
"data": "suspended", |
| 566 |
"name": "suspended", |
| 567 |
"title": _("Suspended"), |
| 568 |
"orderable": true, |
| 569 |
"render": function( data, type, row, meta ) { |
| 570 |
return data == 0 ? _("No") : _("Yes"); |
| 571 |
} |
| 572 |
}, |
| 573 |
{ |
| 574 |
"data": "suspended_until", |
| 575 |
"name": "suspended_until", |
| 576 |
"title": _("Suspended until"), |
| 577 |
"orderable": true, |
| 578 |
"render": function( data, type, row, meta ) { |
| 579 |
return $date( data ); |
| 580 |
} |
| 581 |
}, |
| 582 |
{ |
| 583 |
"data": "notes", |
| 584 |
"name": "notes", |
| 585 |
"title": _("Notes"), |
| 586 |
"orderable": true, |
| 587 |
"render": function( data, type, row, meta ) { |
| 588 |
return escape_str( data ); |
| 589 |
} |
| 590 |
} |
| 591 |
] |
| 592 |
}, table_settings, 0, filters); |
| 593 |
|
| 594 |
var modified_message = '<div class="alert alert-info">'+hold_ids.length+' hold(s) have been modified!</div>'; |
| 595 |
$("#modified_holds_results-wrapper").prepend(modified_message); |
| 596 |
|
| 327 |
}); |
597 |
}); |
| 328 |
</script> |
598 |
</script> |
| 329 |
[% END %] |
599 |
[% END %] |