From cae2efd69d8ad63822914377733f9819889a0ec1 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 --- Koha/Patrons.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm index 92d3918363..eb89573312 100644 --- a/Koha/Patrons.pm +++ b/Koha/Patrons.pm @@ -399,6 +399,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