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' %]
13 [% Asset.css("css/datatables.css") | $raw %]
15 .picked_to_duplicate > td { background-color: #bcdb89 !important; }
16 span.hint { margin-left: 1em; }
20 <body id="acq_duplicate_orders" class="acq">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'acquisitions-search.inc' %]
25 <div id="breadcrumbs">
26 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27 › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
28 [% UNLESS blocking_error %]
29 › <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
30 › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketno | html %]</a>
31 › Duplicate existing orders
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
40 [% INCLUDE 'blocking_errors.inc' %]
42 <h2>Duplicate existing orders</h2>
44 [% IF op == 'search' || op == 'select' %]
45 <form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post">
46 <fieldset class="rows">
48 [% IF op == 'search' %]
49 <span>Search orders</span>
51 <span>Refine search</span>
53 <span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span>
54 <span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span>
56 <div id="orders_filters">
57 [% INCLUDE 'filter-orders.inc' %]
58 <input type="hidden" name="op" value="select" />
59 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
61 <input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') | html %]" />
62 <fieldset class="action"><input type="submit" value="Search" /></fieldset>
68 [% BLOCK display_order_line %]
70 <tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber | html %]">
72 <tr data-ordernumber="[% order.ordernumber | html %]">
77 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" checked="checked" />
79 <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" />
82 [% order.ordernumber | html %]
83 [% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
86 [% SWITCH order.orderstatus %]
88 [% CASE 'ordered' %]Ordered
89 [% CASE 'partial' %]Partially received
90 [% CASE 'complete' %]Received
91 [% CASE 'cancelled' %]Cancelled
94 <td>[% order.basketname | html %] (<a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
95 <td>[% order.authorisedbyname | html %]</td>
97 [% IF ( order.basketgroupid ) %]
98 [% order.groupname | html %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
103 <td>[% IF ( order.invoicenumber ) %]
104 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
110 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title |html %]</a>
111 <br />[% order.author | html %] <br /> [% order.isbn | html %]
113 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
114 <td><span title="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</span></td>
116 [% IF order.datereceived %]
117 <span title="[% order.datereceived | html %]">[% order.datereceived | $KohaDates %]</span>
119 <span title="0000-00-00"></span>
122 <td>[% order.quantityreceived | html %]</td>
123 <td>[% order.quantity | html %]</td>
124 <td>[% order.ecost | html %]</td>
125 <td>[% order.budget_name | html %]</td>
130 [% IF op == 'select' && ( result_order_loop || selected_order_loop ) %]
132 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl">
133 <table id="table_orders">
135 <span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
136 | <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
141 <th>Order line (parent)</th>
144 <th>Basket creator</th>
145 <th>Basket group</th>
146 <th>Invoice number</th>
147 <th class="anti-the">Summary</th>
149 <th class="title-string">Placed on</th>
150 <th class="title-string">Received on</th>
151 <th>Quantity received</th>
152 <th>Pending order</th>
158 [% FOREACH order IN selected_order_loop %]
159 [% INCLUDE display_order_line selected => 1 can_check => 1%]
163 [% FOREACH order IN result_order_loop %]
164 [% INCLUDE display_order_line can_check => 1 %]
168 <fieldset class="action">
169 <input type="hidden" name="op" value="batch_edit" />
170 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
171 <button type="submit" class="btn btn-default go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button>
176 [% ELSIF op == "batch_edit" %]
178 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form">
179 <div id="accounting_details">
180 <p>Duplicate all the orders with the following accounting details:</p>
181 <fieldset class="rows" style="float:none;">
182 <legend>Accounting details</legend>
183 <div class="hint" style="margin: 1em 1em 0">Check boxes to duplicate the original values</div>
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 | html %]" selected="selected">[% currency.currency | html %]</option>
192 [% ELSIF not currency.archived %]
193 <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
197 <span class="hint" id="hint_currency">The original currency value will be copied</span>
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 | 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>
206 [% 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>
210 <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;"> 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>
215 <label for="all_order_internalnote">Internal note: </label>
216 <input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" />
217 <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
218 <span class="hint" id="hint_order_internalnote">The original internal note will be used</span>
221 <label for="all_order_vendornote">Vendor note: </label>
222 <input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" />
223 <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
224 <span class="hint" id="hint_order_vendornote">The original vendor note will be used</span>
227 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
228 <label for="all_sort1">Statistic 1: </label>
229 <input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" />
230 <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
231 <span class="hint" id="hint_sort1">The original statistic 1 will be used</span>
235 <label for="all_sort2">Statistic 2: </label>
236 <input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" />
237 <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
238 <span class="hint" id="hint_sort2">The original statistic 2 will be used</span>
244 <fieldset class="action">
245 [% FOREACH ordernumber IN ordernumbers %]
246 <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
248 <input type="hidden" name="op" value="do_duplicate" />
249 <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
250 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
251 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
252 <button type="submit" class="btn btn-default">Duplicate orders</button>
253 <a class="cancel" href="/cgi-bin/koha/acqui/duplicate_orders.pl?basketno=[% basket.basketno | html %]">Cancel</a>
257 [% ELSIF op == 'duplication_done' %]
259 <table id="table_neworders">
265 <th>Basket creator</th>
266 <th>Basket group</th>
267 <th>Invoice number</th>
268 <th class="anti-the">Summary</th>
270 <th class="title-string">Placed on</th>
271 <th class="title-string">Received on</th>
272 <th>Quantity received</th>
273 <th>Pending order</th>
279 [% FOREACH order IN new_orders %]
280 [% INCLUDE display_order_line %]
284 <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
286 <span>No order has been duplicated. Maybe something wrong happened?</span>
291 </div> <!-- /.col-sm-10.col-sm-push-2 -->
293 <div class="col-sm-2 col-sm-pull-10">
295 [% INCLUDE 'acquisitions-menu.inc' %]
297 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
300 [% MACRO jsinclude BLOCK %]
301 [% Asset.js("js/acquisitions-menu.js") | $raw %]
302 [% INCLUDE 'calendar.inc' %]
303 [% INCLUDE 'datatables.inc' %]
304 [% INCLUDE 'columns_settings.inc' %]
305 [% Asset.js("js/autocomplete/patrons.js") | $raw %]
306 [% Asset.js("js/acq.js") | $raw %]
307 [% Asset.js("js/funds_sorts.js") | $raw %]
308 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
310 function update_ordernumber_list(){
311 var ordernumbers = [];
312 $("input[name='ordernumber']").filter(":checked").each(function(){
313 ordernumbers.push($(this).val());
315 $("input[name='ordernumbers']").val(ordernumbers.join(','));
318 var MSG_REMOVE_PATRON = _("Remove");
319 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
320 var MSG_NO_FUND_SELECTED = _("No fund selected.");
321 $(document).ready(function() {
322 $('span.hint').hide();
323 var columns_settings;// = [% ColumnsSettings.GetColumns( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %];
324 KohaTable("table_orders", {
326 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
327 { "sType": "title-string", "aTargets" : [ "title-string" ] }
330 }, columns_settings );
332 [% IF op == 'search' OR op == 'select' %]
333 patron_autocomplete({
334 patron_container: $("#basket_creators"),
335 input_autocomplete: $("#find_patron"),
336 patron_input_name: 'created_by',
337 field_to_retrieve: 'borrowernumber'
341 $("#show_orders_filters, #hide_orders_filters").on('click', function(e) {
343 $('#orders_filters').toggle();
344 $('.toggle_orders_filters').toggle();
346 [% IF op == 'search' OR op == 'select' AND NOT result_order_loop %]
347 $("#show_orders_filters").hide();
348 $("#orders_filters").show();
350 $("#hide_orders_filters").hide();
351 $("#orders_filters").hide();
354 $("input[name='ordernumber']").on("change", function(){
355 if ( $(this).is(':checked') ) {
356 $(this).parents("tr").addClass("picked_to_duplicate");
358 $(this).parents("tr").removeClass("picked_to_duplicate");
360 }).on("click", function(e){
361 update_ordernumber_list();
364 $("#select_all").on("click",function(e){
367 update_ordernumber_list();
370 $("#clear_all").on("click",function(e){
373 update_ordernumber_list();
375 function selectAll () {
376 $("#table_orders").checkCheckboxes();
377 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
382 function clearAll () {
383 $("#table_orders").unCheckCheckboxes();
384 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
390 $(".go_to_batch_edit").on("click",function(e){
391 if ($("input[name='ordernumber']").filter(":checked").length == 0){
392 alert(MSG_NO_ITEM_SELECTED);
397 $("#batch_edit_form").on("submit", function(e){
398 var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
399 if ( ! budget_value_will_be_reused ) {
400 if ($("#all_budget_id").find("option:selected").attr("value") == "" ) {
401 alert(MSG_NO_FUND_SELECTED);
406 $("input[name='copy_existing_value']").click(function(){
407 render_disabled(this);
410 $("input[name='copy_existing_value']").each(function(){
411 render_disabled(this);
414 function render_disabled (elt) {
415 var field = $(elt).val();
416 var hint_node = $("#hint_" + field);
417 var input_element = $(elt).parent().find("[name='all_"+field+"']");
418 if ($(elt).is(":checked")) {
419 $(input_element).prop('disabled', true);
422 $(input_element).prop('disabled', false);
429 [% INCLUDE 'intranet-bottom.inc' %]