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 [% WRAPPER breadcrumbs %]
27 [% WRAPPER breadcrumb_item %]
28 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
30 [% UNLESS blocking_error %]
31 [% WRAPPER breadcrumb_item %]
32 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
34 [% WRAPPER breadcrumb_item %]
35 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketno | html %]</a>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
38 <span>Duplicate existing orders</span>
40 [% END # /UNLESS blocking_error %]
41 [% END #/ WRAPPER breadcrumbs %]
42 [% END #/ WRAPPER sub-header.inc %]
44 <div class="main container-fluid">
46 <div class="col-sm-10 col-sm-push-2">
49 <h1>Duplicate existing orders</h1>
50 [% INCLUDE 'blocking_errors.inc' %]
52 [% IF op == 'search' || op == 'select' %]
53 <form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post">
54 <fieldset class="rows">
56 [% IF op == 'search' %]
57 <span>Search orders</span>
59 <span>Refine search</span>
61 <span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span>
62 <span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span>
64 <div id="orders_filters">
65 [% INCLUDE 'filter-orders.inc' %]
66 <input type="hidden" name="op" value="select" />
67 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
69 <input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') | html %]" />
72 <fieldset class="action"><input type="submit" class="btn btn-primary" value="Search" /></fieldset>
76 [% BLOCK display_order_line %]
78 <tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber | html %]">
80 <tr data-ordernumber="[% order.ordernumber | html %]">
85 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" checked="checked" />
87 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" />
90 [% order.ordernumber | html %]
91 [% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
94 [% SWITCH order.orderstatus %]
95 [% CASE 'new' %]<span>New</span>
96 [% CASE 'ordered' %]<span>Ordered</span>
97 [% CASE 'partial' %]<span>Partially received</span>
98 [% CASE 'complete' %]<span>Received</span>
99 [% CASE 'cancelled' %]<span>Cancelled</span>
102 <td>[% order.basketname | html %] (<a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
103 <td>[% order.authorisedbyname | html %]</td>
105 [% IF ( order.basketgroupid ) %]
106 [% order.groupname | html %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
111 <td>[% IF ( order.invoicenumber ) %]
112 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
118 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title |html %]</a>
119 <br />[% order.author | html %] <br /> [% order.isbn | html %]
121 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
122 <td data-order="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</td>
123 <td data-order="[% order.datereceived | html %]">
124 [% order.datereceived | $KohaDates %]
126 <td>[% order.quantityreceived | html %]</td>
127 <td>[% order.quantity | html %]</td>
128 <td>[% order.ecost | html %]</td>
129 <td>[% order.budget_name | html %]</td>
134 [% IF op == 'select' && ( result_order_loop || selected_order_loop ) %]
135 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl">
136 <div id="orders_to_copy" class="page-section">
137 <table id="table_orders">
139 <span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
140 | <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
145 <th>Order line (parent)</th>
148 <th>Basket creator</th>
149 <th>Basket group</th>
150 <th>Invoice number</th>
151 <th class="anti-the">Summary</th>
155 <th>Quantity received</th>
156 <th>Quantity ordered</th>
162 [% FOREACH order IN selected_order_loop %]
163 [% INCLUDE display_order_line selected => 1 can_check => 1%]
167 [% FOREACH order IN result_order_loop %]
168 [% INCLUDE display_order_line can_check => 1 %]
173 <fieldset class="action">
174 <input type="hidden" name="op" value="batch_edit" />
175 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
176 <button type="submit" class="btn btn-primary go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button>
180 [% ELSIF op == "batch_edit" %]
182 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form">
183 <div id="accounting_details">
184 <p>Duplicate all the orders with the following accounting details:</p>
185 <fieldset class="rows" style="float:none;">
186 <legend>Accounting details</legend>
187 <div class="hint" style="margin: 1em 1em 0">Check boxes to duplicate the original values</div>
190 <label for="all_currency">Currency:</label>
191 <input type="checkbox" name="copy_existing_value" value="currency" title="Copy existing value" />
192 <select name="all_currency" id="all_currency">
193 [% FOREACH currency IN currencies %]
194 [% IF currency.currency == vendor.listprice %]
195 <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
196 [% ELSIF not currency.archived %]
197 <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
201 <span class="hint" id="hint_currency">The original currency value will be copied</span>
204 <label for="all_budget_id">Fund: </label>
205 <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
206 <select id="all_budget_id" name="all_budget_id">
207 <option value="">Select a fund</option>
208 [% FOREACH budget_loo IN budget_loop %]
209 [% 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>
210 [% 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>
214 <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;"> Show inactive:</label>
215 <input type="checkbox" id="all_showallbudgets" />
216 <span class="hint" id="hint_budget_id">The original fund will be used</span>
219 <label for="all_order_internalnote">Internal note: </label>
220 <input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" />
221 <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
222 <span class="hint" id="hint_order_internalnote">The original internal note will be used</span>
225 <label for="all_order_vendornote">Vendor note: </label>
226 <input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" />
227 <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
228 <span class="hint" id="hint_order_vendornote">The original vendor note will be used</span>
231 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
232 <label for="all_sort1">Statistic 1: </label>
233 <input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" />
234 <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
235 <span class="hint" id="hint_sort1">The original statistic 1 will be used</span>
239 <label for="all_sort2">Statistic 2: </label>
240 <input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" />
241 <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
242 <span class="hint" id="hint_sort2">The original statistic 2 will be used</span>
248 <fieldset class="action">
249 [% FOREACH ordernumber IN ordernumbers %]
250 <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
252 <input type="hidden" name="op" value="do_duplicate" />
253 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
254 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
255 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
256 <button type="submit" class="btn btn-primary">Duplicate orders</button>
257 <a class="cancel" href="/cgi-bin/koha/acqui/duplicate_orders.pl?basketno=[% basket.basketno | html %]">Cancel</a>
261 [% ELSIF op == 'duplication_done' %]
263 <table id="table_neworders">
269 <th>Basket creator</th>
270 <th>Basket group</th>
271 <th>Invoice number</th>
272 <th class="anti-the">Summary</th>
276 <th>Quantity received</th>
277 <th>Quantity ordered</th>
283 [% FOREACH order IN new_orders %]
284 [% INCLUDE display_order_line %]
288 <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
290 <span>No order has been duplicated. Maybe something wrong happened?</span>
295 </div> <!-- /.col-sm-10.col-sm-push-2 -->
297 <div class="col-sm-2 col-sm-pull-10">
299 [% INCLUDE 'acquisitions-menu.inc' %]
301 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
304 [% MACRO jsinclude BLOCK %]
305 [% Asset.js("js/acquisitions-menu.js") | $raw %]
306 [% INCLUDE 'calendar.inc' %]
307 [% INCLUDE 'datatables.inc' %]
308 [% INCLUDE 'columns_settings.inc' %]
309 [% Asset.js("js/acq.js") | $raw %]
310 [% Asset.js("js/funds_sorts.js") | $raw %]
312 function update_ordernumber_list(){
313 var ordernumbers = [];
314 $("input[name='ordernumber']").filter(":checked").each(function(){
315 ordernumbers.push($(this).val());
317 $("input[name='ordernumbers']").val(ordernumbers.join(','));
320 var MSG_REMOVE_PATRON = _("Remove");
321 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
322 var MSG_NO_FUND_SELECTED = _("No fund selected.");
323 $(document).ready(function() {
324 $('span.hint').hide();
325 KohaTable("table_orders", {
329 [% IF op == 'search' OR op == 'select' %]
330 function AddPatron( patron_name, value, container, input_name ) {
331 div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>";
332 $(container).append( div );
334 $(container).parent().show( 800 );
336 function RemovePatron( cardnumber, container ) {
337 $( '#borrower_' + cardnumber ).remove();
339 if ( ! $(container).html() ) {
340 $(container).parent("fieldset").hide( 800 );
343 patron_autocomplete($("#find_patron"), {
344 'on-select-callback': function( event, ui ) {
345 var field = ui.item.borrowernumber;
346 AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#basket_creators"), 'created_by' );
347 $("#find_patron").val('').focus();
351 $("body").on("click",".removePatron",function(e){
353 var divid = $(this).parent().attr("id");
354 var cardnumber = divid.replace("borrower_","");
355 RemovePatron(cardnumber, $("#basket_creators"));
360 $("#show_orders_filters, #hide_orders_filters").on('click', function(e) {
362 $('#orders_filters').toggle();
363 $('.toggle_orders_filters').toggle();
365 [% IF op == 'search' OR op == 'select' AND NOT result_order_loop %]
366 $("#show_orders_filters").hide();
367 $("#orders_filters").show();
369 $("#hide_orders_filters").hide();
370 $("#orders_filters").hide();
373 $("input[name='ordernumber']").on("change", function(){
374 if ( $(this).is(':checked') ) {
375 $(this).parents("tr").addClass("picked_to_duplicate");
377 $(this).parents("tr").removeClass("picked_to_duplicate");
379 }).on("click", function(e){
380 update_ordernumber_list();
383 $("#select_all").on("click",function(e){
386 update_ordernumber_list();
389 $("#clear_all").on("click",function(e){
392 update_ordernumber_list();
394 function selectAll () {
395 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
396 $(this).prop("checked", true).change();
400 function clearAll () {
401 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
402 $(this).prop("checked", false).change();
407 $(".go_to_batch_edit").on("click",function(e){
408 if ($("input[name='ordernumber']").filter(":checked").length == 0){
409 alert(MSG_NO_ITEM_SELECTED);
414 $("#batch_edit_form").on("submit", function(e){
415 var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
416 if ( ! budget_value_will_be_reused ) {
417 if ($("#all_budget_id").find("option:selected").val() == "" ) {
418 alert(MSG_NO_FUND_SELECTED);
423 $("input[name='copy_existing_value']").click(function(){
424 render_disabled(this);
427 $("input[name='copy_existing_value']").each(function(){
428 render_disabled(this);
431 function render_disabled (elt) {
432 var field = $(elt).val();
433 var hint_node = $("#hint_" + field);
434 var input_element = $(elt).parent().find("[name='all_"+field+"']");
435 if ($(elt).is(":checked")) {
436 $(input_element).prop('disabled', true);
439 $(input_element).prop('disabled', false);
446 [% INCLUDE 'intranet-bottom.inc' %]