Bug 10449

Summary: Suggestions pending approval should count only suggestions of current branch
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: AcquisitionsAssignee: Fridolin Somers <fridolin.somers>
Status: RESOLVED DUPLICATE QA Contact:
Severity: minor    
Priority: P5 - low CC: jonathan.druart, katrin.fischer, lisettepalouse+koha, m.de.rooy, magnus, marjorie.barry-vila, p.thrasher, patrick.robitaille, sophie.meynieux
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10753
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8147
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14958
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18743
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 10753    
Bug Blocks:    
Attachments: Proposed patch
Bug 10449 - Suggestions pending approval should count only suggestions of current branch
Bug 10449 - Count suggestions without branch also

Description Fridolin Somers 2013-06-12 12:14:41 UTC
In intranet main page and acquisition home page, a text can display the number of suggestions pending for approval. When clicking on this like, the suggestions management page is displayed. In this page, by default, only the suggestions of current branch are visible.
The "Suggestions pending approval" should count only suggestions of current branch so that when clicking on link, you see the same count in "Pending" tab.
Comment 1 Fridolin Somers 2013-06-12 12:22:31 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2013-06-14 11:25:07 UTC
Created attachment 18985 [details] [review]
Bug 10449 - Suggestions pending approval should count only suggestions of current branch

In intranet main page and acquisition home page, a text can display the number of suggestions pending for approval. When clicking on this like, the suggestions management page is displayed. In this page, by default, only the suggestions of current branch are visible.

This patch modifies "Suggestions pending approval" count so that when clicking on link, you see the same count in "Pending" tab.

Test plan :
- Create pending suggestions in several branches
- Connect with user in koha-conf.xml to have no selected branch (you see NO LIBRARY SET)
- On main page, look at "Suggestions pending approval"
- Click on this link
- In suggestions management page, click on "Go" near "Status"
=> You see the same count in "Pending" tab
- Come back to main page
- Select a branch (with pending suggestions)
- On main page, look at "Suggestions pending approval"
- Click on this link
=> You see the same count in "Pending" tab

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 3 Katrin Fischer 2013-06-30 17:41:42 UTC
I am sorry, but this does no longer apply due to a conflict in the VirtualShelves.t:

Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: Bug 10499: VirtualShelves.t - wrap tests in a database connection
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging t/db_dependent/VirtualShelves.t
CONFLICT (content): Merge conflict in t/db_dependent/VirtualShelves.t
Failed to merge in the changes.
Patch failed at 0001 Bug 10499: VirtualShelves.t - wrap tests in a database connection
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Comment 4 Katrin Fischer 2013-06-30 17:43:33 UTC
Ok, forget that... I had confused my bug numbers :)
Comment 5 Katrin Fischer 2013-06-30 18:05:30 UTC
Hi fridolyn, I have some concerns about your patch:

1) The patch works nicely according to the description, but it limits on branchcode and so suggestions created for _ANY_ library are always left out.

The code used in the database for those seems to be _ANY_ - which is a bit confusing as I would have expected the branchcode column to be empty in this case. But that doesn't change anything about 1) :)

2) I am also wondering if superlibrarians should see the total count instead of a branch related one, but I think showing them the count for the branch they are logged in at is probably right.

Failing QA for 1).
Comment 6 Fridolin Somers 2013-07-24 14:55:03 UTC
Created attachment 19929 [details] [review]
Bug 10449 - Count suggestions without branch also

See commit message
Comment 7 Fridolin Somers 2013-07-24 15:10:54 UTC
(In reply to Katrin Fischer from comment #5)
> Failing QA for 1).

