Bug 20014 - When adding to basket from a staged file item budgets are selected by matching on code, not id
Summary: When adding to basket from a staged file item budgets are selected by matchin...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
: 12652 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-17 19:52 UTC by Nick Clemens
Modified: 2020-01-06 20:14 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 20014: Preselect item budget based on id not code (3.51 KB, patch)
2018-01-17 19:55 UTC, Nick Clemens
Details | Diff | Splinter Review
Budget setup (54.04 KB, image/png)
2018-06-16 02:43 UTC, Nick Clemens
Details
View of double selected elements on adding to basket (126.27 KB, image/png)
2018-06-16 02:44 UTC, Nick Clemens
Details
Example marc file for staging (1.38 KB, application/x-wine-extension-mrc)
2018-06-16 02:45 UTC, Nick Clemens
Details
Bug 20014: Preselect item budget based on id not code (3.42 KB, patch)
2018-08-16 05:51 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 20014: Preselect item budget based on id not code (3.53 KB, patch)
2018-08-21 10:08 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2018-01-17 19:52:42 UTC
Budget codes are not unique (duplicated on rollover) currently if you have two codes two will be marked selected
Comment 1 Nick Clemens 2018-01-17 19:55:34 UTC
Created attachment 70638 [details] [review]
Bug 20014: Preselect item budget based on id not code

To test:
1 - Have the same fund code in two budgets
2 - Have budget code defined in MarcItemFieldsToOrder
3 - Stage a file with some order items as defined above
4 - Inspect the fuinds drop down in the item, notice two lines are
marked selected
5 - Apply patch
6 - Repeat
7 - Only one field should be selected, with a preference for active
budget
Comment 2 Zoe Bennett 2018-01-18 02:44:42 UTC
We couldn't reproduce the bug we have tried putting two funds with the same code in one budget and two funds with the same code in two separate budgets and both times nothing was selected in the drop down.
Comment 3 Nick Clemens 2018-01-22 15:55:02 UTC
Retested on master, I can recreate:

Setup a budget with some funds
Duplicate the budget,make one of them inactive

MarcFieldsToOrder:
price: 975$p
quantity: 975$q
budget_code: 975$h

MarcItemFieldsToOrder:
homebranch: 975$a
holdingbranch: 975$b
itype: 975$y
nonpublic_note: 975$x
public_note: 975$z
loc: 975$c
ccode: 975$8
notforloan: 975$7
quantity: 975$q
price: 975$g
replacementprice: 975$v
uri: 975$u

975 from record:
=975  \\$7-1$8b$cO$g8.90$hSHOES$p8.90$q1$u14.95$v14.95$yBOOK 

You will need to adjust subfield $h to the name of on of your funds that is duplicated
Comment 4 Charles Farmer 2018-06-15 20:14:37 UTC
> 975 from record:
> =975  \\$7-1$8b$cO$g8.90$hSHOES$p8.90$q1$u14.95$v14.95$yBOOK 
> 
> You will need to adjust subfield $h to the name of on of your funds that is
> duplicated

This will definitely have to be rephrased, because like Zoe Bennett, I couldn't reproduce the issue.

I did as you said, created two budgets, with one fund that had the same code, and yet, when I used the staged file to add items to a new basket, there was only one budget name in the dropdown menu.
Comment 5 Nick Clemens 2018-06-16 02:43:19 UTC
Created attachment 76113 [details]
Budget setup

Example budgets/funds to illustrate issues
Comment 6 Nick Clemens 2018-06-16 02:44:13 UTC
Created attachment 76114 [details]
View of double selected elements on adding to basket

View of the issue when adding from staged to basket
Comment 7 Nick Clemens 2018-06-16 02:45:04 UTC
Created attachment 76115 [details]
Example marc file for staging
Comment 8 Nick Clemens 2018-06-16 02:48:18 UTC
(In reply to Charles Farmer from comment #4)
> > 975 from record:
> > =975  \\$7-1$8b$cO$g8.90$hSHOES$p8.90$q1$u14.95$v14.95$yBOOK 
> > 
> > You will need to adjust subfield $h to the name of on of your funds that is
> > duplicated
> 
> This will definitely have to be rephrased, because like Zoe Bennett, I
> couldn't reproduce the issue.
> 
> I did as you said, created two budgets, with one fund that had the same
> code, and yet, when I used the staged file to add items to a new basket,
> there was only one budget name in the dropdown menu.

I added an example file and screenshots, I changed the fund name to show that both are selected, the problem persists if the names are the same or different
Comment 9 Katrin Fischer 2018-08-16 05:49:09 UTC
If I am not mistaken it will use the last added fund from an active budget when you have multiple active budgets with the same fund codes. This might still cause a surprise for people with a strange budget/fund creation history, but I don't see a better way to pick 'one' fund.
Comment 10 Katrin Fischer 2018-08-16 05:50:33 UTC
Wish our code was less confusing - budget should be fund.
Comment 11 Katrin Fischer 2018-08-16 05:51:40 UTC
Created attachment 77872 [details] [review]
Bug 20014: Preselect item budget based on id not code

To test:
1 - Have the same fund code in two budgets
2 - Have budget code defined in MarcItemFieldsToOrder
3 - Stage a file with some order items as defined above
4 - Inspect the fuinds drop down in the item, notice two lines are
marked selected
5 - Apply patch
6 - Repeat
7 - Only one field should be selected, with a preference for active
budget

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Chris Cormack 2018-08-21 10:08:29 UTC
Created attachment 78039 [details] [review]
Bug 20014: Preselect item budget based on id not code

To test:
1 - Have the same fund code in two budgets
2 - Have budget code defined in MarcItemFieldsToOrder
3 - Stage a file with some order items as defined above
4 - Inspect the fuinds drop down in the item, notice two lines are
marked selected
5 - Apply patch
6 - Repeat
7 - Only one field should be selected, with a preference for active
budget

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 13 Nick Clemens 2018-08-21 13:55:10 UTC
Awesome work all!

Pushed to master for 18.11
Comment 14 Martin Renvoize 2018-08-24 09:57:37 UTC
Pushed to 18.05.x for 18.05.03
Comment 15 Fridolin Somers 2018-08-28 12:56:59 UTC
Pushed to 17.11.x for 17.11.09
Comment 16 Fridolin Somers 2018-09-24 12:52:13 UTC
Pushed to 17.05.x for 17.05.14
Comment 17 Katrin Fischer 2019-02-04 22:42:15 UTC
*** Bug 12652 has been marked as a duplicate of this bug. ***