Bug 14646: Koha::RecordProcessor should accept more than one filter
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 5 Aug 2015 19:10:19 +0000 (16:10 -0300)
committerTomas Cohen Arazi <tomascohen@unc.edu.ar>
Thu, 20 Aug 2015 16:44:15 +0000 (13:44 -0300)
commit56a2607c46db30c318eda9dc44ae3c58731e23fe
tree033368180ca3af49629f512f0a41b782947c373a
parent406098b20b5385d2df588520abecefc868f4c0c0
Bug 14646: Koha::RecordProcessor should accept more than one filter

The docs say that Koha::RecordProcessor accepts more than one filter
at a time. But as the regression tests show it doesn't.

This is really important to extend its usage in record processing
(either to enforce policy, transform, etc).

This patch makes ->new evaluate the reference type of the passed filters
and builds an array with a single item if a scalar has been passed. The
loop now explicitly casts the filters as an array.

To test:
- Apply the test patch
- Run
  $ prove t/RecordProcessor.t
=> FAIL: tests fail because Koha::RecordProcessor doesn't hanlde
         more than one filter at a time.
- Apply this patch
- Run
  $ prove t/RecordProcessor.t
=> SUCCESS: tests now pass
- Easy, right? Sign off :-D

NOTE: Read code. Don't like the ? operator logic, but it is
      functional despite readability issues.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Koha/RecordProcessor.pm