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 <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
$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(