|
Line 0
Link Here
|
| 0 |
- |
1 |
[% USE Asset %] |
|
|
2 |
[% USE Koha %] |
| 3 |
[% USE KohaDates %] |
| 4 |
[% SET footerjs = 1 %] |
| 5 |
[% INCLUDE 'doc-head-open.inc' %] |
| 6 |
<title>Koha › Acquisitions › |
| 7 |
[% UNLESS blocking_error %] |
| 8 |
Basket [% basket.basketno %] › Duplicate existing orders |
| 9 |
[% END %] |
| 10 |
</title> |
| 11 |
[% INCLUDE 'doc-head-close.inc' %] |
| 12 |
[% Asset.css("css/datatables.css") %] |
| 13 |
<style type="text/css"> |
| 14 |
.picked_to_duplicate > td { background-color: #bcdb89 !important; } |
| 15 |
</style> |
| 16 |
</head> |
| 17 |
|
| 18 |
<body id="acq_duplicate_orders" class="acq"> |
| 19 |
|
| 20 |
[% INCLUDE 'header.inc' %] |
| 21 |
[% INCLUDE 'acquisitions-search.inc' %] |
| 22 |
|
| 23 |
<div id="breadcrumbs"> |
| 24 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> |
| 25 |
› <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> |
| 26 |
[% UNLESS blocking_error %] |
| 27 |
› <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id %]">[% vendor.name %]</a> |
| 28 |
› <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">Basket [% basket.basketno %]</a> |
| 29 |
› Duplicate existing orders |
| 30 |
[% END %] |
| 31 |
</div> |
| 32 |
|
| 33 |
<div class="main container-fluid"> |
| 34 |
<div class="row"> |
| 35 |
<div class="col-sm-10 col-sm-push-2"> |
| 36 |
<main> |
| 37 |
|
| 38 |
[% INCLUDE 'blocking_errors.inc' %] |
| 39 |
|
| 40 |
<h2>Duplicate existing orders</h2> |
| 41 |
|
| 42 |
[% IF op == 'search' || op == 'select' %] |
| 43 |
<form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post"> |
| 44 |
<fieldset class="rows"> |
| 45 |
<legend> |
| 46 |
[% IF op == 'search' %] |
| 47 |
<span>Search orders</span> |
| 48 |
[% ELSE %] |
| 49 |
<span>Refine search</span> |
| 50 |
[% END %] |
| 51 |
<span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span> |
| 52 |
<span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span> |
| 53 |
</legend> |
| 54 |
<div id="orders_filters"> |
| 55 |
[% INCLUDE 'filter-orders.inc' %] |
| 56 |
<input type="hidden" name="op" value="select" /> |
| 57 |
<input type="hidden" name="basketno" value="[% basket.basketno %]" /> |
| 58 |
|
| 59 |
<input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') %]" /> |
| 60 |
<fieldset class="action"><input type="submit" value="Search" /></fieldset> |
| 61 |
</div> |
| 62 |
</fieldset> |
| 63 |
</form> |
| 64 |
[% END %] |
| 65 |
|
| 66 |
[% BLOCK display_order_line %] |
| 67 |
[% IF selected %] |
| 68 |
<tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber %]"> |
| 69 |
[% ELSE %] |
| 70 |
<tr data-ordernumber="[% order.ordernumber %]"> |
| 71 |
[% END %] |
| 72 |
<td> |
| 73 |
[% IF selected %] |
| 74 |
<input type="checkbox" name="ordernumber" value="[% order.ordernumber %]" checked="checked" /> |
| 75 |
[% ELSE %] |
| 76 |
<input type="checkbox" name="ordernumber" value="[% order.ordernumber %]" /> |
| 77 |
[% END %] |
| 78 |
[% order.ordernumber %] |
| 79 |
[% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber %])[% END %] |
| 80 |
</td> |
| 81 |
<td> |
| 82 |
[% SWITCH order.orderstatus %] |
| 83 |
[% CASE 'new' %]New |
| 84 |
[% CASE 'ordered' %]Ordered |
| 85 |
[% CASE 'partial' %]Partially received |
| 86 |
[% CASE 'complete' %]Received |
| 87 |
[% CASE 'cancelled' %]Cancelled |
| 88 |
[% END %] |
| 89 |
</td> |
| 90 |
<td>[% order.basketname %] (<a href="basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td> |
| 91 |
<td>[% order.authorisedbyname %]</td> |
| 92 |
<td> |
| 93 |
[% IF ( order.basketgroupid ) %] |
| 94 |
[% order.groupname %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id %]&basketgroupid=[% order.basketgroupid %]">[% order.basketgroupid %]</a>) |
| 95 |
[% ELSE %] |
| 96 |
|
| 97 |
[% END %] |
| 98 |
</td> |
| 99 |
<td>[% IF ( order.invoicenumber ) %] |
| 100 |
<a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid %]">[% order.invoicenumber %]</a> |
| 101 |
[% ELSE %] |
| 102 |
|
| 103 |
[% END %] |
| 104 |
</td> |
| 105 |
<td> |
| 106 |
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a> |
| 107 |
<br />[% order.author %] <br /> [% order.isbn %] |
| 108 |
</td> |
| 109 |
<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id %]">[% order.name %]</a></td> |
| 110 |
<td><span title="[% order.creationdate %]">[% order.creationdate | $KohaDates %]</span></td> |
| 111 |
<td> |
| 112 |
[% IF order.datereceived %] |
| 113 |
<span title="[% order.datereceived %]">[% order.datereceived | $KohaDates %]</span> |
| 114 |
[% ELSE %] |
| 115 |
<span title="0000-00-00"></span> |
| 116 |
[% END %] |
| 117 |
</td> |
| 118 |
<td>[% order.quantityreceived %]</td> |
| 119 |
<td>[% order.quantity %]</td> |
| 120 |
<td>[% order.ecost %]</td> |
| 121 |
<td>[% order.budget_name %]</td> |
| 122 |
</tr> |
| 123 |
[% END %] |
| 124 |
|
| 125 |
|
| 126 |
[% IF op == 'select' && ( result_order_loop || selected_order_loop ) %] |
| 127 |
<div id="xxx"> |
| 128 |
<form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl"> |
| 129 |
<table id="table_orders"> |
| 130 |
<caption> |
| 131 |
<span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a> |
| 132 |
| <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a></span> |
| 133 |
</caption> |
| 134 |
|
| 135 |
<thead> |
| 136 |
<tr> |
| 137 |
<th>Order line (parent)</th> |
| 138 |
<th>Status</th> |
| 139 |
<th>Basket</th> |
| 140 |
<th>Basket creator</th> |
| 141 |
<th>Basket group</th> |
| 142 |
<th>Invoice number</th> |
| 143 |
<th class="anti-the">Summary</th> |
| 144 |
<th>Vendor</th> |
| 145 |
<th class="title-string">Placed on</th> |
| 146 |
<th class="title-string">Received on</th> |
| 147 |
<th>Quantity received</th> |
| 148 |
<th>Pending order</th> |
| 149 |
<th>Unit cost</th> |
| 150 |
<th>Fund</th> |
| 151 |
</tr> |
| 152 |
</thead> |
| 153 |
<tfoot> |
| 154 |
[% FOREACH order IN selected_order_loop %] |
| 155 |
[% INCLUDE display_order_line selected => 1 %] |
| 156 |
[% END %] |
| 157 |
</tfoot> |
| 158 |
<tbody> |
| 159 |
[% FOREACH order IN result_order_loop %] |
| 160 |
[% INCLUDE display_order_line %] |
| 161 |
[% END %] |
| 162 |
</tbody> |
| 163 |
</table> |
| 164 |
<fieldset class="action"> |
| 165 |
<input type="hidden" name="op" value="batch_edit" /> |
| 166 |
<input type="hidden" name="basketno" value="[% basket.basketno %]" /> |
| 167 |
<button type="submit" class="btn btn-default go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button> |
| 168 |
</fieldset> |
| 169 |
</form> |
| 170 |
</div> |
| 171 |
|
| 172 |
[% ELSIF op == "batch_edit" %] |
| 173 |
|
| 174 |
<form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form"> |
| 175 |
<div id="accounting_details"> |
| 176 |
<p>Duplicate all the orders with the following accounting details:</p> |
| 177 |
<fieldset class="rows" style="float:none;"> |
| 178 |
<legend>Accounting details</legend> |
| 179 |
<ol> |
| 180 |
<li> |
| 181 |
<!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order --> |
| 182 |
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" /> |
| 183 |
</li> |
| 184 |
<li> |
| 185 |
<li> |
| 186 |
<label for="all_currency">Currency:</label> |
| 187 |
<input type="checkbox" name="copy_existing_value" value="currency" title="Copy existing value" /> |
| 188 |
<select name="all_currency" id="all_currency"> |
| 189 |
[% FOREACH currency IN currencies %] |
| 190 |
[% IF currency.currency == vendor.listprice %] |
| 191 |
<option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option> |
| 192 |
[% ELSIF not currency.archived %] |
| 193 |
<option value="[% currency.currency %]">[% currency.currency %]</option> |
| 194 |
[% END %] |
| 195 |
[% END %] |
| 196 |
</select> |
| 197 |
<span class="hint" id="hint_currency">The original currency value will be copied</span> |
| 198 |
</li> |
| 199 |
<li> |
| 200 |
<label for="all_budget_id">Fund: </label> |
| 201 |
<input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" /> |
| 202 |
<select id="all_budget_id" size="1" name="all_budget_id"> |
| 203 |
<option value="">Select a fund</option> |
| 204 |
[% FOREACH budget_loo IN budget_loop %] |
| 205 |
[% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option> |
| 206 |
[% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %] (inactive)</option> |
| 207 |
[% END %] |
| 208 |
[% END %] |
| 209 |
</select> |
| 210 |
<label for="all_showallbudgets" style="float:none;width:auto;"> Show inactive:</label> |
| 211 |
<input type="checkbox" id="all_showallbudgets" /> |
| 212 |
<span class="hint" id="hint_budget_id">The original fund will be used</span> |
| 213 |
</li> |
| 214 |
</li> |
| 215 |
<li> |
| 216 |
<label for="all_order_internalnote">Internal note: </label> |
| 217 |
<input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" /> |
| 218 |
<textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea> |
| 219 |
<span class="hint" id="hint_order_internalnote">The original internal note will be used</span> |
| 220 |
</li> |
| 221 |
<li> |
| 222 |
<label for="all_order_vendornote">Vendor note: </label> |
| 223 |
<input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" /> |
| 224 |
<textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea> |
| 225 |
<span class="hint" id="hint_order_vendornote">The original vendor note will be used</span> |
| 226 |
</li> |
| 227 |
<li> |
| 228 |
<div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div> |
| 229 |
<label for="all_sort1">Statistic 1: </label> |
| 230 |
<input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" /> |
| 231 |
<input type="text" id="all_sort1" size="20" name="all_sort1" value="" /> |
| 232 |
<span class="hint" id="hint_sort1">The original statistic 1 will be used</span> |
| 233 |
|
| 234 |
</li> |
| 235 |
<li> |
| 236 |
<label for="all_sort2">Statistic 2: </label> |
| 237 |
<input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" /> |
| 238 |
<input type="text" id="all_sort2" size="20" name="all_sort2" value="" /> |
| 239 |
<span class="hint" id="hint_sort2">The original statistic 2 will be used</span> |
| 240 |
</li> |
| 241 |
</ol> |
| 242 |
</fieldset> |
| 243 |
</div> |
| 244 |
|
| 245 |
<fieldset class="action"> |
| 246 |
[% FOREACH ordernumber IN ordernumbers %] |
| 247 |
<input type="hidden" name="ordernumber" value="[% ordernumber %]" /> |
| 248 |
[% END %] |
| 249 |
<input type="hidden" name="op" value="do_duplicate" /> |
| 250 |
<input type="hidden" name="basketno" value="[% basket.basketno %]" /> |
| 251 |
<button type="submit" class="btn btn-default">Duplicate orders</button> |
| 252 |
<a class="cancel" href="/cgi-bin/koha/acqui/duplicate_orders.pl?basketno=[% basket.basketno %]">Cancel</a> |
| 253 |
</fieldset> |
| 254 |
</form> |
| 255 |
|
| 256 |
[% ELSIF op == 'duplication_done' %] |
| 257 |
[% IF new_orders %] |
| 258 |
<table id="table_neworders"> |
| 259 |
<thead> |
| 260 |
<tr> |
| 261 |
<th>Order line</th> |
| 262 |
<th>Status</th> |
| 263 |
<th>Basket</th> |
| 264 |
<th>Basket creator</th> |
| 265 |
<th>Basket group</th> |
| 266 |
<th>Invoice number</th> |
| 267 |
<th class="anti-the">Summary</th> |
| 268 |
<th>Vendor</th> |
| 269 |
<th class="title-string">Placed on</th> |
| 270 |
<th class="title-string">Received on</th> |
| 271 |
<th>Quantity received</th> |
| 272 |
<th>Pending order</th> |
| 273 |
<th>Unit cost</th> |
| 274 |
<th>Fund</th> |
| 275 |
</tr> |
| 276 |
</thead> |
| 277 |
<tbody> |
| 278 |
[% FOREACH order IN new_orders %] |
| 279 |
[% INCLUDE display_order_line %] |
| 280 |
[% END %] |
| 281 |
</tbody> |
| 282 |
</table> |
| 283 |
<a class="btn btn-default" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"><i class="fa fa-fw fa-arrow-left"></i> Return to the basket</a |
| 284 |
[% ELSE %] |
| 285 |
<span>No order has been duplicated. Maybe something wrong happened?</span> |
| 286 |
[% END %] |
| 287 |
[% END %] |
| 288 |
|
| 289 |
</main> |
| 290 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
| 291 |
|
| 292 |
<div class="col-sm-2 col-sm-pull-10"> |
| 293 |
<aside> |
| 294 |
[% INCLUDE 'acquisitions-menu.inc' %] |
| 295 |
</aside> |
| 296 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
| 297 |
</div> |
| 298 |
|
| 299 |
[% MACRO jsinclude BLOCK %] |
| 300 |
[% Asset.js("js/acquisitions-menu.js") %] |
| 301 |
[% INCLUDE 'calendar.inc' %] |
| 302 |
[% INCLUDE 'datatables.inc' %] |
| 303 |
[% INCLUDE 'columns_settings.inc' %] |
| 304 |
[% Asset.js("js/autocomplete/patrons.js") %] |
| 305 |
[% Asset.js("js/acq.js") %] |
| 306 |
[% Asset.js("js/funds_sorts.js") %] |
| 307 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %] |
| 308 |
<script> |
| 309 |
function update_ordernumber_list(){ |
| 310 |
var ordernumbers = []; |
| 311 |
$("input[name='ordernumber']").filter(":checked").each(function(){ |
| 312 |
ordernumbers.push($(this).val()); |
| 313 |
}); |
| 314 |
$("input[name='ordernumbers']").val(ordernumbers.join(',')); |
| 315 |
} |
| 316 |
|
| 317 |
var MSG_REMOVE_PATRON = _("Remove"); |
| 318 |
var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); |
| 319 |
var MSG_NO_FUND_SELECTED = _("No fund selected."); |
| 320 |
$(document).ready(function() { |
| 321 |
$('.hint').hide(); |
| 322 |
var columns_settings;// = [% ColumnsSettings.GetColumns( 'acqui', 'histsearch', 'histsearcht', 'json' ) %]; |
| 323 |
KohaTable("table_orders", { |
| 324 |
"aoColumnDefs": [ |
| 325 |
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }, |
| 326 |
{ "sType": "title-string", "aTargets" : [ "title-string" ] } |
| 327 |
], |
| 328 |
"bPaginate": false |
| 329 |
}, columns_settings ); |
| 330 |
|
| 331 |
[% IF op == 'search' OR op == 'select' %] |
| 332 |
patron_autocomplete({ |
| 333 |
patron_container: $("#basket_creators"), |
| 334 |
input_autocomplete: $("#find_patron"), |
| 335 |
patron_input_name: 'created_by', |
| 336 |
field_to_retrieve: 'borrowernumber' |
| 337 |
}); |
| 338 |
[% END %] |
| 339 |
|
| 340 |
$("#show_orders_filters, #hide_orders_filters").on('click', function(e) { |
| 341 |
e.preventDefault(); |
| 342 |
$('#orders_filters').toggle(); |
| 343 |
$('.toggle_orders_filters').toggle(); |
| 344 |
}); |
| 345 |
[% IF op == 'search' OR op == 'select' AND NOT result_order_loop %] |
| 346 |
$("#show_orders_filters").hide(); |
| 347 |
$("#orders_filters").show(); |
| 348 |
[% ELSE %] |
| 349 |
$("#hide_orders_filters").hide(); |
| 350 |
$("#orders_filters").hide(); |
| 351 |
[% END %] |
| 352 |
|
| 353 |
$("input[name='ordernumber']").on("change", function(){ |
| 354 |
if ( $(this).is(':checked') ) { |
| 355 |
$(this).parents("tr").addClass("picked_to_duplicate"); |
| 356 |
} else { |
| 357 |
$(this).parents("tr").removeClass("picked_to_duplicate"); |
| 358 |
} |
| 359 |
}).on("click", function(e){ |
| 360 |
update_ordernumber_list(); |
| 361 |
}); |
| 362 |
|
| 363 |
$("#select_all").on("click",function(e){ |
| 364 |
e.preventDefault(); |
| 365 |
selectAll(); |
| 366 |
update_ordernumber_list(); |
| 367 |
}); |
| 368 |
|
| 369 |
$("#clear_all").on("click",function(e){ |
| 370 |
e.preventDefault(); |
| 371 |
clearAll(); |
| 372 |
update_ordernumber_list(); |
| 373 |
}); |
| 374 |
function selectAll () { |
| 375 |
$("#table_orders").checkCheckboxes(); |
| 376 |
$("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){ |
| 377 |
$(this).change(); |
| 378 |
} ); |
| 379 |
return false; |
| 380 |
} |
| 381 |
function clearAll () { |
| 382 |
$("#table_orders").unCheckCheckboxes(); |
| 383 |
$("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){ |
| 384 |
$(this).change(); |
| 385 |
} ); |
| 386 |
return false; |
| 387 |
} |
| 388 |
|
| 389 |
$(".go_to_batch_edit").on("click",function(e){ |
| 390 |
if ($("input[name='ordernumber']").filter(":checked").length == 0){ |
| 391 |
alert(MSG_NO_ITEM_SELECTED); |
| 392 |
e.preventDefault(); |
| 393 |
} |
| 394 |
}); |
| 395 |
|
| 396 |
$("#batch_edit_form").on("submit", function(e){ |
| 397 |
var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked'); |
| 398 |
if ( ! budget_value_will_be_reused ) { |
| 399 |
if ($("#all_budget_id").find("option:selected").attr("value") == "" ) { |
| 400 |
alert(MSG_NO_FUND_SELECTED); |
| 401 |
e.preventDefault(); |
| 402 |
} |
| 403 |
} |
| 404 |
}); |
| 405 |
$("input[name='copy_existing_value']").click(function(){ |
| 406 |
render_disabled(this); |
| 407 |
}); |
| 408 |
|
| 409 |
$("input[name='copy_existing_value']").each(function(){ |
| 410 |
render_disabled(this); |
| 411 |
}); |
| 412 |
}); |
| 413 |
function render_disabled (elt) { |
| 414 |
var field = $(elt).val(); |
| 415 |
var hint_node = $("#hint_" + field); |
| 416 |
var input_element = $(elt).parent().find("[name='all_"+field+"']"); |
| 417 |
if ($(elt).is(":checked")) { |
| 418 |
$(input_element).prop('disabled', true); |
| 419 |
$(hint_node).show(); |
| 420 |
} else { |
| 421 |
$(input_element).prop('disabled', false); |
| 422 |
$(hint_node).hide(); |
| 423 |
} |
| 424 |
} |
| 425 |
</script> |
| 426 |
[% END %] |
| 427 |
|
| 428 |
[% INCLUDE 'intranet-bottom.inc' %] |