[Koha-bugs] [Bug 20581] Allow manual selection of custom ILL request statuses

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 6 12:05:35 CET 2019


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

--- Comment #156 from Andrew Isherwood <andrew.isherwood at ptfs-europe.com> ---
Hi Katrin, rant incoming, though it's not aimed at you!

To be honest, this is actually a problem that is caused by using a foreign key
that does not contain unique values.

I was originally using authorised_values.id (which *is* unique) as the foreign
key from illrequests.status_alias, but after you said this is the non-standard
way of doing things, I changed it to use authorised_values.authorised_value,
which has no unique constraint on it, as you have demonstrated.

Thinking around the problem, I suspect this issue will affect any part of Koha
that uses authorised values. The DBIx relationship makes the reasonable
assumption that the column used as a foreign key contains unique values, so it
just returns the first value it finds, which in this case is incorrect.

As far as addressing it in this case. Whatever I do is going to be hackery,
since it's patching over a fundamental DB design problem. Since we're using the
Koha objects/DBIx::Class accessors to get the request's status, I'm going to
have to provide an overloaded method that only gets the authorised values in
the correct category.

I do think it's worth considering in the context of the DB design error. This
is a fairly nasty problem, I suspect it's just not very commonly seen since
creating two authorised values with the same "Authorised value" value is
probably quite rare.

I'll create a bug to start a discussion on it.

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


More information about the Koha-bugs mailing list