Bugzilla – Attachment 179306 Details for
Bug 39282
When adding an order from file, data entered in the "Item information" tab is not saved and invalid items are created
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39282: Ensure items are created using Item Information values if not using MarcItemFieldsToOrder
Bug-39282-Ensure-items-are-created-using-Item-Info.patch (text/plain), 3.19 KB, created by
Martin Renvoize (ashimema)
on 2025-03-14 07:57:18 UTC
(
hide
)
Description:
Bug 39282: Ensure items are created using Item Information values if not using MarcItemFieldsToOrder
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-03-14 07:57:18 UTC
Size:
3.19 KB
patch
obsolete
>From c079a23cfd1a6bab64c39dff1d2171515c3eb32c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 12 Mar 2025 16:25:37 +0000 >Subject: [PATCH] Bug 39282: Ensure items are created using Item Information > values if not using MarcItemFieldsToOrder > >When using MarcFieldsToOrder and not MarcItemFieldsToOrder it is expected that all of the item >information will come from the second tab 'Item information' on addorderiso2709.pl > >Currently we are not and blank items are beign created > >To test: > 1 - Apply unit tests > 2 - prove -v t/db_dependent/Koha/MarcOrder.t > 3 - It fails > 4 - Set MarcItemFields to Order: > price: 949$p > quantity: 947$c > budget_code: 947$f > 5 - Ensure MarcItemFieldsToOrder is blank > 6 - Find a basket in acquisitions > 7 - Add to basket from a file > 8 - Fill item information, set 'Matching' at top of form to 'Do not look for matchign records' and save > 9 - Orders are added >10 - Click on a title >11 - Items do not load and an error is generated, this is because items don't have any values >12 - Check the DB: > SELECT * FROM items WHERE homebranch IS NULL\G >13 - Note items from order are listed >14 - Apply the rest of the patches >15 - Repeat 6-10 >16 - This time the items load successfully > >NOTE: This patch alone doesn't address all errors, but subsequent will, keeping separate to address >each issue individually, but test plan can be executed as a whole against all > >Signed-off-by: John Vinke <jvinke@austinseminary.edu> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/MarcOrder.pm | 4 +++- > t/db_dependent/Koha/MarcOrder.t | 1 + > 2 files changed, 4 insertions(+), 1 deletion(-) > >diff --git a/Koha/MarcOrder.pm b/Koha/MarcOrder.pm >index edfe93d1b21..10379d9cf8d 100644 >--- a/Koha/MarcOrder.pm >+++ b/Koha/MarcOrder.pm >@@ -958,7 +958,8 @@ sub create_items_and_generate_order_hash { > my $itemcreation = 0; > my @itemnumbers; > >- if ( C4::Context->preference('AcqCreateItem') ne 'cataloguing' ) { >+ # We directly create the items if MarcItemFieldsToOrder is populated (item fields have values) >+ if ( C4::Context->preference('AcqCreateItem') ne 'cataloguing' && @{ $fields->{homebranch} } ) { > for ( my $i = 0 ; $i < $loop_limit ; $i++ ) { > $itemcreation = 1; > my $item = Koha::Item->new( >@@ -1052,6 +1053,7 @@ sub create_items_and_generate_order_hash { > } > } else { > >+ # Here we are using the 'MARC' for items from the 'Item information' tab for creating the items > # Add an orderline for each MARC record > # Get quantity in the MARC record (1 if none) > my $quantity = GetMarcQuantity( $fields->{marcrecord}, C4::Context->preference('marcflavour') ) || 1; >diff --git a/t/db_dependent/Koha/MarcOrder.t b/t/db_dependent/Koha/MarcOrder.t >index b3aac287ad6..41a0cadbab0 100755 >--- a/t/db_dependent/Koha/MarcOrder.t >+++ b/t/db_dependent/Koha/MarcOrder.t >@@ -443,6 +443,7 @@ subtest 'add_items_from_import_record() - addorderiso2709.pl' => sub { > > subtest "Using MarcFieldsToOrder only" => sub { > plan tests => 9; >+ t::lib::Mocks::mock_userenv( { branchcode => $branchcode } ); > > my $client_item_fields = { > 'tags' => [ >-- >2.48.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39282
:
179222
|
179223
|
179224
|
179225
|
179230
|
179280
|
179281
|
179282
|
179283
|
179305
| 179306 |
179307
|
179308
|
179345