Koha/members/members-update-do.pl
Lari Taskula 8c094e2dc3 Bug 19400: Reminder to unset gone no address flag after patron makes a modification request
Our librarians requested a reminder to unset "gone no address" flag from patron's
record once the patron has made a modification request to update their address.

I propose adding a message box under patron modification request to notify
librarians about patrons that have gone no address flag on, and an option to
unset the flag without the need of having to navigate into patron's details.

To test:
1. Apply patch
2. Set "Gone no address" flag for your test patron. You can do this by going
   to patron modification screen in staff client.
3. Go to OPAC with your test patron
4. Make a modification request for your personal details
5. Go to staff client and see pending modification requests
6. Open the request you just created
7. Observe a message dialog that says this patron has gone no address flag set
8. Check the checkbox to unset the flag and approve the modification request
9. Click Submit
10. Observe your test patron no longer has gone no address flag set
11. Repeat steps 2-7
12. Do not check the checkbox, but approve the modification request
13. Observe your test patron still has gone no address flag set
14. Remove the gone no address flag from your test patron
15. Repeat steps 3-6
16. Observe there is no message dialog for gone no address

Followed test plan, patch worked as described. Also ran QA test tools
and all modified files passed

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-10-27 16:05:51 -03:00

71 lines
2 KiB
Perl
Executable file

#!/usr/bin/perl
# Parts Copyright Biblibre 2010
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
use warnings;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Output;
use C4::Context;
use C4::Members;
use Koha::Patron::Modifications;
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "about.tt",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => { borrowers => 1 },
debug => 1,
}
);
my @params = $query->param;
foreach my $param (@params) {
if ( $param =~ "^modify_" ) {
my (undef, $borrowernumber) = split( /_/, $param );
my $action = $query->param($param);
if ( $action eq 'approve' ) {
my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } );
if ($query->param("unset_gna_$borrowernumber")) {
# Unset gone no address
ModMember(
borrowernumber => $borrowernumber,
gonenoaddress => undef
);
}
$m->approve() if $m;
}
elsif ( $action eq 'deny' ) {
my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } );
$m->delete() if $m;
}
# elsif ( $action eq 'ignore' ) { }
}
}
print $query->redirect("/cgi-bin/koha/members/members-update.pl");