[Koha-bugs] [Bug 27858] Make Koha::Patron::Attribute->store raise an exception on invalid type/code

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Apr 9 10:40:33 CEST 2021


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

--- Comment #17 from Joonas Kylmälä <joonas.kylmala at helsinki.fi> ---
(In reply to Jonathan Druart from comment #16)
> What are we exactly trying to do here?
> 
> Does it mean we are going to have one exception for each our relations/FKs?
> We already have the ORM/DBI that is telling us what's happening if we are
> doing that.

No, here it is only needed because before saving the attribute to the DB we
want to make sure the Attribute Type is marked as repeatable (if adding more
than 1 instance of this attribute) so we try to fetch that Attribute Types info
from the DB and if it doesn't exists the code would fail. It is done in the
subroutine that is called in the store function here, _check_repeatable().

It is important to catch this because e.g. via REST API somebody might try to
add attribute with non-existent attribute type. See example usage in
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=118701

> Can't locate object method "type" via package "Can't call method "repeatable" on 
> an undefined value at /kohadevbox/koha/Koha/Patron/Attribute.pm line 145.
> " (perhaps you forgot to load "Can't call method "repeatable" on an undefined 
> value at /kohadevbox/koha/Koha/Patron/Attribute.pm line 145.

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


More information about the Koha-bugs mailing list