Bug 25006: Make Koha::Item->as_marc_field skip undefined subfields
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 27 Mar 2020 19:38:15 +0000 (16:38 -0300)
committerJoy Nelson <joy@bywatersolutions.com>
Tue, 28 Apr 2020 20:29:28 +0000 (20:29 +0000)
commitb5062aaf6b3bb721e56cf3186fda738432f897f4
tree6cec0d76d92c7802e41e1b46f76c92e61c165616
parent2fd3ac8b52e7ab4f2c8f292afb060078b2894554
Bug 25006: Make Koha::Item->as_marc_field skip undefined subfields

This patch makes as_marc_field skip subfields that don't have a value or
contains an empty string (replicating C4::Items:1021 logic).

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item.t
=> FAIL: Tests fail because the generated MARC::Field contains undef
subfields.
3. Apply this patch
4. Repeat 2.
=> SUCCESS: Tests pass! Undefined and empty subfields are skipped!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
Koha/Item.pm