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

(-)a/Koha/Item.pm (-1 / +24 lines)
Lines 385-392 sub effective_itemtype { Link Here
385
=cut
385
=cut
386
386
387
sub home_branch {
387
sub home_branch {
388
    my ($self) = @_;
388
    return shift->home_library(@_);
389
}
390
391
=head3 home_library
392
393
my $library = $item->home_library
389
394
395
Return the Koha::Library object representing the home library
396
397
=cut
398
399
sub home_library {
400
    my ($self) = @_;
390
    my $hb_rs = $self->_result->homebranch;
401
    my $hb_rs = $self->_result->homebranch;
391
402
392
    return Koha::Library->_new_from_dbic( $hb_rs );
403
    return Koha::Library->_new_from_dbic( $hb_rs );
Lines 397-402 sub home_branch { Link Here
397
=cut
408
=cut
398
409
399
sub holding_branch {
410
sub holding_branch {
411
    return shift->home_library(@_);
412
}
413
414
=head3 holding_library
415
416
my $library = $item->holding_library
417
418
Return the Koha::Library object representing the holding library
419
420
=cut
421
422
sub holding_library {
400
    my ($self) = @_;
423
    my ($self) = @_;
401
424
402
    my $hb_rs = $self->_result->holdingbranch;
425
    my $hb_rs = $self->_result->holdingbranch;
(-)a/Koha/Schema/Result/Item.pm (+24 lines)
Lines 995-1000 __PACKAGE__->belongs_to( Link Here
995
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
995
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
996
);
996
);
997
997
998
__PACKAGE__->belongs_to(
999
  "holding_library",
1000
  "Koha::Schema::Result::Branch",
1001
  { branchcode => "holdingbranch" },
1002
  {
1003
    is_deferrable => 1,
1004
    join_type     => "LEFT",
1005
    on_delete     => "RESTRICT",
1006
    on_update     => "CASCADE",
1007
  },
1008
);
1009
1010
__PACKAGE__->belongs_to(
1011
  "home_library",
1012
  "Koha::Schema::Result::Branch",
1013
  { branchcode => "homebranch" },
1014
  {
1015
    is_deferrable => 1,
1016
    join_type     => "LEFT",
1017
    on_delete     => "RESTRICT",
1018
    on_update     => "CASCADE",
1019
  },
1020
);
1021
998
__PACKAGE__->add_columns(
1022
__PACKAGE__->add_columns(
999
    '+bookable'                          => { is_boolean => 1 },
1023
    '+bookable'                          => { is_boolean => 1 },
1000
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
1024
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
(-)a/api/v1/swagger/definitions/item.yaml (+8 lines)
Lines 230-235 properties: Link Here
230
    type:
230
    type:
231
      - object
231
      - object
232
      - "null"
232
      - "null"
233
  home_library:
234
    type:
235
      - object
236
      - "null"
237
  holding_library:
238
    type:
239
      - object
240
      - "null"
233
  cover_image_ids:
241
  cover_image_ids:
234
    type:
242
    type:
235
      - array
243
      - array
(-)a/api/v1/swagger/paths/biblios.yaml (+2 lines)
Lines 423-428 Link Here
423
          type: string
423
          type: string
424
          enum:
424
          enum:
425
            - +strings
425
            - +strings
426
            - home_library
427
            - holding_library
426
            - biblio.title
428
            - biblio.title
427
            - checkout
429
            - checkout
428
            - checkout.patron
430
            - checkout.patron
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-3 / +3 lines)
Lines 179-184 Link Here
179
    [%# Do we need separate/new endpoints or do we hack the somewhere client-side? %]
179
    [%# Do we need separate/new endpoints or do we hack the somewhere client-side? %]
180
    let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
180
    let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
181
    let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk,item_type"];
181
    let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk,item_type"];
182
    embed.push('home_library', 'holding_library');
182
    [% IF Koha.Preference('LocalCoverImages') %]
183
    [% IF Koha.Preference('LocalCoverImages') %]
183
        embed.push('cover_image_ids');
184
        embed.push('cover_image_ids');
184
    [% END %]
185
    [% END %]
Lines 300-306 Link Here
300
            },
301
            },
301
            [% END %]
302
            [% END %]
302
            {
303
            {
303
                data: "me.holding_library_id",
304
                data: "me.holding_library_id:holding_library.name",
304
                className: "location",
305
                className: "location",
305
                searchable: true,
306
                searchable: true,
306
                orderable: true,
307
                orderable: true,
Lines 309-315 Link Here
309
                }
310
                }
310
            },
311
            },
311
            {
312
            {
312
                data: "me.home_library_id",
313
                data: "me.home_library_id:home_library.name",
313
                className: "homebranch",
314
                className: "homebranch",
314
                searchable: true,
315
                searchable: true,
315
                orderable: true,
316
                orderable: true,
316
- 

Return to bug 33568