Bug 39282: Clarify use of budget codes and ids
When getting items from the form on addorderiso2709.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? Signed-off-by: John Vinke <jvinke@austinseminary.edu> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
5034c27628
commit
fd609d9bb3
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Reference in New Issue