From d5a5e9576e3161e4b591ac910c88e7c703b89ee0 Mon Sep 17 00:00:00 2001 From: Martin Stenberg Date: Tue, 18 Aug 2015 16:41:42 +0200 Subject: [PATCH] Bug 14675: Don't update details if no changes made if no changes has been made for personal details, bring user back to details page and inform them that no changes has been made. Signed-off-by: Aleisha Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- .../bootstrap/en/modules/opac-memberentry.tt | 3 ++ opac/opac-memberentry.pl | 42 +++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index 4eed652f5f..d5408d54b9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -44,6 +44,9 @@ [% UNLESS OPACPatronDetails %]
To make changes to your record please contact the library.
[% END %] + [% IF nochanges %] +
No changes were made.
+ [% END %] [% END %] [% IF empty_mandatory_fields %] diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 116ba7f06e..f696208ec4 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -182,26 +182,34 @@ elsif ( $action eq 'update' ) { $template->param( action => 'edit' ); } else { - ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "opac-memberentry-update-submitted.tt", - type => "opac", - query => $cgi, - authnotrequired => 1, - } - ); - my %borrower_changes = DelUnchangedFields( $borrowernumber, %borrower ); + if (%borrower_changes) { + ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-memberentry-update-submitted.tt", + type => "opac", + query => $cgi, + authnotrequired => 1, + } + ); - my $m = - Koha::Borrower::Modifications->new( - borrowernumber => $borrowernumber ); + my $m = + Koha::Borrower::Modifications->new( + borrowernumber => $borrowernumber ); - $m->DelModifications; - $m->AddModifications(\%borrower_changes); - $template->param( - borrower => GetMember( borrowernumber => $borrowernumber ), - ); + $m->DelModifications; + $m->AddModifications(\%borrower_changes); + $template->param( + borrower => GetMember( borrowernumber => $borrowernumber ), + ); + } + else { + $template->param( + action => 'edit', + nochanges => 1, + borrower => GetMember( borrowernumber => $borrowernumber ), + ); + } } } elsif ( $action eq 'edit' ) { #Display logged in borrower's data -- 2.39.5