@@ -, +, @@ order item to existing record --- acqui/addorder.pl | 5 ++ acqui/neworderempty.pl | 9 +++ .../prog/en/modules/acqui/neworderempty.tt | 75 ++++++++++++++++++++++ 3 files changed, 89 insertions(+) --- a/acqui/addorder.pl +++ a/acqui/addorder.pl @@ -299,6 +299,11 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { $order->store; } + my @items = $input->multi_param('itemnumber'); + foreach my $item ( @items ) { + $order->add_item($item); + } + # now, add items if applicable if ($basket->effective_create_items eq 'ordering') { --- a/acqui/neworderempty.pl +++ a/acqui/neworderempty.pl @@ -185,6 +185,15 @@ if ( not $ordernumber ) { # create order if ( $biblionumber ) { $data = GetBiblioData($biblionumber); + + # get existing items not previously ordered in existing record + my @all_items = GetItemsInfo( $biblionumber ); + my @items; + foreach my $item ( @all_items ){ + my $acqitem = Koha::Database->new->schema->resultset('AqordersItem')->find($item->{itemnumber}); + push @items, $item unless( $acqitem ); + } + $template->param( existingitems => \@items ); } # get suggestion fields if applicable. If it's a subscription renewal, then the biblio already exists # otherwise, retrieve suggestion information. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -246,6 +246,60 @@ [% END %] + [% IF ( existingitems ) %] +
+ Existing Items +
+
+ + + + + + + + + + + + + + + + + + + + + + [% FOREACH item IN existingitems %] + + + + + + + + + + + + + + + + + + [% END %] + +
 BarcodeHome libraryHolding libraryNot for loanRestrictedLocationCall numberCopy numberInventory numberCollection codeItem typeMaterialsPriceNotes
+ + [% item.barcode %][% item.homebranch %][% item.holdingbranch %][% item.notforloan %][% item.restricted %][% item.location %][% item.itemcallnumber %][% item.copynumber %][% item.stocknumber %][% item.ccode %][% item.itype %][% item.materials %][% item.price %][% item.itemnotes %]
+
+
+
+ [% END %] + [% UNLESS subscriptionid || basket.is_standing %][% # it is a suggestion, we have not items %] [% IF (AcqCreateItemOrdering) %] @@ -611,6 +665,27 @@ } $(document).ready(function(){ + $("input[name='itemnumber'][type='checkbox']").change(function() { + if (this.checked) { + var number = new Number( $("#quantity").val() ); + $("#quantity").val( number+1 ); + var price = new Number( $(this).attr("data-price") ); + var total = new Number( $("#total").val() ); + var listprice = new Number( (total+price)/Number( $("#quantity").val() ) ); + $("#listprice").val( listprice ); + updateCosts(); + } else { + var number = new Number( $("#quantity").val() ); + $("#quantity").val( number-1 ); + var price = new Number( $(this).attr("data-price") ); + var total = new Number( $("#total").val() ); + var listprice = new Number( (total-price)/Number( $("#quantity").val() ) ); + if( isNaN( listprice ) ) listprice = 0; + $("#listprice").val( listprice ); + updateCosts(); + } + }); + [% IF AcqCreateItemOrdering and not basket.is_standing %] cloneItemBlock(0, '[% UniqueItemFields | html %]'); [% END %] --