View | Details | Raw Unified | Return to bug 29560
Collapse All | Expand All

(-)a/Koha/REST/V1/Items.pm (+5 lines)
Lines 316-321 sub add_to_bundle { Link Here
316
    return $c->render_resource_not_found("Bundle item")
316
    return $c->render_resource_not_found("Bundle item")
317
        unless $bundle_item;
317
        unless $bundle_item;
318
318
319
    my $add_link = $c->validation->param('body')->{'marc_link'} // 0;
319
    return try {
320
    return try {
320
        my $options = {
321
        my $options = {
321
            force_checkin => $body->{force_checkin},
322
            force_checkin => $body->{force_checkin},
Lines 323-328 sub add_to_bundle { Link Here
323
        };
324
        };
324
325
325
        my $link = $item->add_to_bundle($bundle_item, $options);
326
        my $link = $item->add_to_bundle($bundle_item, $options);
327
        if ($add_link) {
328
            $bundle_item->biblio->link_marc_host(
329
                { biblionumber => $item->biblio->biblionumber } );
330
        }
326
        return $c->render(
331
        return $c->render(
327
            status  => 201,
332
            status  => 201,
328
            openapi => $bundle_item
333
            openapi => $bundle_item
(-)a/api/v1/swagger/definitions/bundle_link.yaml (+3 lines)
Lines 19-22 properties: Link Here
19
    type:
19
    type:
20
      - boolean
20
      - boolean
21
      - "null"
21
      - "null"
22
  marc_link:
23
    type: boolean
24
    description: Is there a marc link for this item
22
additionalProperties: false
25
additionalProperties: false
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-4 / +8 lines)
Lines 1074-1079 Link Here
1074
                                        <input type="text" id="external_id" name="external_id" required="required">
1074
                                        <input type="text" id="external_id" name="external_id" required="required">
1075
                                        <span class="required">Required</span>
1075
                                        <span class="required">Required</span>
1076
                                    </li>
1076
                                    </li>
1077
                                    <li>
1078
                                        <label for="bundle_link">Add MARC link: </label>
1079
                                        <input type="checkbox" name="bundle_link"/>
1080
                                    </li>
1077
                                </ol>
1081
                                </ol>
1078
                            </fieldset>
1082
                            </fieldset>
1079
                        </div>
1083
                        </div>
Lines 1712-1717 Link Here
1712
                    });
1716
                    });
1713
1717
1714
                    const barcode = data.external_id;
1718
                    const barcode = data.external_id;
1719
                    const marc_link = data.marc_link;
1715
1720
1716
                    /* Report the results */
1721
                    /* Report the results */
1717
                    posting.done(function(data) {
1722
                    posting.done(function(data) {
Lines 1731-1737 Link Here
1731
                                    .addClass('btn btn-xs')
1736
                                    .addClass('btn btn-xs')
1732
                                    .text(_("Check in and add to bundle"))
1737
                                    .text(_("Check in and add to bundle"))
1733
                                    .on('click', function () {
1738
                                    .on('click', function () {
1734
                                        addToBundle(url, { external_id: barcode, force_checkin: true });
1739
                                        addToBundle(url, { external_id: barcode, force_checkin: true, marc_link: marc_link });
1735
                                    });
1740
                                    });
1736
                                $('#addResult')
1741
                                $('#addResult')
1737
                                    .empty()
1742
                                    .empty()
Lines 1748-1754 Link Here
1748
                                    .addClass('btn btn-xs')
1753
                                    .addClass('btn btn-xs')
1749
                                    .text(_("Ignore holds and add to bundle"))
1754
                                    .text(_("Ignore holds and add to bundle"))
1750
                                    .on('click', function () {
1755
                                    .on('click', function () {
1751
                                        addToBundle(url, { external_id: barcode, ignore_holds: true });
1756
                                        addToBundle(url, { external_id: barcode, ignore_holds: true, marc_link: marc_link });
1752
                                    });
1757
                                    });
1753
                                $('#addResult')
1758
                                $('#addResult')
1754
                                    .empty()
1759
                                    .empty()
Lines 1779-1785 Link Here
1779
                    event.preventDefault();
1784
                    event.preventDefault();
1780
1785
1781
                    const url = this.action;
1786
                    const url = this.action;
1782
                    const data = { external_id: this.elements.external_id.value };
1787
                    const data = { external_id: this.elements.external_id.value, marc_link: this.elements.bundle_link.checked };
1783
1788
1784
                    addToBundle(url, data);
1789
                    addToBundle(url, data);
1785
                });
1790
                });
1786
- 

Return to bug 29560