@@ -, +, @@ profile changes --- .../data/mysql/atomicupdate/AutoApprovePatronProfileSettings.sql | 2 ++ .../intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ opac/opac-memberentry.pl | 9 +++++++++ 3 files changed, 17 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/AutoApprovePatronProfileSettings.sql --- a/installer/data/mysql/atomicupdate/AutoApprovePatronProfileSettings.sql +++ a/installer/data/mysql/atomicupdate/AutoApprovePatronProfileSettings.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES +('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve Patron profile changes.', 'YesNo'); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -73,6 +73,12 @@ Patrons: - track last patron activity. - Every time a patron will connect, the borrowers.lastseen will be updated with the current time. - + - pref: AutoApprovePatronProfileSettings + choices: + yes: Enable + no: Disable + - "Automatically approve Patron profile changes." + - - pref: ProtectSuperlibrarianPrivileges choices: yes: Allow only superlibrarians --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -25,6 +25,7 @@ use String::Random qw( random_string ); use C4::Auth; use C4::Output; +use C4::Context; use C4::Members; use C4::Form::MessagingPreferences; use Koha::AuthUtils; @@ -299,6 +300,14 @@ elsif ( $action eq 'update' ) { Koha::Patron::Modifications->search({ borrowernumber => $borrowernumber })->delete; my $m = Koha::Patron::Modification->new( \%borrower_changes )->store(); + #Automatically approve patron profile changes if set in syspref + + if (C4::Context->preference('AutoApprovePatronProfileSettings')) { + # Need to get the object from database, otherwise it is not complete enough to allow deletion + # when approval has been performed. + my $tmp_m = Koha::Patron::Modifications->find({borrowernumber => $borrowernumber}); + $tmp_m->approve() if $tmp_m; + } my $patron = Koha::Patrons->find( $borrowernumber ); $template->param( borrower => $patron->unblessed ); --