Bug 29560 - Add option to create MARC links when adding items to bundles
Summary: Add option to create MARC links when adding items to bundles
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 28854
Blocks: 32802 37364
  Show dependency treegraph
 
Reported: 2021-11-23 11:43 UTC by Martin Renvoize
Modified: 2024-07-17 10:08 UTC (History)
5 users (show)

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


Attachments
Bug 29560: Add link_marc_host to Koha::Biblio (5.03 KB, patch)
2022-05-18 07:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (3.54 KB, patch)
2022-05-18 07:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.03 KB, patch)
2022-07-11 13:30 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (3.33 KB, patch)
2022-07-11 13:30 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.00 KB, patch)
2023-09-27 16:07 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (4.53 KB, patch)
2023-09-27 16:07 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.06 KB, patch)
2023-11-17 11:32 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (4.58 KB, patch)
2023-11-17 11:32 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.06 KB, patch)
2024-07-10 12:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (4.65 KB, patch)
2024-07-10 12:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: (follow-up) Split prepare and store logic (9.07 KB, patch)
2024-07-10 12:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Unit tests (6.57 KB, patch)
2024-07-10 12:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.06 KB, patch)
2024-07-11 13:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (4.65 KB, patch)
2024-07-11 13:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: (follow-up) Split prepare and store logic (12.57 KB, patch)
2024-07-11 13:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Unit tests (6.88 KB, patch)
2024-07-11 13:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Unit tests: API (6.07 KB, patch)
2024-07-11 13:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.06 KB, patch)
2024-07-11 13:34 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (4.77 KB, patch)
2024-07-11 13:34 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: (follow-up) Split prepare and store logic (12.57 KB, patch)
2024-07-11 13:34 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Unit tests (6.88 KB, patch)
2024-07-11 13:34 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Unit tests: API (6.07 KB, patch)
2024-07-11 13:35 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29560: Add link_marc_host to Koha::Biblio (5.11 KB, patch)
2024-07-12 10:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29560: Add option to create MARC Links when bundling items (4.82 KB, patch)
2024-07-12 10:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29560: (follow-up) Split prepare and store logic (12.63 KB, patch)
2024-07-12 10:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29560: Unit tests (6.94 KB, patch)
2024-07-12 10:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29560: Unit tests: API (6.12 KB, patch)
2024-07-12 10:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29560: (follow-up) Clean up trailing comma (1.09 KB, patch)
2024-07-15 10:24 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2021-11-23 11:43:23 UTC
Bug 28854 adds the ability to bundle items together for circulation as collections.

It may be useful to optionally allow the action of adding an item into a bundle to trigger the creation of MARC field links in the constituent items biblio.
Comment 1 Martin Renvoize 2021-11-24 17:34:44 UTC
What I'm thinking is adding a checkbox to the add to bundle modal that allows adding '773' links to the child as it's added to the bundle.
Comment 2 Martin Renvoize 2022-05-18 07:33:55 UTC
Created attachment 135090 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.
Comment 3 Martin Renvoize 2022-05-18 07:33:59 UTC
Created attachment 135091 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.
Comment 4 Martin Renvoize 2022-05-18 07:35:52 UTC
Work in progress.. I believe is should all be working as expected but we need to add tests and I'd love some feedback on the implementation with respect to the very similar functions in C4::Biblio for preparing a host link field.
Comment 5 Martin Renvoize 2022-06-20 06:46:26 UTC
Perhaps this could/should also be tied to a preference.. 'BundleContentsFrom' or something that allows the librarian to pick from what data source content lists should be built.. MARC Field or First bundle item perhaps?
Comment 6 Martin Renvoize 2022-07-11 13:30:41 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize 2022-07-11 13:30:48 UTC Comment hidden (obsolete)
Comment 8 Martin Renvoize 2023-02-02 16:51:38 UTC
Noone interested in this?
Comment 9 Martin Renvoize 2023-09-27 16:07:36 UTC
Created attachment 156299 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.
Comment 10 Martin Renvoize 2023-09-27 16:07:39 UTC
Created attachment 156300 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.
Comment 11 Martin Renvoize 2023-09-27 16:08:06 UTC
Rebased and ready for testing again.
Comment 12 PTFS Europe Sandboxes 2023-11-17 11:32:54 UTC
Created attachment 159081 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 13 PTFS Europe Sandboxes 2023-11-17 11:32:56 UTC
Created attachment 159082 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 14 Kyle M Hall 2023-11-17 18:10:13 UTC
Could we get some unit tests for link_marc_host?
Comment 15 Martin Renvoize 2024-07-10 12:55:33 UTC
Created attachment 168720 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 16 Martin Renvoize 2024-07-10 12:55:36 UTC
Created attachment 168721 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 17 Martin Renvoize 2024-07-10 12:55:39 UTC
Created attachment 168722 [details] [review]
Bug 29560: (follow-up) Split prepare and store logic

This allows for future removal of C4::Biblio::prepare_marc_host by
splitting the logic for generating the host field and storing the link
in the child record.
Comment 18 Martin Renvoize 2024-07-10 12:55:41 UTC
Created attachment 168723 [details] [review]
Bug 29560: Unit tests
Comment 19 Martin Renvoize 2024-07-10 12:56:58 UTC
Rebased, a tiny bit of refactoring for thinking about future removal of old code and unit tests added.

Back to signed off and ready for QA.
Comment 20 Kyle M Hall 2024-07-11 11:22:33 UTC
Can you please address the QA script issue:

 FAIL	Koha/REST/V1/Items.pm
   OK	  critic
   FAIL	  forbidden patterns
		forbidden pattern: Use of $c->validation in API controllers should be avoided (bug 33556) (line 319)