Does the follow-up need signoff ? I'd say no because it is very small.
I set to signed-off.
Comment 8 Fridolin Somers 2013-07-24 15:13:43 UTC
(In reply to Katrin Fischer from comment #5)
> The code used in the database for those seems to be _ANY_ - which is a bit confusing as I would have expected the branchcode column to be empty in this case.
I think this is indeed a bug.
You should open a new one.
Comment 9 Owen Leonard 2013-07-24 15:59:12 UTC
*** Bug 8274 has been marked as a duplicate of this bug. ***
Comment 10 Katrin Fischer 2013-08-18 19:51:50 UTC
Fridolyn, it might be a separate bug, but it means that your follow-up does not work - there is currently no way to have a suggestion which an empty branchcode. When you don't allow the patron to pick the branch in the OPAC the homelibrary will be used. When you create a suggestion for any library in staff, the branchcode is _ANY_ - so your change to the SQL query will currently have no effect:

+            $query .= q{ AND (branchcode='' OR branchcode=?) };
Comment 11 Fridolin Somers 2013-08-28 16:05:58 UTC
(In reply to Katrin Fischer from comment #10)
Oh, indeed.
What should I do ?
Comment 12 Katrin Fischer 2014-04-25 11:42:54 UTC
Hm, not sure right now why this got stuck. I think we should either replace the _ANY_ by an empty branchcode and correct existing suggestions or we need to make the SQL take those _ANY_ into account.
Comment 13 Jonathan Druart 2014-12-11 11:23:51 UTC
Can I know how we want to see this number calculated?

On master I got all suggestions, with these 2 patches, I got the suggestions from the current branch + from any library.

So the number is still different...
Comment 14 Sophie MEYNIEUX 2015-05-20 13:28:35 UTC
Does bug 10753 help to resolve ?
Comment 15 Katrin Fischer 2015-06-17 15:40:33 UTC
Can this be rescued? The branch specific suggestions + any with an empty branch code sounds reasonable to me.
Comment 16 Jonathan Druart 2015-06-18 09:07:23 UTC
(In reply to Katrin Fischer from comment #15)
> Can this be rescued? The branch specific suggestions + any with an empty
> branch code sounds reasonable to me.

As far as I understand, this is the current behavior.
Comment 17 Jonathan Druart 2015-06-18 09:07:59 UTC
(In reply to Jonathan Druart from comment #16)
> (In reply to Katrin Fischer from comment #15)
> > Can this be rescued? The branch specific suggestions + any with an empty
> > branch code sounds reasonable to me.
> 
> As far as I understand, this is the current behavior.

Sorry, forget that, it's not.
Comment 18 Jonathan Druart 2015-06-18 09:18:07 UTC
Fridolin, It's not obvious that what you described in the bug description is a bug.
The sentence is "XXX suggestions waiting. Manage suggestions.", it implies all suggestions.
Comment 19 Marcel de Rooy 2016-10-24 13:21:27 UTC
If you have some suggestions with branchcode == null, how would a staff user get to them? Seems impossible in the interface.
Comment 20 Magnus Enger 2017-06-29 12:33:07 UTC
(In reply to Jonathan Druart from comment #18)
> Fridolin, It's not obvious that what you described in the bug description is
> a bug.
> The sentence is "XXX suggestions waiting. Manage suggestions.", it implies
> all suggestions.

One of my customers reported this as a bug. When they see "Suggestions pending approval: 2" and click on that text they find it confusing that they are shown zero suggestions. I have explained the workaround to show all waiting suggestions.
Comment 21 Fridolin Somers 2017-06-30 07:34:18 UTC
Maybe filter on acquisition information should be first and its content always visible
Comment 22 Fridolin Somers 2017-06-30 07:55:31 UTC
Maybe we should write the current branch in acquisition home page :

    XX suggestions waiting for AAAA library. Manage suggestions.
Comment 23 Katrin Fischer 2017-07-05 06:06:10 UTC
Thinking about this some more: 
We had a similar, but not quite the same problem with patron modification requests. It was solved with the system preference IndependentBranchesPatronModifications.

So we could have a setting to see suggestions from all branches and a setting to see only your own. Ideally the suggestions page should reflect that as well in the preset filter.

But patron modification requests always have a branch - suggestions do not. So 'only your own' does not quite work.

Maybe the solution is to change the text of the message on the dashboard for this setting, so that it's clearer. I am not quite sure what would work here best. Thinking of something like:

1 suggestion for your branch [and 2 for any branch] are pending.

I also like Fridolin's idea to make the selected option more visible as this has caused confusion in our libraries too. Instead of moving the acquisition filters to the top, I suggest having the branch filter outside and always visible, putting it below or over the tab organization filter.
Comment 24 Fridolin Somers 2018-03-15 11:40:20 UTC
Will be fixed on Bug 18743

*** This bug has been marked as a duplicate of bug 18743 ***