From 06d86e35506318d92fc86595ea99fe1b22dddde1 Mon Sep 17 00:00:00 2001
From: Alex Buckley <alexbuckley@catalyst.net.nz>
Date: Tue, 17 Mar 2020 23:59:03 +0000
Subject: [PATCH] Bug 23808: (follow-up) Pre-fill guarantee's contact details
 from guarantor patron in memberentry.pl

Pre-fill guarantee contact details (email, phone) from guarantor record
when adding a gurantee to a guarantor's record

Test plan:

1. Apply first two patches and follow test plans

2. On an adult's patron record (which has an primary phone
number, secondary phone, other phone, primary email, secondary email and
fax set) select 'Add a guarantee' and observe the guarantee's 'Contact'
section is not pre-filled with that information from the guarantor

3. Apply this patch

4. On the same adult's record select 'Add a guarantee' and observe that
the 'Primary phone', 'Secondary phone', 'Other phone', 'Primary email',
'Secondary email', 'Fax' have been pre-filled from the guarantor's
record

5. Fill out the rest of the memberentry.pl and 'Save' and observe that those contact
details are successfully saved

6. Repeat step 4 and alter the 'Primary phone' and 'Primary email'
fields and save and observe that those altered values are saved

7. Run tests and confirm they pass:
sudo koha-shell <instancename>
prove xt
prove t

Sponsored-by: South Taranaki District Council, NZ
Signed-off-by: Andreas Roussos <a.roussos@dataly.gr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 .../prog/en/modules/members/memberentrygen.tt    | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 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 2893ed9252..2b6a379d71 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -581,7 +581,7 @@ legend:hover {
                                                     [% END %]
                                                         Guarantor surname:
                                                     </label>
-                                                    <input type="text" id="contactname" name="contactname" value="[% contactname | html %]" />
+                                                    <input type="text" id="contactname" name="contactname" value="[% patron.contactname | html %]" />
                                                     [% IF ( mandatorycontactname ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -598,7 +598,7 @@ legend:hover {
                                                     [% END %]
                                                         Guarantor first name:
                                                     </label>
-                                                    <input type="text" id="contactfirstname" name="contactfirstname" value="[% contactfirstname | html %]" />
+                                                    <input type="text" id="contactfirstname" name="contactfirstname" value="[% patron.contactfirstname | html %]" />
                                                     [% IF ( mandatorycontactfirstname ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -633,7 +633,7 @@ legend:hover {
                                                     [% END %]
                                                         Primary phone:
                                                     </label>
-                                                    <input type="text" id="phone" name="phone" value="[% phone | html %]" />
+                                                    <input type="text" id="phone" name="phone" value="[% patron.phone | html %]" />
                                                     [% IF ( mandatoryphone ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -650,7 +650,7 @@ legend:hover {
                                                     [% END %]
                                                         Secondary phone:
                                                     </label>
-                                                    <input type="text" id="phonepro" name="phonepro" value="[% phonepro | html %]" />
+                                                    <input type="text" id="phonepro" name="phonepro" value="[% patron.phonepro | html %]" />
                                                     [% IF ( mandatoryphonepro ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -666,7 +666,7 @@ legend:hover {
                                                     [% END %]
                                                         Other phone:
                                                     </label>
-                                                    <input type="text" id="mobile" name="mobile" value="[% mobile | html %]" />
+                                                    <input type="text" id="mobile" name="mobile" value="[% patron.mobile | html %]" />
                                                     [% IF ( mandatorymobile ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -682,7 +682,7 @@ legend:hover {
                                                     [% END %]
                                                         Primary email:
                                                     </label>
-                                                    <input type="text" id="email" name="email" size="45" value="[% email | html %]" />
+                                                    <input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" />
                                                     [% IF ( mandatoryemail ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -699,7 +699,7 @@ legend:hover {
                                                     [% END %]
                                                         Secondary email:
                                                     </label>
-                                                    <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro | html %]" />
+                                                    <input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" />
                                                     [% IF ( mandatoryemailpro ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
@@ -715,7 +715,7 @@ legend:hover {
                                                     [% END %]
                                                         Fax:
                                                     </label>
-                                                    <input type="text" id="fax" name="fax" value="[% fax | html %]" />
+                                                    <input type="text" id="fax" name="fax" value="[% patron.fax | html %]" />
                                                     [% IF ( mandatoryfax ) %]
                                                         <span class="required">Required</span>
                                                     [% END %]
-- 
2.21.1 (Apple Git-122.3)