Bug 20830 - Make sure a fund is selected when ordering from staged file
Summary: Make sure a fund is selected when ordering from staged file
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Koha Team University Lyon 3
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 22802
  Show dependency treegraph
 
Reported: 2018-05-28 21:39 UTC by Katrin Fischer
Modified: 2020-06-04 20:32 UTC (History)
8 users (show)

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


Attachments
bug 20830: Make sure a fund is selected when ordering from staged file (1.29 KB, patch)
2019-03-01 17:09 UTC, Koha Team University Lyon 3
Details | Diff | Splinter Review
Bug 20830 : Make sure a fund is selected (master) (1.15 KB, patch)
2019-03-11 14:06 UTC, Koha Team University Lyon 3
Details | Diff | Splinter Review
Bug 20830: Make sure a fund is selected when ordering from a stage file (1.30 KB, patch)
2019-04-01 15:19 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 20830: Make sure a fund is selected when ordering from a stage file (1.36 KB, patch)
2019-04-14 22:32 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 Katrin Fischer 2018-05-28 21:39:33 UTC
When selecting orders from a staged file, we should check that a fund is set.

- We only want to check entries that have been selected for order (checkbox)
- We only want to complain, when the fund entry on the selected entry is empty
  and there is also no default fund set on the accounting details tab
Comment 1 Katrin Fischer 2018-05-28 21:41:07 UTC
- MarcItemFieldsToOrder also needs to be taken into account
Comment 2 Kyle M Hall 2018-05-29 10:47:04 UTC
So basically, we need to check, in order that
a) All checked records with MarcItemFieldsToOrder have a fund selected, OR
b) All checked records have a fund selected, OR
c) The account tab has a fund selected

We also know that C will cascade to B, but does C *or* B cascade to A? If not, I imagine it should! To do otherwise seems like it would be counter-intuitive to librarians.
Comment 3 Koha Team University Lyon 3 2019-02-25 16:22:50 UTC
Hello,
In our Koha (17.11.13 where BZ20798 is applied), we have seen that if no fund is selected when ordering from staged file, it 's fund from inactive budget that are choosen and saved in the order. It's really a big problem.

To reply to Kyle :
- If MarcItemFieldsToOrder is set and there's a fund found, it will be automatically selected in /cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=xxx (I've just tested it on a master version). So, I don't think we  need the A step.

I don't know how Koha choose the fund to save if there a fund in the "select to import" tab and an another in "Default accounting details". In my opinion, it's the "Default accounting details" that should be taken in account if it's filled.

Sonia
Comment 4 Koha Team University Lyon 3 2019-03-01 17:09:53 UTC
Created attachment 85911 [details] [review]
bug 20830: Make sure a fund is selected when ordering from staged file

I simply took again bug 20798 code with a little modification to set the checking only on selected items of "Select to import" tab. Seems to do the trick (patch done on version 17.11.13).

Test Plan:
1) Add records to a basket from an import batch
2) Select only some of those items in the batch and don't select any fund for them.
3) Save : you get the message "Some budgets are no defined .."
4) Apply this patch
5) Select some items and choose a fund for each of them
6) Save : no more message.

Olivier Crouzet
Comment 5 Koha Team University Lyon 3 2019-03-04 14:56:45 UTC
More precise Test :
1) Add records to a basket from an import batch
2) Select only some of those items in the batch and don't select any fund for them.
3) Save : you get the message "Some budgets are no defined .."
4) Select a fund for each of them
5) click on Save again : you still get the message "Some budgets are no defined .."
6) Apply this patch
7) Redo steps 2,3 and 4 
8) Click on Save again : no more message;. The records are imported.


Olivier Crouzet
Comment 6 Pierre-Marc Thibault 2019-03-08 19:47:24 UTC
When I try to apply, I have this error message :

Applying: Bug 20830: Make sure a fund is selected when ordering from staged file
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
error: Failed to merge in the changes.
Comment 7 Koha Team University Lyon 3 2019-03-11 14:06:37 UTC
Created attachment 86455 [details] [review]
Bug 20830 : Make sure a fund is selected (master)

patch done for master. previous one apply to 17.11.13
Comment 8 Martin Renvoize 2019-04-01 15:19:47 UTC
Created attachment 87285 [details] [review]
Bug 20830: Make sure a fund is selected when ordering from a stage file

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2019-04-01 15:21:41 UTC
Swapped tabs for spaces to keep the QA script happy.

Tested and works as expected, though perhaps we should also be validating we're getting good data on the serverside too.. I didn't check if this was already the case.

Signing off.
Comment 10 Chris Cormack 2019-04-14 22:32:52 UTC
Created attachment 87967 [details] [review]
Bug 20830: Make sure a fund is selected when ordering from a stage file

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Comment 11 Nick Clemens 2019-04-16 13:23:06 UTC
Awesome work all!

Pushed to master for 19.05
Comment 12 Martin Renvoize 2019-04-25 13:24:25 UTC
Pushed to 18.11.x for 18.11.05
Comment 13 Lucas Gass 2019-04-26 15:52:33 UTC
not backporting to 18.05.x . Needs rebase