From 68407f4cf06b4063241582183c65cc66278f2c37 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 19 Aug 2016 13:39:35 +0100 Subject: [PATCH] Bug 16960: Delete previous patron modifications If a patron edit his/her details a second time, we need to delete the first ones to avoid a "duplicate entry for key PRIMARY" error. Test plan: Log in at the OPAC Edit your details Edit them again => Without this patch, Koha will crash => With the patch applied, everything should work as expected Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- opac/opac-memberentry.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 1bf5acf433..1a5bac49ef 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -227,6 +227,14 @@ elsif ( $action eq 'update' ) { $borrower_changes{borrowernumber} = $borrowernumber; + # FIXME update the following with + # Koha::Patron::Modifications->search({ borrowernumber => $borrowernumber })->delete; + # when bug 17091 will be pushed + my $patron_modifications = Koha::Patron::Modifications->search({ borrowernumber => $borrowernumber }); + while ( my $patron_modification = $patron_modifications->next ) { + $patron_modification->delete; + } + my $m = Koha::Patron::Modification->new( \%borrower_changes )->store(); $template->param( -- 2.39.5