Bug 37762: Catalogue: Hook to biblios

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2026-02-24 12:23:53 -01:00 committed by Lucas Gass
parent db7854682e
commit c32d08e560
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
7 changed files with 78 additions and 8 deletions

View File

@ -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';

View File

@ -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

View File

@ -385,6 +385,21 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 iso18626_requests
Type: has_many
Related object: L<Koha::Schema::Result::Iso18626Request>
=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",

View File

@ -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<Koha::Schema::Result::Biblio>
=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

View File

@ -62,6 +62,11 @@ properties:
- object
- "null"
description: Embeded object
biblio_id:
type:
- integer
- "null"
description: Associated bib record internal identifier
messages:
type:
- array

View File

@ -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 */;

View File

@ -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"),