From 2259a647f51c5d6bf9287d8734944f3733e94609 Mon Sep 17 00:00:00 2001 From: Slava Shishkin Date: Thu, 29 Jan 2026 15:37:33 +0200 Subject: [PATCH] Bug 41732: Default order quantity to 1 outside item-at-ordering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan: 1. In system preferences, set AcqCreateItem to cataloging the record or receiving an order. 2. Create a new basket with Create items when set to Use default (receiving an order). 3. In the basket, click + Add to basket and select an existing bibliographic record. 4. From the selected bibliographic record, click Add order. 5. On the order page, check Accounting details → Quantity. • Notice that the quantity defaults to 0 and the field is editable. After applying the patch 6. Repeat steps 1–4. 7. On the order page, check Accounting details → Quantity. • Notice that the quantity defaults to 1 and the field is editable. Item creation at ordering 8. In system preferences, set AcqCreateItem to placing an order. 9. Create a new order. 10. On the order page, check Accounting details → Quantity. • Notice that the quantity defaults to 0 and the field is not editable. --- acqui/neworderempty.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index efbec39ac0a..3c0400241f1 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -409,11 +409,14 @@ my ( undef, $barcode_subfield ) = GetMarcFromKohaField('items.barcode'); # get option values for TaxRates syspref my @gst_values = map { option => $_ + 0.0 }, split( '\|', C4::Context->preference("TaxRates") ); +my $rr_qty = $input->param('rr_quantity_to_order'); + my $quantity = - $input->param('rr_quantity_to_order') - ? $input->param('rr_quantity_to_order') - : $data->{'quantity'}; -$quantity //= 0; + defined $rr_qty + ? $rr_qty + : $data->{quantity}; + +$quantity //= ( $basketobj->effective_create_items eq 'ordering' ? 0 : 1 ); # Get additional fields my $record; -- 2.52.0