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> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
4753b73285
commit
ea3065aeef
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue