Bug 29652 - Move Koha::Biblio->get_marc_* to Koha::Biblio::Metadata
Summary: Move Koha::Biblio->get_marc_* to Koha::Biblio::Metadata
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 27266 27268 29871 30744 30918
Blocks:
  Show dependency treegraph
 
Reported: 2021-12-07 12:14 UTC by Tomás Cohen Arazi
Modified: 2022-06-07 12:39 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2021-12-07 12:14:50 UTC
When you look at the methods code, you notice
- It is tied to the Koha::Biblio::Metadata->record
- The code branches depending on information that is passed, that is already present at the Koha::Biblio::Metadata object/level (MARCFLAVOUR=schema, the record itself)

There should still exist a Koha::Biblio->authors/notes method to retrieve this information at that level, but calling the metadata object methods.

This way the caller could do:
my $biblio = Koha::Biblios->find( $biblio_id, { prefetch => ['biblio_metadata'] } );

and even save some queries.
Comment 1 Fridolin Somers 2021-12-15 22:31:56 UTC
I see Bug 27268 kept marcflavour has param :
  my $marcflavour = $params->{marcflavour};

But other calls fetch syspref value :
get_marc_host, get_marc_authors ...

We should be consistent.

Any reason to keep marcflavour has param ?
Comment 2 Tomás Cohen Arazi 2021-12-15 22:33:58 UTC
(In reply to Fridolin Somers from comment #1)
> I see Bug 27268 kept marcflavour has param :
>   my $marcflavour = $params->{marcflavour};
> 
> But other calls fetch syspref value :
> get_marc_host, get_marc_authors ...
> 
> We should be consistent.
> 
> Any reason to keep marcflavour has param ?

I wouldn't keep it
Comment 3 Tomás Cohen Arazi 2021-12-15 22:55:27 UTC
(In reply to Tomás Cohen Arazi from comment #2)
> (In reply to Fridolin Somers from comment #1)
> > I see Bug 27268 kept marcflavour has param :
> >   my $marcflavour = $params->{marcflavour};
> > 
> > But other calls fetch syspref value :
> > get_marc_host, get_marc_authors ...
> > 
> > We should be consistent.
> > 
> > Any reason to keep marcflavour has param ?
> 
> I wouldn't keep it

I don't even think it should consider the syspref. The syspref would've been considered when setting the 'schema'
Comment 4 Fridolin Somers 2021-12-17 22:06:50 UTC
(In reply to Tomás Cohen Arazi from comment #3)
> I don't even think it should consider the syspref. The syspref would've been
> considered when setting the 'schema'

Ah but the code of get_marc_*() often contains a "if UNIMARC else ..." because fields number are hardcoded (for example title on 200 in UNIMARC).

Only when we will have a Dublin Core schema this will not be needed anymore ^^
Comment 5 Tomás Cohen Arazi 2021-12-17 22:11:12 UTC
(In reply to Fridolin Somers from comment #4)
> (In reply to Tomás Cohen Arazi from comment #3)
> > I don't even think it should consider the syspref. The syspref would've been
> > considered when setting the 'schema'
> 
> Ah but the code of get_marc_*() often contains a "if UNIMARC else ..."
> because fields number are hardcoded (for example title on 200 in UNIMARC).
> 
> Only when we will have a Dublin Core schema this will not be needed anymore
> ^^

What if the biblio_metadata.schema had UNIMARC and the syspref MARC?

I'd say biblio_metadata.schema would be the source for truth, same as with DublinCore. So we don't need to read the syspref in Koha::Biblio::Metadata->authors, we just check $self->schema and do the right thing
Comment 6 Fridolin Somers 2021-12-17 22:28:48 UTC
(In reply to Tomás Cohen Arazi from comment #5)
> 
> What if the biblio_metadata.schema had UNIMARC and the syspref MARC?
> 
> I'd say biblio_metadata.schema would be the source for truth, same as with
> DublinCore. So we don't need to read the syspref in
> Koha::Biblio::Metadata->authors, we just check $self->schema and do the
> right thing

A sure, 100% agreed.
Comment 7 Fridolin Somers 2022-01-12 22:00:37 UTC
We agreed to remove the marcflavour parameter in dev meeting

https://wiki.koha-community.org/wiki/Development_IRC_meeting_5_January_2022