Bug 18403: Guarantors

Technically a kid from your library group could have a guarantor
attached to another
group of library, let's deal with this case.

Test plan:
- Create a kid from your library group
- With a superlibrarian staff user create a guarantor that is outside of
the group of
libraries of the kid
- Login with a limited staff user and confirm that on the patron detail
page you do not
see the link to the guarantor detail page.

Note that you see the firstname and surname of the guarantor
Q. should it be hidden?

Signed-off-by: Signed-off-by: Jon McGowan <jon.mcgowan@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-04-10 10:23:37 -03:00
parent 710175fbe6
commit fda87270ad
3 changed files with 18 additions and 4 deletions

View File

@ -460,7 +460,14 @@ $(document).ready(function() {
[% ELSE %]
<li id="contact-details" style="display: none">
[% END %]
<span class="label">Patron #:</span> [% IF ( guarantorid ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorid %]" target="blank">[% guarantorid |html %]</a>[% END %]
<span class="label">Patron #:</span>
[% IF guarantorid %]
[% IF logged_in_user.can_see_patron_infos( guarantor ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorid %]" target="blank">[% guarantorid | html %]</a>
[% ELSE %]
[% guarantorid | html %]
[% END %]
[% END %]
</li>
[% UNLESS nocontactname %]
<li>

View File

@ -271,14 +271,18 @@ function validate1(date) {
<span class="label">Guarantees:</span>
<ul>
[% FOREACH guarantee IN guarantees %]
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></li>
[% IF logged_in_user.can_see_patron_infos( guarantee ) %]
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></li>
[% ELSE %]
<li>[% guarantee.firstname | html %] [% guarantee.surname | html %]</li>
[% END %]
[% END %]
</ul>
</li>
[% ELSIF guarantor %]
<li>
<span class="label">Guarantor:</span>
[% IF guarantor.borrowernumber %]
[% IF guarantor.borrowernumber AND logged_in_user.can_see_patron_infos( guarantor ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a>
[% ELSE %]
[% guarantor.firstname | html %] [% guarantor.surname | html %]

View File

@ -755,10 +755,13 @@ $template->param(
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0)
"op$op" => 1);
$guarantorid = $borrower_data->{'guarantorid'} || $guarantorid;
my $guarantor = $guarantorid ? Koha::Patrons->find( $guarantorid ) : undef;
$template->param(
nodouble => $nodouble,
borrowernumber => $borrowernumber, #register number
guarantorid => ($borrower_data->{'guarantorid'} || $guarantorid),
guarantor => $guarantor,
guarantorid => $guarantorid,
relshiploop => \@relshipdata,
btitle=> $default_borrowertitle,
guarantorinfo => $guarantorinfo,