and be able to add a unit test for the rest api change? Thanks!
Comment 21 Martin Renvoize 2024-07-11 13:18:05 UTC
Created attachment 168816 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 22 Martin Renvoize 2024-07-11 13:18:08 UTC
Created attachment 168817 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 23 Martin Renvoize 2024-07-11 13:18:11 UTC
Created attachment 168818 [details] [review]
Bug 29560: (follow-up) Split prepare and store logic

This allows for future removal of C4::Biblio::prepare_marc_host by
splitting the logic for generating the host field and storing the link
in the child record.
Comment 24 Martin Renvoize 2024-07-11 13:18:13 UTC
Created attachment 168819 [details] [review]
Bug 29560: Unit tests
Comment 25 Martin Renvoize 2024-07-11 13:18:16 UTC
Created attachment 168820 [details] [review]
Bug 29560: Unit tests: API
Comment 26 Martin Renvoize 2024-07-11 13:34:51 UTC
Created attachment 168821 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 27 Martin Renvoize 2024-07-11 13:34:54 UTC
Created attachment 168822 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Comment 28 Martin Renvoize 2024-07-11 13:34:57 UTC
Created attachment 168823 [details] [review]
Bug 29560: (follow-up) Split prepare and store logic

This allows for future removal of C4::Biblio::prepare_marc_host by
splitting the logic for generating the host field and storing the link
in the child record.
Comment 29 Martin Renvoize 2024-07-11 13:34:59 UTC
Created attachment 168824 [details] [review]
Bug 29560: Unit tests
Comment 30 Martin Renvoize 2024-07-11 13:35:02 UTC
Created attachment 168825 [details] [review]
Bug 29560: Unit tests: API
Comment 31 Martin Renvoize 2024-07-11 13:35:59 UTC
Doh.. main moved!

Rebased again
Comment 32 Kyle M Hall 2024-07-12 10:37:08 UTC
Created attachment 168885 [details] [review]
Bug 29560: Add link_marc_host to Koha::Biblio

This patch adds the new `link_marc_host` method to Koha::Biblio to
facilitate adding a host link to the marc record of this biblio.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 33 Kyle M Hall 2024-07-12 10:37:26 UTC
Created attachment 168886 [details] [review]
Bug 29560: Add option to create MARC Links when bundling items

This patch add a checkbox to the 'Add to bundle' modal allowing the user
to optionally add MARC links between the new child record and the
current biblio. For MARC21 this will result in a 773 pointing to the
host from the item record and for UNIMARC a 461 field will be added.

Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 34 Kyle M Hall 2024-07-12 10:37:28 UTC
Created attachment 168887 [details] [review]
Bug 29560: (follow-up) Split prepare and store logic

This allows for future removal of C4::Biblio::prepare_marc_host by
splitting the logic for generating the host field and storing the link
in the child record.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 35 Kyle M Hall 2024-07-12 10:37:31 UTC
Created attachment 168888 [details] [review]
Bug 29560: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 36 Kyle M Hall 2024-07-12 10:37:33 UTC
Created attachment 168889 [details] [review]
Bug 29560: Unit tests: API

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 37 Katrin Fischer 2024-07-15 08:58:49 UTC
FOR THIS PATCH SET:

1) Is the comma here correct/intended?

 $sfd{w} = $host_field->data(),;


FOR OTHER BUGS (if you want):

1) I think we should adjust to also take RDA records using 264 into account here. At least for us these are now the majority of records.

+        # Publication
+        if ( $host_field = $marc_host->field('260') ) {
+            my $s = $host_field->as_string('abc');
+            if ($s) {
+                $sfd{d} = $s;
+            }
+        }


2) This should take $n$p into account as well, as otherwise a multi-part work will not be distinguishable from the title:

+        # Title
+        if ( $host_field = $marc_host->field('245') ) {
+            my $s = $host_field->as_string('ab');
+            if ($s) {
+                $sfd{t} = $s;
+            }
+        }
Comment 38 Katrin Fischer 2024-07-15 09:07:06 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 39 Martin Renvoize 2024-07-15 09:18:17 UTC
(In reply to Katrin Fischer from comment #37)
> FOR THIS PATCH SET:
> 
> 1) Is the comma here correct/intended?
> 
>  $sfd{w} = $host_field->data(),;

That's certainly a typo.

> 
> FOR OTHER BUGS (if you want):
> 
> 1) I think we should adjust to also take RDA records using 264 into account
> here. At least for us these are now the majority of records.
> 
> +        # Publication
> +        if ( $host_field = $marc_host->field('260') ) {
> +            my $s = $host_field->as_string('abc');
> +            if ($s) {
> +                $sfd{d} = $s;
> +            }
> +        }
> 
> 
> 2) This should take $n$p into account as well, as otherwise a multi-part
> work will not be distinguishable from the title:
> 
> +        # Title
> +        if ( $host_field = $marc_host->field('245') ) {
> +            my $s = $host_field->as_string('ab');
> +            if ($s) {
> +                $sfd{t} = $s;
> +            }
> +        }

I'm more than happy to be guided on cataloguing standards.. I'm a mere dev without enough real cataloging knowledge to get this 100% right without guidance :)
Comment 40 Martin Renvoize 2024-07-15 10:24:53 UTC
Created attachment 168968 [details] [review]
Bug 29560: (follow-up) Clean up trailing comma

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 41 Katrin Fischer 2024-07-15 11:45:54 UTC
Follow-up pushed to main.
Comment 42 Katrin Fischer 2024-07-15 15:06:44 UTC
I filed:
Bug 37364 - Improve creation of 773 fields for item bundles regarding MARC21 245 and 264

Removing additional_work_needed.