From 5be225ff7d54fbb0f198f79500d0162476e48eb1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 19 Aug 2016 13:39:35 +0100 Subject: [PATCH] [PASSED QA] 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 --- opac/opac-memberentry.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 1bf5acf..1a5bac4 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.7.4