Bug 24366: Make sure accessors are used on the right object
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 13 Jan 2020 19:45:58 +0000 (16:45 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 14 Jan 2020 14:12:57 +0000 (14:12 +0000)
commitfd3506465737a388679b905b73d8310f7014ba1d
treeb5b73f79454a41e2dbef5c3c4917657b0a86b5c2
parent52bb48ab4500a5bf507e0a3083710dfeeec52f4b
Bug 24366: Make sure accessors are used on the right object

This patch makes the Koha::Biblio->to_api method try the accessors on
$self first, and fallback to $self->biblioitem on those he can't.

This way it won't happen that (for example) ->holds will be tried
against ->biblioitem.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Biblio.pm
t/db_dependent/Koha/Biblio.t