If anonymous suggestions (AnonSuggestions) are allowed but AnonymousPatron is not set correctly, it's possible to create a suggestion without being logged in and the app explodes with a FK constraint: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`suggestions`, CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `bo rrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE) [for Statement "INSERT INTO `suggestions` ( `STATUS`, `author`, `branchcode`, `collectiontitle`, `copyrightdate`, `isbn`, `itemtype`, `note`, `pa tronreason`, `place`, `publishercode`, `quantity`, `suggestedby`, `suggesteddate`, `title`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="ASKED", 1="", 2=undef, 3="", 4=undef, 5="" , 6="AUDIOBOOK", 7="", 8="", 9="", 10="", 11=undef, 12="0", 13='2020-01-02T10:28:40', 14="xxx"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836. Broken FK constraint at /usr/share/perl5/Exception/Class/Base.pm line 88 Exception::Class::Base::throw('Koha::Exceptions::Object::FKConstraint', 'error', 'Broken FK constraint', 'broken_fk', 'suggestedby') called at /kohadevbox/koha/Koha/Object.pm line 164
Created attachment 96730 [details] [review] Bug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron This patch adds a warning to the about page if AnonSuggestions is set but AnonymousPatron. Test plan: Turn on AnonSuggestions and set AnonymousPatron to 0 => You see a warning on the about page Turn on AnonSuggestions and set AnonymousPatron to an invalid value => You see a warning on the about page Turn off AnonSuggestions => No warning Turn on AnonSuggestions and set AnonymousPatron to a valid value => No warning
Created attachment 96731 [details] [review] Bug 24327: Redirect to the login form if AnonSuggestion misconfigured Test plan: Turn on AnonSuggestion but set AnonymousPatron to an invalid value Go to /cgi-bin/koha/opac-suggestions.pl?op=add => You see the login form
Created attachment 96746 [details] [review] Bug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron This patch adds a warning to the about page if AnonSuggestions is set but AnonymousPatron. Test plan: Turn on AnonSuggestions and set AnonymousPatron to 0 => You see a warning on the about page Turn on AnonSuggestions and set AnonymousPatron to an invalid value => You see a warning on the about page Turn off AnonSuggestions => No warning Turn on AnonSuggestions and set AnonymousPatron to a valid value => No warning Signed-off-by: hc <hc@interleaf.ie>
Created attachment 96747 [details] [review] Bug 24327: Redirect to the login form if AnonSuggestion misconfigured Test plan: Turn on AnonSuggestion but set AnonymousPatron to an invalid value Go to /cgi-bin/koha/opac-suggestions.pl?op=add => You see the login form Signed-off-by: hc <hc@interleaf.ie>
Both test plans were successful.
Created attachment 96772 [details] [review] Bug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron This patch adds a warning to the about page if AnonSuggestions is set but AnonymousPatron. Test plan: Turn on AnonSuggestions and set AnonymousPatron to 0 => You see a warning on the about page Turn on AnonSuggestions and set AnonymousPatron to an invalid value => You see a warning on the about page Turn off AnonSuggestions => No warning Turn on AnonSuggestions and set AnonymousPatron to a valid value => No warning Signed-off-by: hc <hc@interleaf.ie> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 96773 [details] [review] Bug 24327: Redirect to the login form if AnonSuggestion misconfigured Test plan: Turn on AnonSuggestion but set AnonymousPatron to an invalid value Go to /cgi-bin/koha/opac-suggestions.pl?op=add => You see the login form Signed-off-by: hc <hc@interleaf.ie> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Hi Holly, at the moment your sign off line shows "hc" as the name, which will turn up in the Release notes - would you like us to change it so it shows your full name instead? Signed-off-by: hc <hc@interleaf.ie>
Hi Katrin, That would be great. I'll sign in full in the future, hc is just a habit. Thanks, Holly
Nice work everyone! Pushed to master for 20.05
Pushed to 19.11.x branch for 19.11.02
cant clean apply this patchset to the 19.05.x branch, if needed please rebase