From 1bb6cec902088d07c7a43addc4b4adb5b0bf3d4f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 23 Feb 2018 13:12:36 -0300 Subject: [PATCH] Bug 20287: Fix update of patrons, clean the data before ->store Signed-off-by: Josef Moravec Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens --- members/memberentry.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 26853b042e..041dda23f6 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -223,6 +223,7 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) qr/^\d+-DAYS/, qr/^patron_attr_/, qr/^csrf_token$/, + qr/^add_debarment$/, qr/^debarred_expiration$/ # We already dealt with debarments previously ); for my $regexp (@keys_to_delete) { for (keys %newdata) { @@ -524,7 +525,12 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ delete $newdata{'password'}; delete $newdata{'userid'}; } - &ModMember(%newdata) unless scalar(keys %newdata) <= 1; # bug 4508 - avoid crash if we're not + + my $patron = Koha::Patrons->find( $borrowernumber ); + $newdata{debarredcomment} = $newdata{debarred_comment}; + delete $newdata{debarred_comment}; + delete $newdata{password2}; + $patron->set(\%newdata)->store if scalar(keys %newdata) > 1; # bug 4508 - avoid crash if we're not # updating any columns in the borrowers table, # which can happen if we're only editing the # patron attributes or messaging preferences sections -- 2.39.5