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 <div id="breadcrumbs">
25 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
26 › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
27 [% UNLESS blocking_error %]
28 › <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
29 › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketno | html %]</a>
30 › Duplicate existing orders
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
39 [% INCLUDE 'blocking_errors.inc' %]
41 <h2>Duplicate existing orders</h2>
43 [% IF op == 'search' || op == 'select' %]
44 <form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post">
45 <fieldset class="rows">
47 [% IF op == 'search' %]
48 <span>Search orders</span>
50 <span>Refine search</span>
52 <span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span>
53 <span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span>
55 <div id="orders_filters">
56 [% INCLUDE 'filter-orders.inc' %]
57 <input type="hidden" name="op" value="select" />
58 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
60 <input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') | html %]" />
61 <fieldset class="action"><input type="submit" value="Search" /></fieldset>
67 [% BLOCK display_order_line %]
69 <tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber | html %]">
71 <tr data-ordernumber="[% order.ordernumber | html %]">
76 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" checked="checked" />
78 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" />
81 [% order.ordernumber | html %]
82 [% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
85 [% SWITCH order.orderstatus %]
87 [% CASE 'ordered' %]Ordered
88 [% CASE 'partial' %]Partially received
89 [% CASE 'complete' %]Received
90 [% CASE 'cancelled' %]Cancelled
93 <td>[% order.basketname | html %] (<a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
94 <td>[% order.authorisedbyname | html %]</td>
96 [% IF ( order.basketgroupid ) %]
97 [% order.groupname | html %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
102 <td>[% IF ( order.invoicenumber ) %]
103 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
109 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title |html %]</a>
110 <br />[% order.author | html %] <br /> [% order.isbn | html %]
112 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
113 <td><span title="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</span></td>
115 [% IF order.datereceived %]
116 <span title="[% order.datereceived | html %]">[% order.datereceived | $KohaDates %]</span>
118 <span title="0000-00-00"></span>
121 <td>[% order.quantityreceived | html %]</td>
122 <td>[% order.quantity | html %]</td>
123 <td>[% order.ecost | html %]</td>
124 <td>[% order.budget_name | html %]</td>
129 [% IF op == 'select' && ( result_order_loop || selected_order_loop ) %]
131 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl">
132 <table id="table_orders">
134 <span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
135 | <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
140 <th>Order line (parent)</th>
143 <th>Basket creator</th>
144 <th>Basket group</th>
145 <th>Invoice number</th>
146 <th class="anti-the">Summary</th>
148 <th class="title-string">Placed on</th>
149 <th class="title-string">Received on</th>
150 <th>Quantity received</th>
151 <th>Quantity ordered</th>
157 [% FOREACH order IN selected_order_loop %]
158 [% INCLUDE display_order_line selected => 1 can_check => 1%]
162 [% FOREACH order IN result_order_loop %]
163 [% INCLUDE display_order_line can_check => 1 %]
167 <fieldset class="action">
168 <input type="hidden" name="op" value="batch_edit" />
169 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
170 <button type="submit" class="btn btn-default go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button>
175 [% ELSIF op == "batch_edit" %]
177 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form">
178 <div id="accounting_details">
179 <p>Duplicate all the orders with the following accounting details:</p>
180 <fieldset class="rows" style="float:none;">
181 <legend>Accounting details</legend>
182 <div class="hint" style="margin: 1em 1em 0">Check boxes to duplicate the original values</div>
185 <label for="all_currency">Currency:</label>
186 <input type="checkbox" name="copy_existing_value" value="currency" title="Copy existing value" />
187 <select name="all_currency" id="all_currency">
188 [% FOREACH currency IN currencies %]
189 [% IF currency.currency == vendor.listprice %]
190 <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
191 [% ELSIF not currency.archived %]
192 <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
196 <span class="hint" id="hint_currency">The original currency value will be copied</span>
199 <label for="all_budget_id">Fund: </label>
200 <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
201 <select id="all_budget_id" size="1" name="all_budget_id">
202 <option value="">Select a fund</option>
203 [% FOREACH budget_loo IN budget_loop %]
204 [% 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>
205 [% 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>
209 <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;"> Show inactive:</label>
210 <input type="checkbox" id="all_showallbudgets" />
211 <span class="hint" id="hint_budget_id">The original fund will be used</span>
214 <label for="all_order_internalnote">Internal note: </label>
215 <input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" />
216 <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
217 <span class="hint" id="hint_order_internalnote">The original internal note will be used</span>
220 <label for="all_order_vendornote">Vendor note: </label>
221 <input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" />
222 <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
223 <span class="hint" id="hint_order_vendornote">The original vendor note will be used</span>
226 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
227 <label for="all_sort1">Statistic 1: </label>
228 <input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" />
229 <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
230 <span class="hint" id="hint_sort1">The original statistic 1 will be used</span>
234 <label for="all_sort2">Statistic 2: </label>
235 <input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" />
236 <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
237 <span class="hint" id="hint_sort2">The original statistic 2 will be used</span>
243 <fieldset class="action">
244 [% FOREACH ordernumber IN ordernumbers %]
245 <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
247 <input type="hidden" name="op" value="do_duplicate" />
248 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
249 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
250 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
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 | html %]">Cancel</a>
256 [% ELSIF op == 'duplication_done' %]
258 <table id="table_neworders">
264 <th>Basket creator</th>
265 <th>Basket group</th>
266 <th>Invoice number</th>
267 <th class="anti-the">Summary</th>
269 <th class="title-string">Placed on</th>
270 <th class="title-string">Received on</th>
271 <th>Quantity received</th>
272 <th>Quantity ordered</th>
278 [% FOREACH order IN new_orders %]
279 [% INCLUDE display_order_line %]
283 <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
285 <span>No order has been duplicated. Maybe something wrong happened?</span>
290 </div> <!-- /.col-sm-10.col-sm-push-2 -->
292 <div class="col-sm-2 col-sm-pull-10">
294 [% INCLUDE 'acquisitions-menu.inc' %]
296 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
299 [% MACRO jsinclude BLOCK %]
300 [% Asset.js("js/acquisitions-menu.js") | $raw %]
301 [% INCLUDE 'calendar.inc' %]
302 [% INCLUDE 'datatables.inc' %]
303 [% INCLUDE 'columns_settings.inc' %]
304 [% Asset.js("js/autocomplete/patrons.js") | $raw %]
305 [% Asset.js("js/acq.js") | $raw %]
306 [% Asset.js("js/funds_sorts.js") | $raw %]
308 function update_ordernumber_list(){
309 var ordernumbers = [];
310 $("input[name='ordernumber']").filter(":checked").each(function(){
311 ordernumbers.push($(this).val());
313 $("input[name='ordernumbers']").val(ordernumbers.join(','));
316 var MSG_REMOVE_PATRON = _("Remove");
317 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
318 var MSG_NO_FUND_SELECTED = _("No fund selected.");
319 $(document).ready(function() {
320 $('span.hint').hide();
321 var columns_settings;// = [% TablesSettings.GetColumns( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %];
322 KohaTable("table_orders", {
324 }, columns_settings );
326 [% IF op == 'search' OR op == 'select' %]
327 patron_autocomplete({
328 patron_container: $("#basket_creators"),
329 input_autocomplete: $("#find_patron"),
330 patron_input_name: 'created_by',
331 field_to_retrieve: 'borrowernumber'
335 $("#show_orders_filters, #hide_orders_filters").on('click', function(e) {
337 $('#orders_filters').toggle();
338 $('.toggle_orders_filters').toggle();
340 [% IF op == 'search' OR op == 'select' AND NOT result_order_loop %]
341 $("#show_orders_filters").hide();
342 $("#orders_filters").show();
344 $("#hide_orders_filters").hide();
345 $("#orders_filters").hide();
348 $("input[name='ordernumber']").on("change", function(){
349 if ( $(this).is(':checked') ) {
350 $(this).parents("tr").addClass("picked_to_duplicate");
352 $(this).parents("tr").removeClass("picked_to_duplicate");
354 }).on("click", function(e){
355 update_ordernumber_list();
358 $("#select_all").on("click",function(e){
361 update_ordernumber_list();
364 $("#clear_all").on("click",function(e){
367 update_ordernumber_list();
369 function selectAll () {
370 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
371 $(this).prop("checked", true).change();
375 function clearAll () {
376 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
377 $(this).prop("checked", false).change();
382 $(".go_to_batch_edit").on("click",function(e){
383 if ($("input[name='ordernumber']").filter(":checked").length == 0){
384 alert(MSG_NO_ITEM_SELECTED);
389 $("#batch_edit_form").on("submit", function(e){
390 var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
391 if ( ! budget_value_will_be_reused ) {
392 if ($("#all_budget_id").find("option:selected").attr("value") == "" ) {
393 alert(MSG_NO_FUND_SELECTED);
398 $("input[name='copy_existing_value']").click(function(){
399 render_disabled(this);
402 $("input[name='copy_existing_value']").each(function(){
403 render_disabled(this);
406 function render_disabled (elt) {
407 var field = $(elt).val();
408 var hint_node = $("#hint_" + field);
409 var input_element = $(elt).parent().find("[name='all_"+field+"']");
410 if ($(elt).is(":checked")) {
411 $(input_element).prop('disabled', true);
414 $(input_element).prop('disabled', false);
421 [% INCLUDE 'intranet-bottom.inc' %]