Bugzilla – Attachment 186439 Details for
Bug 40808
Consider a link table for accountlines to varying other Koha tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40808: Add schema relationships for polymorphic account line linking
Bug-40808-Add-schema-relationships-for-polymorphic.patch (text/plain), 2.27 KB, created by
Martin Renvoize (ashimema)
on 2025-09-15 18:00:45 UTC
(
hide
)
Description:
Bug 40808: Add schema relationships for polymorphic account line linking
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-09-15 18:00:45 UTC
Size:
2.27 KB
patch
obsolete
>From d2ca1c8631d51c2493946d226a6c1ee65e4420ed Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 15 Sep 2025 13:26:46 +0100 >Subject: [PATCH] Bug 40808: Add schema relationships for polymorphic account > line linking > >Adds the necessary DBIx::Class relationships to support polymorphic >linking between account lines and various entities: > >1. Koha::Schema::Result::Reserve - Adds accountline_links relationship > to enable holds to find their linked account lines > >2. Koha::Schema::Result::AccountlineLink - Enhanced polymorphic methods > for accessing linked objects and validation > >These relationships enable proper traversal from holds to account lines >and support the polymorphic linking system. >--- > Koha/Schema/Result/AccountlineLink.pm | 22 +++++++++++++++++++++- > Koha/Schema/Result/Reserve.pm | 13 +++++++++++++ > 2 files changed, 34 insertions(+), 1 deletion(-) > >diff --git a/Koha/Schema/Result/AccountlineLink.pm b/Koha/Schema/Result/AccountlineLink.pm >index bc18dbca6f8..4b2627b4796 100644 >--- a/Koha/Schema/Result/AccountlineLink.pm >+++ b/Koha/Schema/Result/AccountlineLink.pm >@@ -192,5 +192,25 @@ sub validate_link_integrity { > return defined($linked_object) ? 1 : 0; > } > >+=head2 koha_objects_class >+ >+Missing POD for koha_objects_class. >+ >+=cut >+ >+sub koha_objects_class { >+ 'Koha::Account::Links'; >+} >+ >+=head2 koha_object_class >+ >+Missing POD for koha_object_class. >+ >+=cut >+ >+sub koha_object_class { >+ 'Koha::Account::Link'; >+} >+ > # You can replace this text with custom code or comments, and it will be preserved on regeneration >-1; >\ No newline at end of file >+1; >diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm >index 3e65b00f67c..ac23c2cb20e 100644 >--- a/Koha/Schema/Result/Reserve.pm >+++ b/Koha/Schema/Result/Reserve.pm >@@ -588,4 +588,17 @@ __PACKAGE__->belongs_to( > { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > >+__PACKAGE__->has_many( >+ "accountline_links", >+ "Koha::Schema::Result::AccountlineLink", >+ sub { >+ my ($args) = @_; >+ return { >+ "$args->{foreign_alias}.link_type" => 'hold', >+ "$args->{foreign_alias}.linked_id" => { '=' => { -ident => "$args->{self_alias}.reserve_id" } }, >+ }; >+ }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > 1; >-- >2.51.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40808
:
186436
|
186437
|
186438
|
186439
|
186440
|
186441
|
186442
|
186443
|
186458
|
186459
|
186460
|
186461
|
186462
|
186463
|
186464
|
186465