Bug 24370

Summary: Editing purchase suggestion changes the acquisition library to logged-in user's
Product: Koha Reporter: Lisette Scheer <lisettepalouse+koha>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart+koha>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: bugzilla, david, dch, jonathan.druart+koha, jzairo, katrin.fischer, kyle, lisettepalouse+koha, martin.renvoize, maura.stephens, mfuerst
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00
Bug Depends on: 25033    
Bug Blocks:    
Attachments: Bug 24370: Don't reset library when editing a suggestion
Bug 24370: Don't reset library when editing a suggestion
Bug 24370: (follow-up) Allow resetting library to ANY
Bug 24370: Don't reset library when editing a suggestion
Bug 24370: (follow-up) Allow resetting library to ANY
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing
Bug 24370: Allow resetting library to ANY
Bug 24370: Don't reset library when editing a suggestion
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing
Bug 24370: Allow resetting library to ANY
Bug 24370: Don't reset library when editing a suggestion
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing
Bug 24370: Allow resetting library to ANY

Description Lisette Scheer 2020-01-07 17:42:08 UTC
Editing a suggestion changes the Acquisition Library to be the user's logged in branch. 
As a multi-branch system, we'd like to be able to edit and keep that information. 
This helps us track requests and spending from different branches. 

The branch is only changed on edit, not when batch changing statuses. 

Lisette
Comment 1 koha-US bug tracker 2020-03-11 16:00:57 UTC
This could be a big problem for a couple of our libraries.
Comment 2 Katrin Fischer 2020-04-29 06:46:47 UTC
I am updating severity as I view this as a data loss bug - it will be hard to figure out what happened there and there is no way to restore the old library from the data we have.
Comment 3 Maura Stephens 2020-10-14 11:03:43 UTC
This has serious implications for us. I thought it was part of the 19.11 upgrade but maybe no. One branch here places orders for 2 campus libraries and this has added to the frustrations of library staff.
Comment 4 Katrin Fischer 2020-10-16 00:30:24 UTC
Created attachment 111821 [details] [review]
Bug 24370: Don't reset library when editing a suggestion

When editing a suggestion, the library will be reset to the currently
logged in librarian's homebranch, no matter what the libray was before.

This fixes this, the library selection will remain at the db value when
edited.

To test:
- Create a suggestion with Any library.
- Edit the suggestion - it will show your homebranch as library
- Change to any library but your homebranch
- The summary should show the correct value after saving
- Edit the suggestoin again - it's set back to your homebranch again
- Apply patch
- Repeat the steps, the pull down should now show the correct library
  at all times.

Caveat: I think there is a somewhat separate issue/bug in that once a library
was saved, you cannot switch back to "Any". I haven't been able to fix this and
suggest to maybe file a separate bug.
Comment 5 Séverine Queune 2020-10-20 06:47:05 UTC
Created attachment 112017 [details] [review]
Bug 24370: Don't reset library when editing a suggestion

When editing a suggestion, the library will be reset to the currently
logged in librarian's homebranch, no matter what the libray was before.

This fixes this, the library selection will remain at the db value when
edited.

To test:
- Create a suggestion with Any library.
- Edit the suggestion - it will show your homebranch as library
- Change to any library but your homebranch
- The summary should show the correct value after saving
- Edit the suggestoin again - it's set back to your homebranch again
- Apply patch
- Repeat the steps, the pull down should now show the correct library
  at all times.

Caveat: I think there is a somewhat separate issue/bug in that once a library
was saved, you cannot switch back to "Any". I haven't been able to fix this and
suggest to maybe file a separate bug.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 6 Martin Renvoize 2020-10-20 14:53:21 UTC
Created attachment 112044 [details] [review]
Bug 24370: (follow-up) Allow resetting library to ANY

This patch updates ModSuggestion to reset branchcode to null if passed
an empty string.
Comment 7 Nick Clemens 2020-10-20 18:25:07 UTC
Created attachment 112071 [details] [review]
Bug 24370: Don't reset library when editing a suggestion

When editing a suggestion, the library will be reset to the currently
logged in librarian's homebranch, no matter what the libray was before.

This fixes this, the library selection will remain at the db value when
edited.

To test:
- Create a suggestion with Any library.
- Edit the suggestion - it will show your homebranch as library
- Change to any library but your homebranch
- The summary should show the correct value after saving
- Edit the suggestoin again - it's set back to your homebranch again
- Apply patch
- Repeat the steps, the pull down should now show the correct library
  at all times.

Caveat: I think there is a somewhat separate issue/bug in that once a library
was saved, you cannot switch back to "Any". I haven't been able to fix this and
suggest to maybe file a separate bug.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens 2020-10-20 18:25:12 UTC
Created attachment 112072 [details] [review]
Bug 24370: (follow-up) Allow resetting library to ANY

This patch updates ModSuggestion to reset branchcode to null if passed
an empty string.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens 2020-10-20 18:25:20 UTC
Created attachment 112073 [details] [review]
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing

It looks like this problem was caused by code from bug 25033, we were attempting to have the
dropdown either be the current branch filter, or the suggestion's branch code, but the variables here are confusing and it didn't work

This explicitly sets the branchcode when creating a new suggestion to allow fixing current behaviour and
show the correct value when creating new

