6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Acquisitions ›
8 [% UNLESS blocking_error %]
9 Basket [% basket.basketno | html %] › Duplicate existing orders
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 [% INCLUDE 'header.inc' %]
22 [% INCLUDE 'acquisitions-search.inc' %]
24 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
27 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
31 [% UNLESS blocking_error %]
34 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
37 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketno | html %]</a>
40 <a href="#" aria-current="page">
41 Duplicate existing orders
48 <div class="main container-fluid">
50 <div class="col-sm-10 col-sm-push-2">
53 [% INCLUDE 'blocking_errors.inc' %]
55 <h2>Duplicate existing orders</h2>
57 [% IF op == 'search' || op == 'select' %]
58 <form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post">
59 <fieldset class="rows">
61 [% IF op == 'search' %]
62 <span>Search orders</span>
64 <span>Refine search</span>
66 <span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span>
67 <span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span>
69 <div id="orders_filters">
70 [% INCLUDE 'filter-orders.inc' %]
71 <input type="hidden" name="op" value="select" />
72 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
74 <input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') | html %]" />
75 <fieldset class="action"><input type="submit" value="Search" /></fieldset>
81 [% BLOCK display_order_line %]
83 <tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber | html %]">
85 <tr data-ordernumber="[% order.ordernumber | html %]">
90 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" checked="checked" />
92 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" />
95 [% order.ordernumber | html %]
96 [% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
99 [% SWITCH order.orderstatus %]
101 [% CASE 'ordered' %]Ordered
102 [% CASE 'partial' %]Partially received
103 [% CASE 'complete' %]Received
104 [% CASE 'cancelled' %]Cancelled
107 <td>[% order.basketname | html %] (<a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
108 <td>[% order.authorisedbyname | html %]</td>
110 [% IF ( order.basketgroupid ) %]
111 [% order.groupname | html %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
116 <td>[% IF ( order.invoicenumber ) %]
117 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
123 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title |html %]</a>
124 <br />[% order.author | html %] <br /> [% order.isbn | html %]
126 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
127 <td data-order="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</td>
128 <td data-order="[% order.datereceived | html %]">
129 [% order.datereceived | $KohaDates %]
131 <td>[% order.quantityreceived | html %]</td>
132 <td>[% order.quantity | html %]</td>
133 <td>[% order.ecost | html %]</td>
134 <td>[% order.budget_name | html %]</td>
139 [% IF op == 'select' && ( result_order_loop || selected_order_loop ) %]
141 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl">
142 <table id="table_orders">
144 <span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
145 | <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
150 <th>Order line (parent)</th>
153 <th>Basket creator</th>
154 <th>Basket group</th>
155 <th>Invoice number</th>
156 <th class="anti-the">Summary</th>
160 <th>Quantity received</th>
161 <th>Quantity ordered</th>
167 [% FOREACH order IN selected_order_loop %]
168 [% INCLUDE display_order_line selected => 1 can_check => 1%]
172 [% FOREACH order IN result_order_loop %]
173 [% INCLUDE display_order_line can_check => 1 %]
177 <fieldset class="action">
178 <input type="hidden" name="op" value="batch_edit" />
179 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
180 <button type="submit" class="btn btn-default go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button>
185 [% ELSIF op == "batch_edit" %]
187 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form">
188 <div id="accounting_details">
189 <p>Duplicate all the orders with the following accounting details:</p>
190 <fieldset class="rows" style="float:none;">
191 <legend>Accounting details</legend>
192 <div class="hint" style="margin: 1em 1em 0">Check boxes to duplicate the original values</div>
195 <label for="all_currency">Currency:</label>
196 <input type="checkbox" name="copy_existing_value" value="currency" title="Copy existing value" />
197 <select name="all_currency" id="all_currency">
198 [% FOREACH currency IN currencies %]
199 [% IF currency.currency == vendor.listprice %]
200 <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
201 [% ELSIF not currency.archived %]
202 <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
206 <span class="hint" id="hint_currency">The original currency value will be copied</span>
209 <label for="all_budget_id">Fund: </label>
210 <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
211 <select id="all_budget_id" name="all_budget_id">
212 <option value="">Select a fund</option>
213 [% FOREACH budget_loo IN budget_loop %]
214 [% 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>
215 [% 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>
219 <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;"> Show inactive:</label>
220 <input type="checkbox" id="all_showallbudgets" />
221 <span class="hint" id="hint_budget_id">The original fund will be used</span>
224 <label for="all_order_internalnote">Internal note: </label>
225 <input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" />
226 <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
227 <span class="hint" id="hint_order_internalnote">The original internal note will be used</span>
230 <label for="all_order_vendornote">Vendor note: </label>
231 <input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" />
232 <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
233 <span class="hint" id="hint_order_vendornote">The original vendor note will be used</span>
236 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
237 <label for="all_sort1">Statistic 1: </label>
238 <input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" />
239 <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
240 <span class="hint" id="hint_sort1">The original statistic 1 will be used</span>
244 <label for="all_sort2">Statistic 2: </label>
245 <input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" />
246 <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
247 <span class="hint" id="hint_sort2">The original statistic 2 will be used</span>
253 <fieldset class="action">
254 [% FOREACH ordernumber IN ordernumbers %]
255 <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
257 <input type="hidden" name="op" value="do_duplicate" />
258 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
259 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
260 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
261 <button type="submit" class="btn btn-default">Duplicate orders</button>
262 <a class="cancel" href="/cgi-bin/koha/acqui/duplicate_orders.pl?basketno=[% basket.basketno | html %]">Cancel</a>
266 [% ELSIF op == 'duplication_done' %]
268 <table id="table_neworders">
274 <th>Basket creator</th>
275 <th>Basket group</th>
276 <th>Invoice number</th>
277 <th class="anti-the">Summary</th>
281 <th>Quantity received</th>
282 <th>Quantity ordered</th>
288 [% FOREACH order IN new_orders %]
289 [% INCLUDE display_order_line %]
293 <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
295 <span>No order has been duplicated. Maybe something wrong happened?</span>
300 </div> <!-- /.col-sm-10.col-sm-push-2 -->
302 <div class="col-sm-2 col-sm-pull-10">
304 [% INCLUDE 'acquisitions-menu.inc' %]
306 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
309 [% MACRO jsinclude BLOCK %]
310 [% Asset.js("js/acquisitions-menu.js") | $raw %]
311 [% INCLUDE 'calendar.inc' %]
312 [% INCLUDE 'datatables.inc' %]
313 [% INCLUDE 'columns_settings.inc' %]
314 [% Asset.js("js/autocomplete/patrons.js") | $raw %]
315 [% Asset.js("js/acq.js") | $raw %]
316 [% Asset.js("js/funds_sorts.js") | $raw %]
318 function update_ordernumber_list(){
319 var ordernumbers = [];
320 $("input[name='ordernumber']").filter(":checked").each(function(){
321 ordernumbers.push($(this).val());
323 $("input[name='ordernumbers']").val(ordernumbers.join(','));
326 var MSG_REMOVE_PATRON = _("Remove");
327 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
328 var MSG_NO_FUND_SELECTED = _("No fund selected.");
329 $(document).ready(function() {
330 $('span.hint').hide();
331 var columns_settings;// = [% TablesSettings.GetColumns( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %];
332 KohaTable("table_orders", {
334 }, columns_settings );
336 [% IF op == 'search' OR op == 'select' %]
337 patron_autocomplete({
338 patron_container: $("#basket_creators"),
339 input_autocomplete: $("#find_patron"),
340 patron_input_name: 'created_by',
341 field_to_retrieve: 'borrowernumber'
345 $("#show_orders_filters, #hide_orders_filters").on('click', function(e) {
347 $('#orders_filters').toggle();
348 $('.toggle_orders_filters').toggle();
350 [% IF op == 'search' OR op == 'select' AND NOT result_order_loop %]
351 $("#show_orders_filters").hide();
352 $("#orders_filters").show();
354 $("#hide_orders_filters").hide();
355 $("#orders_filters").hide();
358 $("input[name='ordernumber']").on("change", function(){
359 if ( $(this).is(':checked') ) {
360 $(this).parents("tr").addClass("picked_to_duplicate");
362 $(this).parents("tr").removeClass("picked_to_duplicate");
364 }).on("click", function(e){
365 update_ordernumber_list();
368 $("#select_all").on("click",function(e){
371 update_ordernumber_list();
374 $("#clear_all").on("click",function(e){
377 update_ordernumber_list();
379 function selectAll () {
380 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
381 $(this).prop("checked", true).change();
385 function clearAll () {
386 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
387 $(this).prop("checked", false).change();
392 $(".go_to_batch_edit").on("click",function(e){
393 if ($("input[name='ordernumber']").filter(":checked").length == 0){
394 alert(MSG_NO_ITEM_SELECTED);
399 $("#batch_edit_form").on("submit", function(e){
400 var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
401 if ( ! budget_value_will_be_reused ) {
402 if ($("#all_budget_id").find("option:selected").attr("value") == "" ) {
403 alert(MSG_NO_FUND_SELECTED);
408 $("input[name='copy_existing_value']").click(function(){
409 render_disabled(this);
412 $("input[name='copy_existing_value']").each(function(){
413 render_disabled(this);
416 function render_disabled (elt) {
417 var field = $(elt).val();
418 var hint_node = $("#hint_" + field);
419 var input_element = $(elt).parent().find("[name='all_"+field+"']");
420 if ($(elt).is(":checked")) {
421 $(input_element).prop('disabled', true);
424 $(input_element).prop('disabled', false);
431 [% INCLUDE 'intranet-bottom.inc' %]