diff --git a/C4/Reserves.pm b/C4/Reserves.pm index fc22959d70..b4feffbe09 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -262,7 +262,7 @@ sub AddReserve { } )->store(); - $hold->iso18626_attach_hold($supplyill); + $hold->iso18626_attach_hold_and_biblio($supplyill); $hold->set_waiting() if $found && $found eq 'W'; diff --git a/Koha/Hold.pm b/Koha/Hold.pm index a88163ae35..03bc85dfbf 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -708,19 +708,20 @@ sub iso18626_request { return Koha::ILL::ISO18626::Request->_new_from_dbic($rs); } -=head3 iso18626_attach_hold +=head3 iso18626_attach_hold_and_biblio -Adds relationship to related this hold +Adds iso18626 request relationship to this hold and respective biblio =cut -sub iso18626_attach_hold { +sub iso18626_attach_hold_and_biblio { my ( $self, $iso18626_request_id ) = @_; my $iso18626_request = Koha::ILL::ISO18626::Requests->find($iso18626_request_id); return unless $iso18626_request; $iso18626_request->hold_id( $self->id )->store; + $iso18626_request->biblio_id( $self->biblionumber )->store; } =head3 item diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 7d2ce13fa0..1793f2335c 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -385,6 +385,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 iso18626_requests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "iso18626_requests", + "Koha::Schema::Result::Iso18626Request", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 item_groups Type: has_many @@ -641,8 +656,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-12-18 12:10:28 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QXaEHXqH2ApC+F22zo7gXA +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-24 16:20:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vJ2DesuhA1j09zJFBJVvVw __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Iso18626Request.pm b/Koha/Schema/Result/Iso18626Request.pm index ef00aa4088..486b6f0666 100644 --- a/Koha/Schema/Result/Iso18626Request.pm +++ b/Koha/Schema/Result/Iso18626Request.pm @@ -116,6 +116,14 @@ ID of the hold related to this ISO18626 request ID of the checkout related to this ISO18626 request +=head2 biblio_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +ID of the biblio related to this ISO18626 request + =cut __PACKAGE__->add_columns( @@ -191,6 +199,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "issue_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "biblio_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -233,6 +243,26 @@ __PACKAGE__->add_unique_constraint("uniq_reserve_id", ["hold_id"]); =head1 RELATIONS +=head2 biblio + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblio", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblio_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 hold Type: belongs_to @@ -306,8 +336,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-24 13:40:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IYorMR5/Rcx1W9dZv2WVSw +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-24 16:20:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UVWpopKYUM2me5GnUwLPxw =head2 koha_object_class diff --git a/api/v1/swagger/definitions/iso18626_request.yaml b/api/v1/swagger/definitions/iso18626_request.yaml index fcdcad3843..ccce49cf1d 100644 --- a/api/v1/swagger/definitions/iso18626_request.yaml +++ b/api/v1/swagger/definitions/iso18626_request.yaml @@ -62,6 +62,11 @@ properties: - object - "null" description: Embeded object + biblio_id: + type: + - integer + - "null" + description: Associated bib record internal identifier messages: type: - array diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 460b16d5bc..1042e9bb8a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3822,12 +3822,15 @@ CREATE TABLE `iso18626_requests` ( `pending_requesting_agency_action` enum('Cancel','Renew') DEFAULT NULL COMMENT 'ISO18626 Requesting Agency action that requires a manual response (yes or no)', `hold_id` int(11) DEFAULT NULL COMMENT 'ID of the hold related to this ISO18626 request', `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout related to this ISO18626 request', + `biblio_id` int(11) DEFAULT NULL COMMENT 'ID of the biblio related to this ISO18626 request', PRIMARY KEY (`iso18626_request_id`), UNIQUE KEY `uniq_reserve_id` (`hold_id`), UNIQUE KEY `uniq_issue_id` (`issue_id`), + KEY `iso18626_bibfk` (`biblio_id`), KEY `iso18626_rafk` (`iso18626_requesting_agency_id`), CONSTRAINT `uniq_reserve_id` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `uniq_issue_id` FOREIGN KEY (`issue_id`) REFERENCES `issues` (`issue_id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `iso18626_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `iso18626_rafk` FOREIGN KEY (`iso18626_requesting_agency_id`) REFERENCES `iso18626_requesting_agencies` (`iso18626_requesting_agency_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ILL/SupplyingResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ILL/SupplyingResource.vue index ce08939d55..ba67af55ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ILL/SupplyingResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ILL/SupplyingResource.vue @@ -830,6 +830,22 @@ export default { hideIn: ["List", "Form"], group: $__("Request details"), }, + { + name: "biblio_id", + label: $__("Bibliographic record"), + type: "text", + hideIn: ["List", "Form"], + showElement: { + value: "biblio_id", + link: { + href: "/cgi-bin/koha/catalogue/detail.pl", + params: { + biblionumber: "biblio_id", + }, + }, + }, + group: $__("Request details"), + }, { name: "hold_id", label: $__("Hold on biblio"),