Bug 22144

Summary: Add method metadata() to Koha::Biblio
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: Architecture, internals, and plumbingAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: enhancement    
Priority: P5 - low CC: josef.moravec, m.de.rooy, martin.renvoize, nick, terahuitunua, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 22155, 22194    
Bug Blocks: 23425    
Attachments: Bug 22144: Add method marc() to Koha::Biblio
Bug 22144: Add method marc() to Koha::Biblio
Bug 22144: Add method marc() to Koha::Biblio
Bug 22144 [QA Followup]: Move Koha::Biblio::marc to Koha::Biblio::Metadata::record
Bug 22144: Add method metadata() to Koha::Biblio
Bug 22144: (QA follow-up) Prepare the ground for other formats
Bug 22144: Add method metadata() to Koha::Biblio
Bug 22144: (QA follow-up) Prepare the ground for other formats
Bug 22144: Add method metadata() to Koha::Biblio
Bug 22144: (QA follow-up) Prepare the ground for other formats

Description Kyle M Hall (khall) 2019-01-16 19:23:04 UTC
It would be very convenient to be able to retrieve a bib's MARC::Record object directly from biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary MARC fields that aren't stored in the database.
Comment 1 Kyle M Hall (khall) 2019-01-16 19:27:30 UTC
Created attachment 84076 [details] [review]
Bug 22144: Add method marc() to Koha::Biblio

It would be very convenient to be able to retrieve a bib's MARC::Record object directly from biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary MARC fields that aren't stored in the database.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Biblio.t
Comment 2 terahuitunua 2019-01-16 21:02:30 UTC
Created attachment 84093 [details] [review]
Bug 22144: Add method marc() to Koha::Biblio

It would be very convenient to be able to retrieve a bib's MARC::Record object directly from biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary MARC fields that aren't stored in the database.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Biblio.t

Signed-off-by: Te Rahui Tunua <terahuitunua@catalyst.net.nz>
Comment 3 Kyle M Hall (khall) 2019-01-17 12:01:59 UTC
Created attachment 84137 [details] [review]
Bug 22144: Add method marc() to Koha::Biblio

It would be very convenient to be able to retrieve a bib's MARC::Record object directly from biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary MARC fields that aren't stored in the database.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Biblio.t

Signed-off-by: Te Rahui Tunua <terahuitunua@catalyst.net.nz>
Comment 4 Tomás Cohen Arazi (tcohen) 2019-01-17 15:07:05 UTC
While we really need to move things into Koha::Biblio, we might better keep in mind that we now have biblio_metadata, which isn't actually tied to a specific serialization format and data schema.
I'm not implying we should move C4 code into Koha::Biblio to have something like this (we should, in a mid term) but at least we should leave room for a more general approach: at least return a metadata object, in the lines of Koha::MetadataRecord which "can" be a MARC record.

My two cents. I will think about it, because this would benefit the API develpment too.
Comment 5 Kyle M Hall (khall) 2019-01-18 15:53:17 UTC
Created attachment 84205 [details] [review]
Bug 22144 [QA Followup]: Move Koha::Biblio::marc to Koha::Biblio::Metadata::record
Comment 6 Tomás Cohen Arazi (tcohen) 2019-01-24 11:12:08 UTC
Created attachment 84343 [details] [review]
Bug 22144: Add method metadata() to Koha::Biblio

It would be very convenient to be able to retrieve a bib's attached metadata objects directly from the biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary metadata fields that aren't stored in the database.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Biblio.t

Signed-off-by: Te Rahui Tunua <terahuitunua@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Tomás Cohen Arazi (tcohen) 2019-01-24 11:12:13 UTC
Created attachment 84344 [details] [review]
Bug 22144: (QA follow-up) Prepare the ground for other formats

This patch refactors the original implementation so it is ready for
supporting other formats. It also adds some error handling.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Kyle M Hall (khall) 2019-01-24 11:31:46 UTC
Created attachment 84345 [details] [review]
Bug 22144: Add method metadata() to Koha::Biblio

It would be very convenient to be able to retrieve a bib's attached metadata objects directly from the biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary metadata fields that aren't stored in the database.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Biblio.t

Signed-off-by: Te Rahui Tunua <terahuitunua@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Kyle M Hall (khall) 2019-01-24 11:32:03 UTC
Created attachment 84346 [details] [review]
Bug 22144: (QA follow-up) Prepare the ground for other formats

This patch refactors the original implementation so it is ready for
supporting other formats. It also adds some error handling.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Josef Moravec 2019-01-24 13:02:57 UTC
Created attachment 84350 [details] [review]
Bug 22144: Add method metadata() to Koha::Biblio

It would be very convenient to be able to retrieve a bib's attached metadata objects directly from the biblio object. This would be very useful for Template Toolkit syntax in slips and notices where a library would like to use arbitrary metadata fields that aren't stored in the database.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Biblio.t

Signed-off-by: Te Rahui Tunua <terahuitunua@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 11 Josef Moravec 2019-01-24 13:03:01 UTC
Created attachment 84351 [details] [review]
Bug 22144: (QA follow-up) Prepare the ground for other formats

This patch refactors the original implementation so it is ready for
supporting other formats. It also adds some error handling.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 12 Nick Clemens (kidclamp) 2019-01-31 13:38:29 UTC
Awesome work all!

Pushed to master for 19.05
Comment 13 Martin Renvoize (ashimema) 2019-02-01 15:36:34 UTC
Enhancement, will not be backported to 18.11.x series.