X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;ds=sidebyside;f=acqui%2Faddorder.pl;h=25fd4b3109dc00cc8566e7f937ce74214301de26;hb=28c9f9e1aa526229159480944035b24665016e9a;hp=98e3acbe6d4d9e493be8b8da53fbe40b9bfacbe5;hpb=0a45ffba65e02aad42484845ea7c493fe9d69a2f;p=koha-ffzg.git diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 98e3acbe6d..25fd4b3109 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -155,6 +155,14 @@ unless($confirm_budget_exceeding) { my $budget = GetBudget($budget_id); my $budget_spent = GetBudgetSpent($budget_id); my $budget_ordered = GetBudgetOrdered($budget_id); + + my $ordernumber = $input->param('ordernumber'); + if ( $ordernumber ) { + # modifying an existing order so remove order price from $budget_ordered + my $order = Koha::Acquisition::Orders->find($ordernumber); + $budget_ordered = $budget_ordered - ( $order->ecost_tax_included * $order->quantity ); + } + my $budget_used = $budget_spent + $budget_ordered; my $budget_remaining = $budget->{budget_amount} - $budget_used; my $budget_encumbrance = $budget->{budget_amount} * $budget->{budget_encumb} / 100; @@ -182,7 +190,7 @@ unless($confirm_budget_exceeding) { foreach (keys %$vars) { push @vars_loop, { name => $_, - values => [$input->param($_)], + values => [ $input->multi_param($_) ], }; } @@ -250,6 +258,7 @@ my $orderinfo = { sort1 => scalar $input->param('sort1'), sort2 => scalar $input->param('sort2'), subscriptionid => scalar $input->param('subscriptionid'), + estimated_delivery_date => scalar $input->param('estimated_delivery_date'), }; $orderinfo->{uncertainprice} ||= 0; @@ -327,7 +336,6 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { } $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq ''; - $orderinfo->{estimated_delivery_date} = $orderinfo->{estimated_delivery_date} ? dt_from_string($orderinfo->{estimated_delivery_date}) : undef; my $order; my $log_action_name;