From c48e632bf4faf11332f99e7bf41c544ffe679b78 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 28 Mar 2024 11:42:03 -0300 Subject: [PATCH] Bug 33568: serialitem => serial_item MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomas Cohen Arazi Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi Signed-off-by: Katrin Fischer --- 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(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index aa24218876..0a955df7e5 100644 --- a/Koha/Item.pm +++ b/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); } diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 84a0bb8405..cc428b0a83 100644 --- a/Koha/Schema/Result/Item.pm +++ b/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 ) = @_; diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml index e74dc1b90f..e70ef75ecc 100644 --- a/api/v1/swagger/definitions/item.yaml +++ b/api/v1/swagger/definitions/item.yaml @@ -246,7 +246,7 @@ properties: type: - object - "null" - serialitem: + serial_item: type: - object - "null" diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml index 24d64d0ed4..10b2b42820 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/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" diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 5526d903fb..b1c599653a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/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 ) { -- 2.39.5