Bug 32336: (QA follow-up) Use $metadata->schema

When we worked on Koha::Biblio::Metadata, we agreed
biblio_metadata.schema would be the sourceof truth when it comes to the
record schema.

This patch acknowledges that, while retaining the fallback to the
syspref.

To test:
1. Apply this patch
2. Run:
   $ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass, behavior is unchanged.
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 075ef09f48)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2023-03-23 20:16:37 -03:00 committed by Matt Blenkinsop
parent be4ff83090
commit 4abb30f844
1 changed files with 8 additions and 6 deletions

View File

@ -67,14 +67,15 @@ sub get {
);
}
else {
my $record = $biblio->metadata->record;
my $marcflavour = C4::Context->preference("marcflavour");
my $metadata = $biblio->metadata;
my $record = $metadata->record;
my $schema = $metadata->schema // C4::Context->preference("marcflavour");
$c->respond_to(
marcxml => {
status => 200,
format => 'marcxml',
text => $record->as_xml_record($marcflavour),
text => $record->as_xml_record($schema),
},
mij => {
status => 200,
@ -169,7 +170,8 @@ sub get_public {
return try {
my $record = $biblio->metadata->record;
my $metadata = $biblio->metadata;
my $record = $metadata->record;
my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems');
my $patron = $c->stash('koha.user');
@ -189,7 +191,7 @@ sub get_public {
}
}
my $marcflavour = C4::Context->preference("marcflavour");
my $schema = $metadata->schema // C4::Context->preference("marcflavour");
my $record_processor = Koha::RecordProcessor->new({
filters => 'ViewPolicy',
@ -205,7 +207,7 @@ sub get_public {
marcxml => {
status => 200,
format => 'marcxml',
text => $record->as_xml_record($marcflavour),
text => $record->as_xml_record($schema),
},
mij => {
status => 200,