6 [% INCLUDE 'doc-head-open.inc' %]
8 [% UNLESS blocking_error %]
9 Basket [% basket.basketno | html %] › Duplicate existing orders › [% END %]
10 Acquisitions › Koha
12 [% INCLUDE 'doc-head-close.inc' %]
14 .picked_to_duplicate > td { background-color: #bcdb89 !important; }
15 span.hint { margin-left: 1em; }
19 <body id="acq_duplicate_orders" class="acq">
21 [% WRAPPER 'header.inc' %]
22 [% INCLUDE 'acquisitions-search.inc' %]
25 [% WRAPPER 'sub-header.inc' %]
26 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
29 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
32 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
33 [% UNLESS blocking_error %]
36 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
39 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketno | html %]</a>
42 <a href="#" aria-current="page">
43 Duplicate existing orders
51 <div class="main container-fluid">
53 <div class="col-sm-10 col-sm-push-2">
56 <h1>Duplicate existing orders</h1>
57 [% INCLUDE 'blocking_errors.inc' %]
59 [% IF op == 'search' || op == 'select' %]
60 <form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post">
61 <fieldset class="rows">
63 [% IF op == 'search' %]
64 <span>Search orders</span>
66 <span>Refine search</span>
68 <span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span>
69 <span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span>
71 <div id="orders_filters">
72 [% INCLUDE 'filter-orders.inc' %]
73 <input type="hidden" name="op" value="select" />
74 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
76 <input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') | html %]" />
77 <fieldset class="action"><input type="submit" value="Search" /></fieldset>
83 [% BLOCK display_order_line %]
85 <tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber | html %]">
87 <tr data-ordernumber="[% order.ordernumber | html %]">
92 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" checked="checked" />
94 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" />
97 [% order.ordernumber | html %]
98 [% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
101 [% SWITCH order.orderstatus %]
102 [% CASE 'new' %]<span>New</span>
103 [% CASE 'ordered' %]<span>Ordered</span>
104 [% CASE 'partial' %]<span>Partially received</span>
105 [% CASE 'complete' %]<span>Received</span>
106 [% CASE 'cancelled' %]<span>Cancelled</span>
109 <td>[% order.basketname | html %] (<a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
110 <td>[% order.authorisedbyname | html %]</td>
112 [% IF ( order.basketgroupid ) %]
113 [% order.groupname | html %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
118 <td>[% IF ( order.invoicenumber ) %]
119 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
125 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title |html %]</a>
126 <br />[% order.author | html %] <br /> [% order.isbn | html %]
128 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
129 <td data-order="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</td>
130 <td data-order="[% order.datereceived | html %]">
131 [% order.datereceived | $KohaDates %]
133 <td>[% order.quantityreceived | html %]</td>
134 <td>[% order.quantity | html %]</td>
135 <td>[% order.ecost | html %]</td>
136 <td>[% order.budget_name | html %]</td>
141 [% IF op == 'select' && ( result_order_loop || selected_order_loop ) %]
143 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl">
144 <table id="table_orders">
146 <span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
147 | <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
152 <th>Order line (parent)</th>
155 <th>Basket creator</th>
156 <th>Basket group</th>
157 <th>Invoice number</th>
158 <th class="anti-the">Summary</th>
162 <th>Quantity received</th>
163 <th>Quantity ordered</th>
169 [% FOREACH order IN selected_order_loop %]
170 [% INCLUDE display_order_line selected => 1 can_check => 1%]
174 [% FOREACH order IN result_order_loop %]
175 [% INCLUDE display_order_line can_check => 1 %]
179 <fieldset class="action">
180 <input type="hidden" name="op" value="batch_edit" />
181 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
182 <button type="submit" class="btn btn-default go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button>
187 [% ELSIF op == "batch_edit" %]
189 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form">
190 <div id="accounting_details">
191 <p>Duplicate all the orders with the following accounting details:</p>
192 <fieldset class="rows" style="float:none;">
193 <legend>Accounting details</legend>
194 <div class="hint" style="margin: 1em 1em 0">Check boxes to duplicate the original values</div>
197 <label for="all_currency">Currency:</label>
198 <input type="checkbox" name="copy_existing_value" value="currency" title="Copy existing value" />
199 <select name="all_currency" id="all_currency">
200 [% FOREACH currency IN currencies %]
201 [% IF currency.currency == vendor.listprice %]
202 <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
203 [% ELSIF not currency.archived %]
204 <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
208 <span class="hint" id="hint_currency">The original currency value will be copied</span>
211 <label for="all_budget_id">Fund: </label>
212 <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
213 <select id="all_budget_id" name="all_budget_id">
214 <option value="">Select a fund</option>
215 [% FOREACH budget_loo IN budget_loop %]
216 [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %]</option>
217 [% ELSE %]<option value="[% budget_loo.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %] (inactive)</option>
221 <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;"> Show inactive:</label>
222 <input type="checkbox" id="all_showallbudgets" />
223 <span class="hint" id="hint_budget_id">The original fund will be used</span>
226 <label for="all_order_internalnote">Internal note: </label>
227 <input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" />
228 <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
229 <span class="hint" id="hint_order_internalnote">The original internal note will be used</span>
232 <label for="all_order_vendornote">Vendor note: </label>
233 <input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" />
234 <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
235 <span class="hint" id="hint_order_vendornote">The original vendor note will be used</span>
238 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
239 <label for="all_sort1">Statistic 1: </label>
240 <input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" />
241 <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
242 <span class="hint" id="hint_sort1">The original statistic 1 will be used</span>
246 <label for="all_sort2">Statistic 2: </label>
247 <input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" />
248 <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
249 <span class="hint" id="hint_sort2">The original statistic 2 will be used</span>
255 <fieldset class="action">
256 [% FOREACH ordernumber IN ordernumbers %]
257 <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
259 <input type="hidden" name="op" value="do_duplicate" />
260 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
261 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
262 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
263 <button type="submit" class="btn btn-default">Duplicate orders</button>
264 <a class="cancel" href="/cgi-bin/koha/acqui/duplicate_orders.pl?basketno=[% basket.basketno | html %]">Cancel</a>
268 [% ELSIF op == 'duplication_done' %]
270 <table id="table_neworders">
276 <th>Basket creator</th>
277 <th>Basket group</th>
278 <th>Invoice number</th>
279 <th class="anti-the">Summary</th>
283 <th>Quantity received</th>
284 <th>Quantity ordered</th>
290 [% FOREACH order IN new_orders %]
291 [% INCLUDE display_order_line %]
295 <a class="btn btn-default" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | html %]"><i class="fa fa-fw fa-arrow-left"></i> Return to the basket</a
297 <span>No order has been duplicated. Maybe something wrong happened?</span>
302 </div> <!-- /.col-sm-10.col-sm-push-2 -->
304 <div class="col-sm-2 col-sm-pull-10">
306 [% INCLUDE 'acquisitions-menu.inc' %]
308 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
311 [% MACRO jsinclude BLOCK %]
312 [% Asset.js("js/acquisitions-menu.js") | $raw %]
313 [% INCLUDE 'calendar.inc' %]
314 [% INCLUDE 'datatables.inc' %]
315 [% INCLUDE 'columns_settings.inc' %]
316 [% Asset.js("js/autocomplete/patrons.js") | $raw %]
317 [% Asset.js("js/acq.js") | $raw %]
318 [% Asset.js("js/funds_sorts.js") | $raw %]
320 function update_ordernumber_list(){
321 var ordernumbers = [];
322 $("input[name='ordernumber']").filter(":checked").each(function(){
323 ordernumbers.push($(this).val());
325 $("input[name='ordernumbers']").val(ordernumbers.join(','));
328 var MSG_REMOVE_PATRON = _("Remove");
329 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
330 var MSG_NO_FUND_SELECTED = _("No fund selected.");
331 $(document).ready(function() {
332 $('span.hint').hide();
333 KohaTable("table_orders", {
337 [% IF op == 'search' OR op == 'select' %]
338 patron_autocomplete({
339 patron_container: $("#basket_creators"),
340 input_autocomplete: $("#find_patron"),
341 patron_input_name: 'created_by',
342 field_to_retrieve: 'borrowernumber'
346 $("#show_orders_filters, #hide_orders_filters").on('click', function(e) {
348 $('#orders_filters').toggle();
349 $('.toggle_orders_filters').toggle();
351 [% IF op == 'search' OR op == 'select' AND NOT result_order_loop %]
352 $("#show_orders_filters").hide();
353 $("#orders_filters").show();
355 $("#hide_orders_filters").hide();
356 $("#orders_filters").hide();
359 $("input[name='ordernumber']").on("change", function(){
360 if ( $(this).is(':checked') ) {
361 $(this).parents("tr").addClass("picked_to_duplicate");
363 $(this).parents("tr").removeClass("picked_to_duplicate");
365 }).on("click", function(e){
366 update_ordernumber_list();
369 $("#select_all").on("click",function(e){
372 update_ordernumber_list();
375 $("#clear_all").on("click",function(e){
378 update_ordernumber_list();
380 function selectAll () {
381 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
382 $(this).prop("checked", true).change();
386 function clearAll () {
387 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
388 $(this).prop("checked", false).change();
393 $(".go_to_batch_edit").on("click",function(e){
394 if ($("input[name='ordernumber']").filter(":checked").length == 0){
395 alert(MSG_NO_ITEM_SELECTED);
400 $("#batch_edit_form").on("submit", function(e){
401 var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
402 if ( ! budget_value_will_be_reused ) {
403 if ($("#all_budget_id").find("option:selected").attr("value") == "" ) {
404 alert(MSG_NO_FUND_SELECTED);
409 $("input[name='copy_existing_value']").click(function(){
410 render_disabled(this);
413 $("input[name='copy_existing_value']").each(function(){
414 render_disabled(this);
417 function render_disabled (elt) {
418 var field = $(elt).val();
419 var hint_node = $("#hint_" + field);
420 var input_element = $(elt).parent().find("[name='all_"+field+"']");
421 if ($(elt).is(":checked")) {
422 $(input_element).prop('disabled', true);
425 $(input_element).prop('disabled', false);
432 [% INCLUDE 'intranet-bottom.inc' %]