From 75b1a8090e39f2ec70fd99c902b52c326d553290 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 11 Sep 2023 20:38:12 +0000 Subject: [PATCH] Bug 34708: Add ability to modify orderline to increase quantity This enhancement allows libraries to modify an existing orderline and increase the quantity in the order. The quantity is increased by adding more items to the order, through the usual Item for which is visible when adding or modifying an order. To test: 1. Ensure you have a budget, fund, vendor etc. to use the Acquisitions module 2. Open a new basket. Make sure you do NOT check the 'orders are standing' option 3. Add an order to the basket using any method. Add an item or more to this orderline and save the order to the basket 4. Click Modify to edit the orderline 5. Notice the quantity text field. Try to directly change this number. You'll get an error pop-up and be redirected back to the basket. 6. Apply the patch, restart services, refresh the basket page 7. Click Modify to edit the orderline 8. Notice the item form and Items list table is visible with your existing item(s) for this order. There should be no Action buttons as actions can't be done on an existing item order. 9. Confirm you are able to add more items to the Items list and to the order by filling out the form and clicking 'Add item' as normal. Confirm the quantity increases accordingly. 10. Confirm the Edit and Delete buttons for newly added items work as expected 11. Save and confirm the quantity for the orderline has increased 12. Confirm this behaviour persists with the other methods of adding new orders to a basket Sponsored-by: Pymble Ladies' College Signed-off-by: Katariina Hanhisalo Signed-off-by: Katrin Fischer Perltidy Signed-off-by: Katrin Fischer --- acqui/neworderempty.pl | 13 +++++---- .../prog/en/modules/acqui/neworderempty.tt | 27 +++++++++++++++++-- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index c0bda72619..28a734add9 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -349,15 +349,15 @@ foreach my $r (@{$budgets}) { $template->param( sort1 => $data->{'sort1'} ); $template->param( sort2 => $data->{'sort2'} ); -if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) { +if ( $basketobj->effective_create_items eq 'ordering' ) { # Check if ACQ framework exists - my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } ); - unless($marc) { - $template->param('NoACQframework' => 1); + my $marc = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } ); + unless ($marc) { + $template->param( 'NoACQframework' => 1 ); } $template->param( AcqCreateItemOrdering => 1, - UniqueItemFields => C4::Context->preference('UniqueItemFields'), + UniqueItemFields => C4::Context->preference('UniqueItemFields'), ); } @@ -420,11 +420,13 @@ $quantity //= 0; my $record; my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list; my %additional_field_values; +my $items; if ($ordernumber) { my $order = Koha::Acquisition::Orders->find($ordernumber); foreach my $value ($order->additional_field_values->as_list) { $additional_field_values{$value->field_id} = $value->value; } + $items = $order->items; } elsif ( $biblionumber ) { foreach my $af (@additional_fields) { if ($af->marcfield) { @@ -437,6 +439,7 @@ if ($ordernumber) { $template->param( additional_fields => \@additional_fields, additional_field_values => \%additional_field_values, + items => $items, ); # fill template diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index e1c0268842..b256882583 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -5,6 +5,7 @@ [% USE Price %] [% USE ItemTypes %] [% USE AuthorisedValues %] +[% USE Branches %] [% PROCESS 'i18n.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] @@ -132,6 +133,10 @@ } $(document).ready(function(){ + [% UNLESS ordernumber %] + $("#items_list").hide(); + [% END %] + [% IF AcqCreateItemOrdering and not basket.is_standing %] cloneItemBlock(0, '[% UniqueItemFields | html %]'); [% END %] @@ -490,7 +495,7 @@ [% UNLESS subscriptionid || basket.is_standing %][% # it is a suggestion, we have not items %] [% IF (AcqCreateItemOrdering) %] - <div id="items_list" class="page-section" style="display:none"> + <div id="items_list" class="page-section"> <p><strong>Items list</strong></p> <div style="width:100%;overflow:auto;"> <table> @@ -513,6 +518,24 @@ </tr> </thead> <tbody> + [% FOREACH item IN items %] + <tr idblock="itemblock[% item.id | html %]"> + <td> </td> + <td>[% item.barcode | html %]</td> + <td>[% Branches.GetName(item.homebranch) | html %]</td> + <td>[% Branches.GetName(item.holdingbranch) | html %]</td> + <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]</td> + <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]</td> + <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]</td> + <td>[% item.itemcallnumber | html %]</td> + <td>[% item.copynumber | html %]</td> + <td>[% item.stocknumber | html %]</td> + <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td> + <td>[% ItemTypes.GetDescription( item.itype ) | html %]</td> + <td>[% item.materials | html %]</td> + <td>[% item.itemnotes | html %]</td> + </tr> + [% END %] </tbody> </table> </div> @@ -544,7 +567,7 @@ [% IF basket.is_standing %] <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" /> [% ELSE %] - <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" /> + <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="[% quantityrec | html %]" /> [% END %] [% ELSE %] [% IF basket.is_standing %] -- 2.30.2