From a546d960aaa233862974d5a9bbcf840d8cb691ed Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 3 Apr 2024 20:35:46 +0000 Subject: [PATCH] Bug 36508: Refresh patron object when updating category To test: 1 - Find a ptron, I sued #45 in KTD, note their category 2 - Update them from one category to another using finesunder: perl misc/cronjobs/update_patrons_category.pl -f ST -t S --finesunder=5.00 --where "me.borrowernumber=45" -v -c 3 - Check their modification log (I told you to enabled BorrowersLog, right?) 4 - See many fields reported changed 5 - Apply patch 6 - Repeat, but change the to and from options perl misc/cronjobs/update_patrons_category.pl -f S -t ST --finesunder=5.00 --where "me.borrowernumber=45" -v -c 7 - Note only one column changed in the logs 8 - Ask for unit tests Signed-off-by: Owen Leonard Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer (cherry picked from commit cae2efd69d8ad63822914377733f9819889a0ec1) Signed-off-by: Fridolin Somers (cherry picked from commit 2ff0a6578311f029def133446c99a7c7576b8ae0) Signed-off-by: Lucas Gass --- Koha/Patrons.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm index c210f53f4b..965d9866a1 100644 --- a/Koha/Patrons.pm +++ b/Koha/Patrons.pm @@ -400,6 +400,7 @@ sub update_category_to { my ( $self, $params ) = @_; my $counter = 0; while( my $patron = $self->next ) { + $patron->discard_changes; $counter++; $patron->categorycode($params->{category})->store(); } -- 2.39.5