From a045efb1809124d8d7cb888c5a0bdeda1bad6099 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 17 Feb 2020 14:39:50 +0100
Subject: [PATCH] Bug 24666: Display not registered guarantors on the patron
 detail page

There was no way to see the not registered guarantors apart of editing
the patron.

Test plan:
- Create a patron with category type "Child"
- Define a "guarantor surname" and/or "guarantor firstname" in the
"Contact" block (the patron is not registered)
- See the patron's detail page and notice that the info appear
- Edit and add a registered guarantor
- See the patron's detail page and notice that the 2 guarantors info appear

Note that the relationship has been added.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 .../intranet-tmpl/prog/en/modules/members/moremember.tt  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
index 19e573752d..10b4b3b0c3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -263,9 +263,9 @@
                                                     [% END %]
                                                 </ul>
                                             </li>
-                                        [% ELSIF guarantor_relationships.count > 0 %]
+                                        [% ELSIF guarantor_relationships.count > 0 OR ( patron.contactfirstname OR patron.contactname ) %]
                                                 <li>
-                                                [% IF guarantor_relationships.count > 1 %]
+                                                [% IF guarantor_relationships.count > 1 OR guarantor_relationships.count == 0 AND ( patron.contactfirstname OR patron.contactname ) %]
                                                     <span class="label">Guarantors:</span>
                                                 [% ELSE %]
                                                     <span class="label">Guarantor:</span>
@@ -274,9 +274,12 @@
                                                     [% FOREACH gr IN guarantor_relationships %]
                                                         [% SET guarantor = gr.guarantor %]
                                                         [% IF logged_in_user.can_see_patron_infos( guarantor ) %]
-                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id | uri %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a></li>
+                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id | uri %]">[% guarantor.firstname | html %] [% guarantor.surname | html %][% IF gr.relationship %] ([% gr.relationship %])[% END %]</a></li>
                                                         [% END %]
                                                     [% END %]
+                                                    [% IF patron.contactfirstname OR patron.contactname %]
+                                                        <li>[% patron.contactfirstname %] [% patron.contactname %][% IF patron.relationship %] ([% patron.relationship %])[% END %]</li>
+                                                    [% END %]
                                                     </ul>
                                                 </li>
                                         [% END %]
-- 
2.21.1 (Apple Git-122.3)