Bug 30848: Add an ExpandCodedFields RecordProcessor filter
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 26 May 2022 09:24:50 +0000 (10:24 +0100)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 29 Jul 2022 17:15:30 +0000 (17:15 +0000)
commit0a861042947adbc12b4d865c89c6a87effe965b9
tree6150209d717f4c8f697a59600ed750e0be63c6bf
parent54da779d5edc9dd967fb8d1787fb11b4d78ec7cd
Bug 30848: Add an ExpandCodedFields RecordProcessor filter

This patch introduces a RecordProcessor filter for MARC::Record objects
that replaces Koha codes with descriptions in the MARC::Record passed to the processor.

Target usage:

  my $biblio = Koha::Biblios->find(
      $biblio_id,
      { prefetch => [ metadata ] }
  );

  my $record = $biblio->metadata->record;

  my $processor = Koha::RecordProcessor->new(
    {
        filters => ('ExpandCodedFields'),
        options => {
            interface     => 'opac',
            frameworkcode => $biblio->frameworkcode
        }
    }
  );

  $processor->process( $record );

Test plan
* Read the included unit test and confirm it makes sense and passes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 62bba6d9e12bdf9e3dbf231beae68afe43618f4b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/Filter/MARC/ExpandCodedFields.pm [new file with mode: 0644]
admin/biblio_framework.pl
admin/marc_subfields_structure.pl
admin/marctagstructure.pl
t/db_dependent/Koha/Filter/ExpandCodedFields.t [new file with mode: 0644]