To test:
1 - Be signed in as branch A
2 - Browse to suggestions and limit to branch "Any"
3 - Click 'New suggestion"
4 - Defaults to Any
5 - Cancel and limit to branch B
6 - New suggestion defaults to branch B

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Jonathan Druart 2020-10-22 08:04:14 UTC
(In reply to Nick Clemens from comment #8)
> Created attachment 112072 [details] [review] [review]
> Bug 24370: (follow-up) Allow resetting library to ANY
> 
> This patch updates ModSuggestion to reset branchcode to null if passed
> an empty string.
> 
> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Should this change really be in the module? I have the feeling it must stay in the controller.

Otherwise, we need a test :)
Comment 11 Martin Renvoize 2021-03-30 15:18:26 UTC
Still on the case here Nick?
Comment 12 Martha Fuerst 2021-04-15 19:26:56 UTC
I'm here to make noise too! Our Tech Services staff (Downtown) as well as our selectors (all over) all manage suggestions. This really needs to be adjusted to default to the patron's specification as opposed to automatically updating to the logged-in user's library.

Thanks!

-Marti Fuerst, HMCPL
Comment 13 Katrin Fischer 2021-06-04 10:22:35 UTC
Confirmed, this is still an issue on master :(
Comment 14 Katrin Fischer 2021-08-23 21:50:15 UTC
I think I need someone else to finish this one off here :(
Comment 15 Katrin Fischer 2021-08-23 21:52:12 UTC
Can confirm this to still be an issue on master.
Comment 16 Jonathan Druart 2021-08-25 11:57:34 UTC
Created attachment 124085 [details] [review]
Bug 24370: Allow resetting library to ANY
Comment 17 Jonathan Druart 2021-08-25 11:58:35 UTC
Last patch moved code to the controller and obsolete the other patch.
Comment 18 David Nind 2021-10-05 08:36:28 UTC
Patch no longer applies 8-(..

Applying: Bug 24370: Don't reset library when editing a suggestion
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
error: Failed to merge in the changes.
Patch failed at 0001 Bug 24370: Don't reset library when editing a suggestion
Comment 19 Jonathan Druart 2021-10-07 09:56:08 UTC
Created attachment 125866 [details] [review]
Bug 24370: Don't reset library when editing a suggestion

When editing a suggestion, the library will be reset to the currently
logged in librarian's homebranch, no matter what the libray was before.

This fixes this, the library selection will remain at the db value when
edited.

To test:
- Create a suggestion with Any library.
- Edit the suggestion - it will show your homebranch as library
- Change to any library but your homebranch
- The summary should show the correct value after saving
- Edit the suggestoin again - it's set back to your homebranch again
- Apply patch
- Repeat the steps, the pull down should now show the correct library
  at all times.

Caveat: I think there is a somewhat separate issue/bug in that once a library
was saved, you cannot switch back to "Any". I haven't been able to fix this and
suggest to maybe file a separate bug.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 20 Jonathan Druart 2021-10-07 09:56:13 UTC
Created attachment 125867 [details] [review]
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing

It looks like this problem was caused by code from bug 25033, we were attempting to have the
dropdown either be the current branch filter, or the suggestion's branch code, but the variables here are confusing and it didn't work

This explicitly sets the branchcode when creating a new suggestion to allow fixing current behaviour and
show the correct value when creating new

To test:
1 - Be signed in as branch A
2 - Browse to suggestions and limit to branch "Any"
3 - Click 'New suggestion"
4 - Defaults to Any
5 - Cancel and limit to branch B
6 - New suggestion defaults to branch B

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 21 Jonathan Druart 2021-10-07 09:56:17 UTC
Created attachment 125868 [details] [review]
Bug 24370: Allow resetting library to ANY
Comment 22 Martin Renvoize 2021-11-01 16:43:01 UTC
Created attachment 127181 [details] [review]
Bug 24370: Don't reset library when editing a suggestion

When editing a suggestion, the library will be reset to the currently
logged in librarian's homebranch, no matter what the libray was before.

This fixes this, the library selection will remain at the db value when
edited.

To test:
- Create a suggestion with Any library.
- Edit the suggestion - it will show your homebranch as library
- Change to any library but your homebranch
- The summary should show the correct value after saving
- Edit the suggestoin again - it's set back to your homebranch again
- Apply patch
- Repeat the steps, the pull down should now show the correct library
  at all times.

Caveat: I think there is a somewhat separate issue/bug in that once a library
was saved, you cannot switch back to "Any". I haven't been able to fix this and
suggest to maybe file a separate bug.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize 2021-11-01 16:43:05 UTC
Created attachment 127182 [details] [review]
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing

It looks like this problem was caused by code from bug 25033, we were attempting to have the
dropdown either be the current branch filter, or the suggestion's branch code, but the variables here are confusing and it didn't work

This explicitly sets the branchcode when creating a new suggestion to allow fixing current behaviour and
show the correct value when creating new

To test:
1 - Be signed in as branch A
2 - Browse to suggestions and limit to branch "Any"
3 - Click 'New suggestion"
4 - Defaults to Any
5 - Cancel and limit to branch B
6 - New suggestion defaults to branch B

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 24 Martin Renvoize 2021-11-01 16:43:10 UTC
Created attachment 127183 [details] [review]
Bug 24370: Allow resetting library to ANY

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Martin Renvoize 2021-11-01 16:43:48 UTC
Patches are clear as a set, code works as expected during testing, QA script is happy..

Passing QA here.
Comment 26 Jonathan Druart 2021-11-02 15:52:40 UTC
Pushed to master for 21.11, thanks to everybody involved!