Bug 26963: (QA follow-up) Fix up tests and cover case of undefined ccode
authorNick Clemens <nick@bywatersolutions.com>
Wed, 11 Nov 2020 13:26:58 +0000 (13:26 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 13 Nov 2020 13:20:11 +0000 (14:20 +0100)
commite61bcc270e8bc9a13939af60df45a1db53e51530
tree6020a691e2e9f187fa5ecaab895e2a87b3335367
parent7a42c85889bf779bbcaf82a31793438ebcffc076
Bug 26963: (QA follow-up) Fix up tests and cover case of undefined ccode

While this technically shouldn't happen, if a library creates itemtype limits, then flips the pref, those rules are still in the db until a ccode rule is saved.

To be extra safe, when checking for rules of one type, we should make sure the other type is undef - i.e. if looking for ccode rules, we should confirm the itype is undef for those rules

Additionally, we shouldn't set the barcode now that we are not deleting all items, so we use copynumber for our item identification field as it doesn't need to be unique in the DB

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Item.pm
t/db_dependent/Koha/Item.t