Skip to content

Commit

Permalink
CUYAHOGA - Fetch budget id from code and usewhen creating orders
Browse files Browse the repository at this point in the history
So the previous patch was wrong because we were passing the 'code' forward
but an 'id' is needed for orders

This patch makes sure we fetch the budget and get the id from the code in the marc
when we aren't using MarcItemFieldsToOrder but only MarcFields to order (i.e. Cuyahoga setup)
  • Loading branch information
kidclamp committed Jul 3, 2024
1 parent c0eeab3 commit 2c0fca3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Koha/MarcOrder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ sub parse_input_into_order_line_fields {
basket_id => $basket_id,
budget_id => $budget_id,
c_quantity => $fields->{c_quantity},
c_budget_id => $fields->{c_budget_code},
c_budget_id => $fields->{c_budget_id},
c_discount => $fields->{c_discount},
c_sort1 => $fields->{c_sort1},
c_sort2 => $fields->{c_sort2},
Expand Down Expand Up @@ -1270,6 +1270,9 @@ sub _create_item_fields_from_syspref {
}
}

my $order_budget = GetBudgetByCode($marc_fields_to_order->{budget_code});
my $order_budget_id = $order_budget ? $order_budget->{budget_id} : $budget_id;

my $item_fields = {
quantity => scalar(@homebranches),
homebranches => \@homebranches,
Expand All @@ -1288,6 +1291,7 @@ sub _create_item_fields_from_syspref {
itemcallnumbers => \@itemcallnumbers,
c_quantity => $marc_fields_to_order->{quantity},
c_budget_code => $marc_fields_to_order->{budget_code},
c_budget_id => $order_budget_id,
c_price => $marc_fields_to_order->{price},
c_discount => $marc_fields_to_order->{discount},
c_sort1 => $marc_fields_to_order->{sort1},
Expand Down

0 comments on commit 2c0fca3

Please sign in to comment.