@@ -, +, @@ --- Koha/Item.pm | 6 +++--- Koha/Schema/Result/Item.pm | 7 +++++++ api/v1/swagger/definitions/item.yaml | 2 +- api/v1/swagger/paths/biblios.yaml | 2 +- .../html_helpers/tables/items/catalogue_detail.inc | 4 ++-- 5 files changed, 14 insertions(+), 7 deletions(-) --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -470,13 +470,13 @@ sub checkout { return Koha::Checkout->_new_from_dbic( $checkout_rs ); } -=head3 serialitem +=head3 serial_item =cut -sub serialitem { +sub serial_item { my ( $self ) = @_; - my $rs = $self->_result->serialitem; + my $rs = $self->_result->serial_item; return unless $rs; return Koha::Serial::Item->_new_from_dbic($rs); } --- a/Koha/Schema/Result/Item.pm +++ a/Koha/Schema/Result/Item.pm @@ -1062,6 +1062,13 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); +__PACKAGE__->might_have( + "serial_item", + "Koha::Schema::Result::Serialitem", + { "foreign.itemnumber" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + use C4::Context; sub effective_itemtype { my ( $self ) = @_; --- a/api/v1/swagger/definitions/item.yaml +++ a/api/v1/swagger/definitions/item.yaml @@ -246,7 +246,7 @@ properties: type: - object - "null" - serialitem: + serial_item: type: - object - "null" --- a/api/v1/swagger/paths/biblios.yaml +++ a/api/v1/swagger/paths/biblios.yaml @@ -446,7 +446,7 @@ - analytics_count - cover_image_ids - item_group_item.item_group.description - - serialitem.serial + - serial_item.serial collectionFormat: csv - $ref: "../swagger.yaml#/parameters/match" - $ref: "../swagger.yaml#/parameters/order_by" --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -217,7 +217,7 @@ embed.push('item_group_item.item_group.description'); [% END %] [% IF biblio.serial %] - embed.push('serialitem.serial'); + embed.push('serial_item.serial'); [% END %] [% IF Koha.Preference('UseRecalls') %] embed.push('recall', 'recall+strings', 'recall.patron') @@ -428,7 +428,7 @@ render: function (data, type, row, meta) { let nodes = ""; [%# FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? %] - let serial = row.serialitem ? row.serialitem.serial : null; + let serial = row.serial_item ? row.serial_item.serial : null; if ( row.serial_issue_number && serial && serial.serialseq ) { nodes += '%s'.format(escape_str(row.serial_issue_number)); if ( serial.serialseq && row.serial_issue_number != serial.serialseq ) { --