Bugzilla – Attachment 179224 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: Clarify use of budget codes and ids
Bug-39282-Clarify-use-of-budget-codes-and-ids.patch (text/plain), 3.00 KB, created by
Nick Clemens (kidclamp)
on 2025-03-12 17:11:15 UTC
(
hide
)
Description:
Bug 39282: Clarify use of budget codes and ids
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-03-12 17:11:15 UTC
Size:
3.00 KB
patch
obsolete
>From 9aecdc202b473d8da18701221bee2c03b55c48e8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 12 Mar 2025 16:38:21 +0000 >Subject: [PATCH] Bug 39282: Clarify use of budget codes and ids > >When getting items from the form on addorderis2907.pl we are getting actual budget id's, >we only deal with codes when fetching the values from the MARC. >The code here assigns an id into a variable called code - this patch clarifies that and >ensures that we fallback to using the id if one has been passed from the interface form > >To test: >0 - Apply first two patches >1 - prove -v t/db_dependent/Koha/MarcOrders.t >2 - It fails >3 - Apply this patch >4 - It fails? >--- > Koha/MarcOrder.pm | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/Koha/MarcOrder.pm b/Koha/MarcOrder.pm >index 10379d9cf8d..583ad9fffae 100644 >--- a/Koha/MarcOrder.pm >+++ b/Koha/MarcOrder.pm >@@ -868,7 +868,7 @@ sub parse_input_into_order_line_fields { > my @budget_codes = $fields->{budget_codes} ? @{ $fields->{budget_codes} } : (); > my $c_quantity = $fields->{c_quantity}; > my $c_budget = GetBudgetByCode( $fields->{c_budget_code} ); >- my $c_budget_code = $c_budget->{budget_id}; >+ my $c_budget_id = $c_budget->{budget_id} || $fields->{c_budget_id}; > my $c_discount = $fields->{c_discount}; > my $c_sort1 = $fields->{c_sort1}; > my $c_sort2 = $fields->{c_sort2}; >@@ -878,9 +878,8 @@ sub parse_input_into_order_line_fields { > # If using the cronjob, we want to default to the account budget if not mapped on the record > if ( !$client && ( !@budget_codes || scalar(@budget_codes) == 0 ) ) { > for ( 1 .. $quantity ) { >- my $item_budget = GetBudgetByCode($c_budget_code); >- if ($item_budget) { >- push( @budget_codes, $item_budget->{budget_id} ); >+ if ($c_budget_id) { >+ push( @budget_codes, $c_budget_id ); > } else { > push( @budget_codes, $budget_id ); > } >@@ -911,7 +910,7 @@ sub parse_input_into_order_line_fields { > basket_id => $basket_id, > budget_id => $budget_id, > c_quantity => $c_quantity, >- c_budget_code => $c_budget_code, >+ c_budget_id => $c_budget_id, > c_discount => $c_discount, > c_sort1 => $c_sort1, > c_sort2 => $c_sort2, >@@ -1062,7 +1061,7 @@ sub create_items_and_generate_order_hash { > basketno => $basket_id, > quantity => $fields->{c_quantity}, > branchcode => C4::Context->userenv()->{'branch'}, >- budget_id => $fields->{c_budget_code}, >+ budget_id => $fields->{c_budget_id}, > uncertainprice => 1, > sort1 => $fields->{c_sort1}, > sort2 => $fields->{c_sort2}, >-- >2.39.5
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