Bug 20426

Summary: Can't import all titles from a stage file with default values
Product: Koha Reporter: Koha Team University Lyon 3 <koha>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: critical    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, katrin.fischer, koha, nick, sandboxes
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19453    
Bug Blocks:    
Attachments: Bug 20426: Fix default fund value when adding orders from iso2709 file
Bug 20426: Fix default fund value when adding orders from iso2709 file
Bug 20426: Fix default fund value when adding orders from iso2709 file

Description Koha Team University Lyon 3 2018-03-15 14:51:48 UTC
When you import staged file for an order, you could have a lot of title in a file and you need to use default "item information" and default "Default accounting details" to choose budget and item informations.
I try to import with this default information and I have an error message : 'Some budgets are not defined in item records'
We use this every day in my university and we really need this.

Sonia
Comment 1 Jonathan Druart 2018-03-26 15:14:05 UTC
Hi Sonia, you need to select a fund in the "Default accounting details" tab or "Select to import" (one for each record to import).
Comment 2 Katrin Fischer 2018-03-31 23:24:32 UTC
We tested this at the hackfest and selecting the fund on the default accounting details should work - otherwise it would have no function. Sonia also said that they used the feature a lot and it used to work like that.
Comment 3 Jonathan Druart 2018-04-02 15:57:23 UTC
Ha, I think I found the problem.

It has been caused by
  commit b830349f45007629f141a9835e05b95f90ee4b92
  Bug 19453: Incorrect jQuery selector for fund drop down validation
Comment 4 Jonathan Druart 2018-04-02 16:04:13 UTC
Created attachment 73530 [details] [review]
Bug 20426: Fix default fund value when adding orders from iso2709 file

A new bug has been highlighted since:
  commit b830349f45007629f141a9835e05b95f90ee4b92
  Bug 19453: Incorrect jQuery selector for fund drop down validation

Prior to bug 19453 the check on the existence of the fund did not work
as expected, no select with name='budget_code' existed and the error was
never raised.
Now it works but expect a fund to be selected for every record to
import.
This check must only be done if there is no default value selected.

Test plan:
- Create an order from a staged file
- Do not select any funds
=> You must get a warning
- Select a specific fund for some of the records
=> You must get a warning
- Select a default fund in the last tab
=> You must not get a warning and the records must be imported and
inserted with the correct fund
Comment 5 sandboxes@biblibre.com 2018-04-10 15:43:11 UTC
Patch tested with a sandbox, by Sonia Bouis <sonia.bouis@univ-lyon3.fr>
Comment 6 sandboxes@biblibre.com 2018-04-10 15:43:32 UTC
Created attachment 73956 [details] [review]
Bug 20426: Fix default fund value when adding orders from iso2709 file

A new bug has been highlighted since:
  commit b830349f45007629f141a9835e05b95f90ee4b92
  Bug 19453: Incorrect jQuery selector for fund drop down validation

Prior to bug 19453 the check on the existence of the fund did not work
as expected, no select with name='budget_code' existed and the error was
never raised.
Now it works but expect a fund to be selected for every record to
import.
This check must only be done if there is no default value selected.

Test plan:
- Create an order from a staged file
- Do not select any funds
=> You must get a warning
- Select a specific fund for some of the records
=> You must get a warning
- Select a default fund in the last tab
=> You must not get a warning and the records must be imported and
inserted with the correct fund

Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr>
Comment 7 Koha Team University Lyon 3 2018-04-10 15:57:35 UTC
I've followed the test plan and every was as expected :

- I didn't define any fund on the first tab and on the third tab : I had a warning : "Some budgets are not defined in item records"
- I defined only some funds in the first tab : I had a warning : "Some budgets are not defined in item records"
- I defined a fund in the third tab : all my orders are imported in the right fund
Comment 8 Katrin Fischer 2018-04-12 09:55:15 UTC
Thx Sonia!
Comment 9 Katrin Fischer 2018-04-12 09:56:23 UTC
Created attachment 74064 [details] [review]
Bug 20426: Fix default fund value when adding orders from iso2709 file

A new bug has been highlighted since:
  commit b830349f45007629f141a9835e05b95f90ee4b92
  Bug 19453: Incorrect jQuery selector for fund drop down validation

Prior to bug 19453 the check on the existence of the fund did not work
as expected, no select with name='budget_code' existed and the error was
never raised.
Now it works but expect a fund to be selected for every record to
import.
This check must only be done if there is no default value selected.

Test plan:
- Create an order from a staged file
- Do not select any funds
=> You must get a warning
- Select a specific fund for some of the records
=> You must get a warning
- Select a default fund in the last tab
=> You must not get a warning and the records must be imported and
inserted with the correct fund

Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Jonathan Druart 2018-04-12 15:06:10 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 11 Nick Clemens 2018-05-14 21:02:17 UTC
Pushed to stbale for 17.11.06

Awesome work all!
Comment 12 Fridolin SOMERS 2018-05-22 11:07:12 UTC
Depends on Bug 19453 not in 17.05.x