Description
Miguel Tuimil
2016-07-29 07:06:09 UTC
Created attachment 53959 [details] [review] Bug 16996: Do not explode if mandatory fields are missing At the OPAC, if a patron modify his/her information and at least 1 mandatory field is missing, Koha will crash with Template process failed: undef error - Can't call method "description" It is raised by Koha::Template::Plugin::Categories::GetName called with an undefined categorycode. The problem is that the values sent originaly are not sent back to the template if the user missed something. This patch makes that all info are resent to the template in order to show the same form to the user. Test plan: 1. Make sure that the categorycode is not hidden in the OPAC in: PatronSelfRegistrationBorrowerUnwantedField or PatronSelfModificationBorrowerUnwantedField 2. Add a required field in PatronSelfRegistrationBorrowerMandatoryField, for example email. 3. Go to Your Personal Details in the OPAC (opac-memberentry.pl) and leave blank the required field of point 2 Created attachment 54011 [details] [review] Bug 16996: Do not explode if mandatory fields are missing At the OPAC, if a patron modify his/her information and at least 1 mandatory field is missing, Koha will crash with Template process failed: undef error - Can't call method "description" It is raised by Koha::Template::Plugin::Categories::GetName called with an undefined categorycode. The problem is that the values sent originaly are not sent back to the template if the user missed something. This patch makes that all info are resent to the template in order to show the same form to the user. Test plan: 0. Apply patch 1. Make sure that the categorycode is not hidden in the OPAC in: PatronSelfRegistrationBorrowerUnwantedField or PatronSelfModificationBorrowerUnwantedField 2. Add a required field in PatronSelfRegistrationBorrowerMandatoryField, for example email. 3. Go to Your Personal Details in the OPAC (opac-memberentry.pl) and leave blank the required field of point 2 4. Press "Submit update request" There should be no software error. NOTE: The warns will be floody on the logs. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Works ok, but I assume the warns should not be there? + use Data::Dumper;warn Dumper $borrower; + %borrower = ( %$borrower, %borrower ); + use Data::Dumper;warn Dumper \%borrower; Created attachment 54148 [details] [review] Bug 16996: Do not explode if mandatory fields are missing At the OPAC, if a patron modify his/her information and at least 1 mandatory field is missing, Koha will crash with Template process failed: undef error - Can't call method "description" It is raised by Koha::Template::Plugin::Categories::GetName called with an undefined categorycode. The problem is that the values sent originaly are not sent back to the template if the user missed something. This patch makes that all info are resent to the template in order to show the same form to the user. Test plan: 0. Apply patch 1. Make sure that the categorycode is not hidden in the OPAC in: PatronSelfRegistrationBorrowerUnwantedField or PatronSelfModificationBorrowerUnwantedField 2. Add a required field in PatronSelfRegistrationBorrowerMandatoryField, for example email. 3. Go to Your Personal Details in the OPAC (opac-memberentry.pl) and leave blank the required field of point 2 4. Press "Submit update request" There should be no software error. NOTE: The warns will be floody on the logs. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> With patch, it works OK when updating an existing record. However if I want to create a new patron using self registration, I still get "Internal Server Error" What I did: - Mandatory fields: Surname, First name - Category is visible - If not yet done, log out from OPAC - Follow Link "Register here" - Fill in First name only - Fill in Verification - Submit - Getting Message "You have not filled..." - Do not change anything, submit -> "Internal Server Error" plack-error.log says: Template process failed: undef Error - Can not call method "description" on an undefined value at /usr/share/koha/lib/Koha/Template/Plugin/Categories.pm line 29. Created attachment 54167 [details] [review] Bug 16996: (follow-up) Do not explode if mandatory fields are missing When registering a new patron, if something went wrong, the form is resent to the template but without the categorycode (not a dropdown list anymore, but just displayed as a readonly value # TODO LATER). Created attachment 54175 [details] [review] Bug 16996: Do not explode if mandatory fields are missing At the OPAC, if a patron modify his/her information and at least 1 mandatory field is missing, Koha will crash with Template process failed: undef error - Can't call method "description" It is raised by Koha::Template::Plugin::Categories::GetName called with an undefined categorycode. The problem is that the values sent originaly are not sent back to the template if the user missed something. This patch makes that all info are resent to the template in order to show the same form to the user. Test plan: 0. Apply patch 1. Make sure that the categorycode is not hidden in the OPAC in: PatronSelfRegistrationBorrowerUnwantedField or PatronSelfModificationBorrowerUnwantedField 2. Add a required field in PatronSelfRegistrationBorrowerMandatoryField, for example email. 3. Go to Your Personal Details in the OPAC (opac-memberentry.pl) and leave blank the required field of point 2 4. Press "Submit update request" There should be no software error. NOTE: The warns will be floody on the logs. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marc <veron@veron.ch> Created attachment 54176 [details] [review] Bug 16996: (follow-up) Do not explode if mandatory fields are missing When registering a new patron, if something went wrong, the form is resent to the template but without the categorycode (not a dropdown list anymore, but just displayed as a readonly value # TODO LATER). Signed-off-by: Marc <veron@veron.ch> Created attachment 54396 [details] [review] Bug 16996: Do not explode if mandatory fields are missing At the OPAC, if a patron modify his/her information and at least 1 mandatory field is missing, Koha will crash with Template process failed: undef error - Can't call method "description" It is raised by Koha::Template::Plugin::Categories::GetName called with an undefined categorycode. The problem is that the values sent originaly are not sent back to the template if the user missed something. This patch makes that all info are resent to the template in order to show the same form to the user. Test plan: 0. Apply patch 1. Make sure that the categorycode is not hidden in the OPAC in: PatronSelfRegistrationBorrowerUnwantedField or PatronSelfModificationBorrowerUnwantedField 2. Add a required field in PatronSelfRegistrationBorrowerMandatoryField, for example email. 3. Go to Your Personal Details in the OPAC (opac-memberentry.pl) and leave blank the required field of point 2 4. Press "Submit update request" There should be no software error. NOTE: The warns will be floody on the logs. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Created attachment 54397 [details] [review] Bug 16996: (follow-up) Do not explode if mandatory fields are missing When registering a new patron, if something went wrong, the form is resent to the template but without the categorycode (not a dropdown list anymore, but just displayed as a readonly value # TODO LATER). Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Pushed to master for 16.11, thanks Jonathan! Pushed in 16.05. Will be in 16.05.03. Pushed to 3.22.x, will be in 3.22.10 See this: https://lists.katipo.co.nz/pipermail/koha/2016-August/046113.html The bug described here exists in 16.05, but its solution depends on a CSRF related patch which hasn't yet been ported on 16.05 due to dependencies (this has to be discussed). Created attachment 54947 [details] [review] [16.05] Bug 16996 Fix a bug introduced in 16.05 Signed-off-by: Frédéric Demians <f.demians@tamil.fr> (In reply to Frédéric Demians from comment #14) > The bug described here exists in 16.05, but its solution depends on a CSRF > related patch which hasn't yet been ported on 16.05 due to dependencies > (this has to be discussed). Something beyond these? https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16591#c18 *** Bug 17235 has been marked as a duplicate of this bug. *** |