[Koha-bugs] [Bug 17307] Some edit buttons/ links for patrons do not work without a categorycode in the URL

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Sep 19 18:49:39 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17307

M. Tompsett <mtompset at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mtompset at hotmail.com

--- Comment #5 from M. Tompsett <mtompset at hotmail.com> ---
(In reply to Andreas Roussos from comment #1)
> 373     unless ($newdata{'dateexpiry'}){
> 374         my $patron_category = Koha::Patron::Categories->find(
> $newdata{categorycode} );
> 375         $newdata{'dateexpiry'} = $patron_category->get_expiry_date(
> $newdata{dateenrolled} );
> 376     }

Let's look at this block of code.


> The problem in line 375 is that the value of the $patron_category
> variable is undefined, because at line 374 $newdata{categorycode}
> comes from $input->param(), as per the comment at line 168. Since
> no 'categorycode' value is passed in the URL, the call to
> Koha::Patron::Categories->find() fails.
> 
> So, it seems that the easy fix is to add the categorycode in the URL.
> It's trivial to fix so I'll provide a patch soon.

While this is all true, that's not what the block of code is trying to do.
Patron's should have an expiry date for their account. The problem is not the
lack of category code, the problem is the lack of expiry date. This code is
trying to correct the expiry date based on the category code. However, given
that we don't know what the category code is, the program shouldn't even be
trying to set the dateexpiry at all. So, in the case that there is no category
found, which is also possible by passing a BAD one, we should not set the
dateexpiry. In short, set the dateexpiry to the function call *IF* there is a
patron_category. Hence, my counter patch. Feel free to sign off on it and
obsolete yours, Andreas, if you think it is better.

I don't think fixing all the templates to pass category code is the correct way
to handle the problem.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list