Bugzilla – Attachment 186756 Details for
Bug 40850
Add `Koha::ILL::Request->add_or_update_attributes`
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40850: (follow-up) Use add_or_update_attributes in copyright clearance methods
Bug-40850-follow-up-Use-addorupdateattributes-in-c.patch (text/plain), 2.00 KB, created by
Martin Renvoize (ashimema)
on 2025-09-22 20:55:58 UTC
(
hide
)
Description:
Bug 40850: (follow-up) Use add_or_update_attributes in copyright clearance methods
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-09-22 20:55:58 UTC
Size:
2.00 KB
patch
obsolete
>From 7524c58bebca40d77234c84618b983eac0bcd9ea Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Mon, 22 Sep 2025 15:16:12 -0300 >Subject: [PATCH] Bug 40850: (follow-up) Use add_or_update_attributes in > copyright clearance methods > >This patch simplifies the set_copyright_clearance_confirmed() method >to use the new add_or_update_attributes() method instead of custom >update/create logic. > >Benefits: >- Reduces code complexity from 20+ lines to 6 lines >- Eliminates duplicate update/create logic >- Uses the new standardized method for attribute management >- Maintains all existing functionality and test coverage > >Test plan: >1. Apply patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/ILL/Request.t >=> SUCCESS: Tests pass! Copyright clearance methods work with new implementation >3. Test copyright clearance workflow still works in ILL module >4. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/ILL/Request.pm | 20 ++------------------ > 1 file changed, 2 insertions(+), 18 deletions(-) > >diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm >index f6892fc7e29..0f4e0af8a18 100644 >--- a/Koha/ILL/Request.pm >+++ b/Koha/ILL/Request.pm >@@ -1319,25 +1319,9 @@ sub set_copyright_clearance_confirmed { > # Normalize to boolean: 0 or 1 > my $value = $confirmed ? 1 : 0; > >- # Check if attribute already exists >- my $existing_attr = $self->extended_attributes->find( { type => 'copyrightclearance_confirmed' } ); >+ $self->add_or_update_attributes( { copyrightclearance_confirmed => $value } ); > >- if ($existing_attr) { >- >- # Update existing attribute >- $existing_attr->value($value)->store; >- } else { >- >- # Create new attribute >- $self->extended_attributes( >- [ >- { >- type => 'copyrightclearance_confirmed', >- value => $value, >- } >- ] >- ); >- } >+ return $self; > } > > =head3 add_or_update_attributes >-- >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 40850
:
186734
|
186735
|
186736
|
186755
| 186756 |
186757