From 5e9315eee80cbe56ff75aca9e9df03c14c160885 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 2 Aug 2024 17:42:54 +0000 Subject: [PATCH] Bug 37562: Add patron title to duplicate patron warning and don't show popup if cannot see patron This patch passes the suspected duplicate to the template and uses patron title to display very brief info. If the user cannot view the patron there is no longer a link tot he brief popup and they will only see 'A patron from library X" There is a FIXME asking if we should use search_limited - I believe we should check all branches, so the staff can ask the patron if they have an exising account in a consortium depending on rules about multiple cards To test: 1 - Edit a user to grant catalogue and all borrower permissions except 'view_borrower_infos_from_any_libraries' 2 - Find a patron from a different library and note surname and firstname 3 - Login as the patron above 4 - Enter a new patron with the same surname and firstname 5 - See the 'Duplicate patron' warning 6 - Click to view the patron 7 - No info is listed 8 - Apply patch 9 - Reload and resubmit - or fill out form again 10 - Note that you see 'A patron from library XXX' and no popup link 11 - Add view_borrower_infos_from_any_libraries to the staff 12 - Repeat the duplication and confirm the warning now has patron name and the popup link is visible and works Signed-off-by: Sam Lau Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer (cherry picked from commit bdf224c65393fd7ee5fc9a2d037984c6845e9c26) Signed-off-by: Lucas Gass --- .../prog/en/modules/members/memberentrygen.tt | 5 ++++- members/memberentry.pl | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 806b41c094..daefdf6774 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -143,7 +143,10 @@ legend.collapsed i.fa.fa-caret-down::before { [% IF ( check_member ) %]

Duplicate patron record?

-

View existing record

+

[%- INCLUDE 'patron-title.inc' patron => check_patron hide_patron_infos_if_needed => 1 -%]

+ [% IF logged_in_user.can_see_patron_infos( check_patron ) %] +

View existing record

+ [% END %] It is a duplicate. Edit existing record
diff --git a/members/memberentry.pl b/members/memberentry.pl index 8903ecfcfa..3508cd25b7 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -82,6 +82,7 @@ my $check_member = $input->param('check_member'); my $nodouble = $input->param('nodouble'); my $duplicate = $input->param('duplicate'); my $quickadd = $input->param('quickadd'); +my $check_patron; $nodouble = 1 if ($op eq 'edit_form' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're # modifying an existing patron, it ipso facto @@ -249,8 +250,9 @@ if ( ( $op eq 'cud-insert' ) and !$nodouble ) { $nodouble = 1; my $patrons = Koha::Patrons->search($conditions); # FIXME Should be search_limited? if ( $patrons->count > 0) { - $nodouble = 0; - $check_member = $patrons->next->borrowernumber; + $nodouble = 0; + $check_patron = $patrons->next; + $check_member = $check_patron->borrowernumber; } } @@ -791,6 +793,7 @@ $template->param( BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript destination => $destination,#to know where u come from and where u must go in redirect check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) + check_patron => $check_patron ); $template->param(