Summary: | Internal server error on moremember.pl | ||
---|---|---|---|
Product: | Koha | Reporter: | Marc Véron <veron> |
Component: | Architecture, internals, and plumbing | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | blocker | ||
Priority: | P5 - low | CC: | jonathan.druart, kyle, m.de.rooy, mtj, tomascohen |
Version: | Main | ||
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: | ||
Circulation function: | |||
Bug Depends on: | 12461, 18552 | ||
Bug Blocks: | |||
Attachments: |
Bug 18647: Internal server error on moremember.pl
[SIGNED-OFF] Bug 18647: Internal server error on moremember.pl Bug 18647: Resolve internal server error on category_type Bug 18647: Resolve internal server error on category_type Bug 18647: Resolve internal server error on category_type |
Description
Marc Véron
2017-05-21 15:03:13 UTC
Created attachment 63590 [details] [review] Bug 18647: Internal server error on moremember.pl To reproduce: Go to the Details page of a member. Result: Internal server error Plack error log: Template process failed: undef error - The method category_code is not covered by tests! at (...)/koha/C4/Templates.pm line 121. To test: Apply patch Try to reproduce - patron's detail page should now display without error Created attachment 63596 [details] [review] [SIGNED-OFF] Bug 18647: Internal server error on moremember.pl To reproduce: Go to the Details page of a member. Result: Internal server error Plack error log: Template process failed: undef error - The method category_code is not covered by tests! at (...)/koha/C4/Templates.pm line 121. To test: Apply patch Try to reproduce - patron's detail page should now display without error Signed-off-by: Josef Moravec <josef.moravec@gmail.com> No, it is definitely not the way to fix it, the borrower variable comes from GetMember most of the time (from other script of members/) This is caused by bug 12461. The borrower variable should NOT be a Koha::Patron object. Everything is cleared on bug 17829, but we will need to wait for the next release to see it in. I'd say the patch should be: diff --git a/members/moremember.pl b/members/moremember.pl index 0e18d2234f..0649dcfd76 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -343,7 +343,6 @@ my $translated_language = C4::Languages::language_get_description( $subtag, $sub $template->param( patron => $patron, - borrower => $patron, # TODO Still needed by includes, translated_language => $translated_language, detailview => 1, borrowernumber => $borrowernumber, The borrower variable should not be a Koha::Patron, because the include file expects an hashref. Marcel, do you know why you add the TODO comment? I do not find where it is used. (In reply to Jonathan Druart from comment #3) > No, it is definitely not the way to fix it, the borrower variable comes from > GetMember most of the time (from other script of members/) Sorry then to have tried to fix it. Leaving it to others to fix the issue. (In reply to Marc Véron from comment #6) > (In reply to Jonathan Druart from comment #3) > > No, it is definitely not the way to fix it, the borrower variable comes from > > GetMember most of the time (from other script of members/) > > Sorry then to have tried to fix it. Leaving it to others to fix the issue. Your patch clearly fixes the issue by making patron-title.inc aware of the fact that borrower is now a K::Patron object. The problem is that the rest of the code is written in terms of the hashref returned by GetMember and we could be missing some edge cases. So we better move it back to the previous behaviour, and let bug 17829 take care of the C4 > Koha shift. We still need Marcel's comment on why he put the TODO, because we might as well miss some other edge case Marcel noticed. (In reply to Tomás Cohen Arazi from comment #7) > (In reply to Marc Véron from comment #6) > > (In reply to Jonathan Druart from comment #3) > We still need Marcel's comment on why he put the TODO, because we might as > well miss some other edge case Marcel noticed. Looking here in a bit Created attachment 63648 [details] [review] Bug 18647: Resolve internal server error on category_type See bug 18552. When we resolved the housebound_role bug, the hash got filled correctly again. And this revealed that the (second) call to Koha::Patrons->find was not appropriate. We cannot yet remove the borrower template variable (reason for the TODO). So we should replace it by a call to GetMember. Note: Commit 95429af6855e8ed37945b681dc466bf360deffb added this call, but it was hidden until the template variable hash got fixed. Test plan: Restart Plack and go to patron details again. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> (In reply to Jonathan Druart from comment #5) > I'd say the patch should be: > > diff --git a/members/moremember.pl b/members/moremember.pl > index 0e18d2234f..0649dcfd76 100755 > --- a/members/moremember.pl > +++ b/members/moremember.pl > @@ -343,7 +343,6 @@ my $translated_language = > C4::Languages::language_get_description( $subtag, $sub > > $template->param( > patron => $patron, > - borrower => $patron, # TODO Still needed by includes, > translated_language => $translated_language, > detailview => 1, > borrowernumber => $borrowernumber, > > > The borrower variable should not be a Koha::Patron, because the include file > expects an hashref. > > Marcel, do you know why you add the TODO comment? I do not find where it is > used. No, you cannot remove the borrower template var yet. The TODO was kind of trivial. Passing the same information twice needs further attention :) Probably by forgetting another Plack restart, I did not catch the internal server error.. (In reply to Marcel de Rooy from comment #10) > (In reply to Jonathan Druart from comment #5) > > I'd say the patch should be: > > > > diff --git a/members/moremember.pl b/members/moremember.pl > No, you cannot remove the borrower template var yet. Yes, we can remove it. Probably the same Plack problem.. Created attachment 63651 [details] [review] Bug 18647: Resolve internal server error on category_type See bug 18552. When we resolved the housebound_role bug, the hash got filled correctly again. And this revealed that the (second) call to Koha::Patrons->find was not appropriate. It can be removed, as Jonathan explained on the report. Note: Commit 95429af6855e8ed37945b681dc466bf360deffb added this call, but it was hidden until the template variable hash got fixed. Test plan: Restart Plack and go to patron details again. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> From IRC: Joubu marcelr: 290 $template->param(%$data); [14:51] Joubu patron-title.inc need patron's info, there are either picked from borrower.$field, or $field [14:51] Joubu in moremember we have $field, because of l.290 [14:51] Joubu we just need to reset the state to the one before the patron's club ft [14:51] Joubu and so delete the line Created attachment 63663 [details] [review] Bug 18647: Resolve internal server error on category_type See bug 18552. When we resolved the housebound_role bug, the hash got filled correctly again. And this revealed that the (second) call to Koha::Patrons->find was not appropriate. It can be removed, as Jonathan explained on the report. Note: Commit 95429af6855e8ed37945b681dc466bf360deffb added this call, but it was hidden until the template variable hash got fixed. Test plan: Restart Plack and go to patron details again. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> (In reply to Jonathan Druart from comment #14) > Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Thanks. Changing status. I was expecting someone else to QA it. (In reply to Jonathan Druart from comment #16) > I was expecting someone else to QA it. Well, let Kyle have a last look now.. Pushed to master for 17.05, thanks Marcel, Jonathan! This patch has been pushed to 16.11.x and will be in 16.11.09. |