Bug 4137: Fix the OPACViewOthersSuggestions behavior
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 24 Mar 2015 16:01:30 +0000 (17:01 +0100)
committerTomas Cohen Arazi <tomascohen@unc.edu.ar>
Fri, 19 Jun 2015 14:34:27 +0000 (11:34 -0300)
commitbe35039b55a351c97f2c1f9a5b373cb26ac5e0b0
tree49d483c19835c24372d9dcf0c3c2edd1a389964f
parentd847b1d92a9df6db2bb5321f032f3ec13d6ba55d
Bug 4137: Fix the OPACViewOthersSuggestions behavior

This pref does not work at all, the interface let the user choose to
list all suggestions, but whatever he chooses the suggestion list is the
same.

This patch cleans a bit the suggestedby management.

There are a lot of cases to test, because linked to 2 prefs:
 AnonSuggestions and OPACViewOthersSuggestions.
1/ AnonSuggestions = 0 and OPACViewOthersSuggestions = 0
  - A non logged in user is not able to make a suggestion.
  - A logged in user is not able to see suggestions made by someone else.
2/ AnonSuggestions = 0 and OPACViewOthersSuggestions = 1
  - A non logged in user is not able to make a suggestion.
  - A logged in user is able to see suggestions made by someone else.
3/ AnonSuggestions = 1 and OPACViewOthersSuggestions = 0
  - A non logged in user is able to make a suggestion.
  The suggestedby field will be filled with the AnonymousPatron pref value.
  He is not able to see suggestions, even the ones made by AnonymousPatron.
  - A logged in user is not able to see suggestions made by someone else.
4/ AnonSuggestions = 1 and OPACViewOthersSuggestions = 1
  - A non logged in user is able to make a suggestion.
  He is able to see all suggestions.
  - A logged in user is able to see suggestions made by someone else.

In all cases a logged in user should be able to search for suggestions
(except if he is not able to see them).

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
All use cases tested, work as expected
No errors

Only comment is perhaps (in the future) a gracefull failure
when AnonymousPatron is not set, or has '0' value

Message is DBIx::Class::ResultSet::create(): Column 'suggestedby' cannot be null at ...

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
C4/Auth.pm
koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
opac/opac-suggestions.pl