Bug 15928 - Show unlinked guarantor
authorNick Clemens <nick@bywatersolutions.com>
Fri, 26 Feb 2016 21:08:55 +0000 (21:08 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 6 Apr 2016 23:50:33 +0000 (23:50 +0000)
To test:
1 - Add guarantor data to patron account by typing it in but do not 'Set to patron'
2 - Note it is not displayed on patron details
3 - Apply patch
4 - Note the info is displayed
5 - Test that linked guarantors show as expected

Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended-patch: Correct some indents/spaces

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
members/moremember.pl

index 8355bf5..6a4add0 100644 (file)
@@ -246,7 +246,11 @@ function validate1(date) {
     [% ELSIF guarantor %]
         <li>
             <span class="label">Guarantor:</span>
-            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname %] [% guarantor.surname %]</a>
+            [% IF guarantor.borrowernumber %]
+                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname %] [% guarantor.surname %]</a>
+            [% ELSE %]
+                [% guarantor.firstname %] [% guarantor.surname %]
+            [% END %]
         </li>
     [% END %]
 </ol>
index 4a5c06d..7c962a4 100755 (executable)
@@ -169,6 +169,13 @@ if ( my $guarantor = $patron->guarantor ) {
     $template->param( guarantor => $guarantor );
     push @relatives, $guarantor->borrowernumber;
     push @relatives, $_->borrowernumber for $patron->siblings;
+} elsif ( $patron->contactname || $patron->contactfirstname ) {
+    $template->param(
+        guarantor => {
+            firstname => $patron->contactfirstname,
+            surname   => $patron->contactname,
+        }
+    );
 } else {
     my @guarantees = $patron->guarantees;
     $template->param( guarantees => \@guarantees );