Bugzilla – Attachment 119467 Details for
Bug 23195
Shipping costs are inconsistent in where displayed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23195: Always count shipping costs as 'spent'
Bug-23195-Always-count-shipping-costs-as-spent.patch (text/plain), 4.12 KB, created by
Nick Clemens (kidclamp)
on 2021-04-12 18:20:01 UTC
(
hide
)
Description:
Bug 23195: Always count shipping costs as 'spent'
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-04-12 18:20:01 UTC
Size:
4.12 KB
patch
obsolete
>From 308f5aa84ae5cb0b051771784b212dbaa087b65c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 12 Apr 2021 18:13:47 +0000 >Subject: [PATCH] Bug 23195: Always count shipping costs as 'spent' > >As shipping costs are created when an invoice is created, and creation >of an invoice implies that items have been received, the shipment costs >are always assumed to be 'spent' > >This logic is true in GetBudgetSpent/GetBudgetOrdered, however, GetBudgetHierarchy >treats open invoices shipping costs as 'ordered' and closed invoice shipping costs >as 'spent' > >This leads to inconsistencies in acqui-home vs spent.pl and ordered.pl > >To test: > 1 - Find a vendor > 2 - Click 'Receive shipments' > 3 - Create a new invoice with a shipping cost on budget A > 4 - Repeate and create a new invoice with a shipping cost on budget B > 5 - Close the second invoice > 6 - View acquisitions ome > 7 - Note budget A includes the shipping under ordered > 8 - Note budget B includes the shipping under spent > 9 - Click the 'ordered' column on budget A - no shipping is listed on ordered page >10 - Click the spent column on budget A - the shipping is listed here >11 - Apply patch >12 - Both budgets list the shipping as 'spent' >13 - Both 'spent' pages include the shipping >14 - Neither 'ordered' page includes shipping >--- > C4/Budgets.pm | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 16eb5a22a0..b55cd06b11 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -563,14 +563,6 @@ sub GetBudgetHierarchy { > SELECT shipmentcost_budgetid as budget_id, > SUM(shipmentcost) as shipmentcost > FROM aqinvoices >- WHERE closedate IS NOT NULL >- GROUP BY shipmentcost_budgetid >- |, 'budget_id'); >- my $hr_budget_ordered_shipment = $dbh->selectall_hashref(q| >- SELECT shipmentcost_budgetid as budget_id, >- SUM(shipmentcost) as shipmentcost >- FROM aqinvoices >- WHERE closedate IS NULL > GROUP BY shipmentcost_budgetid > |, 'budget_id'); > my $hr_budget_spent_adjustment = $dbh->selectall_hashref(q| >@@ -593,24 +585,23 @@ sub GetBudgetHierarchy { > > foreach my $budget (@sort) { > if ( not defined $budget->{budget_parent_id} ) { >- _recursiveAdd( $budget, undef, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_ordered_shipment, $hr_budget_spent_adjustment, $hr_budget_ordered_adjustment ); >+ _recursiveAdd( $budget, undef, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_spent_adjustment, $hr_budget_ordered_adjustment ); > } > } > return \@sort; > } > > sub _recursiveAdd { >- my ($budget, $parent, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_ordered_shipment, $hr_budget_spent_adjustment, $hr_budget_ordered_adjustment ) = @_; >+ my ($budget, $parent, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_spent_adjustment, $hr_budget_ordered_adjustment ) = @_; > > foreach my $child (@{$budget->{children}}){ >- _recursiveAdd($child, $budget, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_ordered_shipment, $hr_budget_spent_adjustment, $hr_budget_ordered_adjustment ); >+ _recursiveAdd($child, $budget, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_spent_adjustment, $hr_budget_ordered_adjustment ); > } > > $budget->{budget_spent} += $hr_budget_spent->{$budget->{budget_id}}->{budget_spent} || 0; > $budget->{budget_spent} += $hr_budget_spent_shipment->{$budget->{budget_id}}->{shipmentcost} || 0; > $budget->{budget_spent} += $hr_budget_spent_adjustment->{$budget->{budget_id}}->{adjustments} || 0; > $budget->{budget_ordered} += $hr_budget_ordered->{$budget->{budget_id}}->{budget_ordered} || 0; >- $budget->{budget_ordered} += $hr_budget_ordered_shipment->{$budget->{budget_id}}->{shipmentcost} || 0; > $budget->{budget_ordered} += $hr_budget_ordered_adjustment->{$budget->{budget_id}}->{adjustments} || 0; > > $budget->{total_spent} += $budget->{budget_spent}; >-- >2.11.0
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 23195
:
119466
|
119467
|
119542
|
119543
|
119797
|
119798
|
119941