Bug 14651: Koha::Item->effective_itemtype fallback to bib-level
commitcbdd49ed7003f124d55f399e5d2709ef81fb7243
authorTomas Cohen Arazi <tomascohen@unc.edu.ar>
Tue, 18 Aug 2015 19:37:27 +0000 (18 16:37 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 7 Sep 2015 14:14:19 +0000 (7 11:14 -0300)
tree94179d43cf184ecfffdc3738e44bb28e908e33a7
parentefe3d17acc237e00cc7c0e37eba92e8eead57ebf
Bug 14651: Koha::Item->effective_itemtype fallback to bib-level

In some situations (bad migrations, old bugs that introduced bad data,
people having bib-level itypes for ages and switching to item level...)
the user ends with undex itype values for items.

The current code, if the user has item_level-itype set, just returns
undef. It should fallback to bib-level. In order to avoid hiding the problem
a warning is raised.

To test:
- Run the regression tets:
  $ prove t/db_dependent/Items.t
=> FAIL: tests fail.
- Apply the patch
- Run the tests again
=> SUCCESS: The tests now pass.
- Sign off :-D

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Schema/Result/Item.pm