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

(-)a/Koha/REST/V1/Items.pm (-1 / +5 lines)
Lines 199-205 sub add_to_bundle { Link Here
199
        );
199
        );
200
    }
200
    }
201
201
202
203
    my $bundle_item_id = $c->validation->param('body')->{'external_id'};
202
    my $bundle_item_id = $c->validation->param('body')->{'external_id'};
204
    my $bundle_item = Koha::Items->find( { barcode => $bundle_item_id } );
203
    my $bundle_item = Koha::Items->find( { barcode => $bundle_item_id } );
205
204
Lines 210-217 sub add_to_bundle { Link Here
210
        );
209
        );
211
    }
210
    }
212
211
212
    my $add_link = $c->validation->param('body')->{'marc_link'} // 0;
213
    return try {
213
    return try {
214
        my $link = $item->add_to_bundle($bundle_item);
214
        my $link = $item->add_to_bundle($bundle_item);
215
        if ($add_link) {
216
            $bundle_item->biblio->link_marc_host(
217
                { biblionumber => $item->biblio->biblionumber } );
218
        }
215
        return $c->render(
219
        return $c->render(
216
            status  => 201,
220
            status  => 201,
217
            openapi => $bundle_item
221
            openapi => $bundle_item
(-)a/api/v1/swagger/definitions/bundle_link.yaml (+3 lines)
Lines 11-14 properties: Link Here
11
      - string
11
      - string
12
      - "null"
12
      - "null"
13
    description: Item barcode
13
    description: Item barcode
14
  marc_link:
15
    type: boolean
16
    description: Is there a marc link for this item
14
additionalProperties: false
17
additionalProperties: false
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +5 lines)
Lines 1080-1085 Note that permanent location is a code, and location may be an authval. Link Here
1080
                                    <input type="text" id="external_id" name="external_id" required="required">
1080
                                    <input type="text" id="external_id" name="external_id" required="required">
1081
                                    <span class="required">Required</span>
1081
                                    <span class="required">Required</span>
1082
                                </li>
1082
                                </li>
1083
                                <li>
1084
                                    <label for="bundle_link">Add MARC link: </label>
1085
                                    <input type="checkbox" name="bundle_link"/>
1086
                                </li>
1083
                            </ol>
1087
                            </ol>
1084
                        </fieldset>
1088
                        </fieldset>
1085
                    </div>
1089
                    </div>
Lines 1599-1605 Note that permanent location is a code, and location may be an authval. Link Here
1599
                  /* Send the data using post with external_id */
1603
                  /* Send the data using post with external_id */
1600
                  var posting = $.post({
1604
                  var posting = $.post({
1601
                      url: url,
1605
                      url: url,
1602
                      data: JSON.stringify({ external_id: $('#external_id').val()}),
1606
                      data: JSON.stringify({ external_id: $('#external_id').val(), marc_link: $('#link').prop('checked') }),
1603
                      contentType: "application/json; charset=utf-8",
1607
                      contentType: "application/json; charset=utf-8",
1604
                      dataType: "json"
1608
                      dataType: "json"
1605
                  });
1609
                  });
1606
- 

Return to bug 29560