NatLibFi / koha-plugin-rest-di

REST API plugin for Koha to provide additional functionality for discovery interfaces such as VuFind
GNU General Public License v3.0
9 stars 9 forks source link

Fix patrons endpoint with newest Koha version #7

Closed ghost closed 3 years ago

ghost commented 3 years ago

The current Koha master version doesn't contain anymore the borrowers.relationship column (Bug 26995). This checks (hackily) via relationship_type hash key whether the column still exists or not and only calls $patron->relationship if it exists. Without this check we get the following error:

The method Koha::Patron->relationship is not covered by tests!

EreMaijala commented 3 years ago

I'll merge this, but it seems we should use borrower_relationships table when the column doesn't exist, right?

ghost commented 3 years ago

Yes, and actually we are already using it, the call $patron->guarantee_relationships just below this code fetches the info from borrower_relationships table. Actually most likely the relationship column here has been empty for a long time now but Koha's git history didn't go so far as when the column was first introduced so I was unable to verify it is is completely empty for all Koha installations. In bug 26995 the column was actually just simply removed but I didn't want to do it here in case there are some API users with relationship column populated and have not yet migrated the data to borrower_relationships manually.

EreMaijala commented 3 years ago

Oh, right. Thanks for the explanation.