This patch corrects this problem, by, when a patron record is linked as a guarantor, showing that and not allowing the name to be edited. It still allows manual entry of a guarantor. It also untabifies a few places in the affected files and fixes some inconsistent names.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha › Guarantor Search</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
- <style type="text/css">
- #custom-doc { width:44.46em;*width:43.39em;min-width:578px; margin:auto; text-align:left; }
- </style>
+ <style type="text/css">
+ #custom-doc { width:44.46em;*width:43.39em;min-width:578px; margin:auto; text-align:left; }
+ </style>
+ <script type="text/javascript">
+ <!--
+ function fillguarantor(id, surname, firstname, streetnumber, address, city, zipcode) {
+ var $ = window.opener.$;
+ var form = $('#entryform').get(0);
+
+ if (form.guarantorid.value) {
+ $("#contact-details").find('a').remove();
+ $("#contactname, #contactfirstname").parent().find('span').remove();
+ }
+
+ form.guarantorid.value = id;
+ $('#contact-details')
+ .show()
+ .find('span')
+ .after('<a target="blank" href="/cgi-bin/koha/members/moremember.pl?bornum=' + id + '">' + id + '</a>');
+
+ $(form.contactname)
+ .val(surname)
+ .before('<span>' + surname + '</span>').get(0).type = 'hidden';
+ $(form.contactfirstname)
+ .val(firstname)
+ .before('<span>' + firstname + '</span>').get(0).type = 'hidden';
+
+ form.streetnumber.value = streetnumber;
+ form.address.value = address;
+ form.city.value = city;
+ form.zipcode.value = zipcode;
+
+ form.guarantorsearch.value = 'Change';
+ self.close();
+ }
+ // -->
+ </script>
</head>
<div id="custom-doc" class="yui-t7">
<th>Name</th>
<th>Date of birth</th>
<th>Address</th>
+ <th>Select?</th>
</tr>
<!-- TMPL_LOOP NAME="resultsloop" -->
<tr>
<td><!-- TMPL_VAR NAME="cardnumber" --></td>
- <td><a href="javascript:window.opener.document.form.guarantorid.value=<!-- TMPL_VAR NAME="borrowernumber" -->;window.opener.document.form.guarantorsearch.value='Modify Guarantor';window.opener.document.form.contactname.value='<!-- TMPL_VAR NAME="surname" ESCAPE=JS -->';window.opener.document.form.contactfirstname.value='<!-- TMPL_VAR NAME="firstname" ESCAPE=JS -->';window.opener.document.form.address.value='<!-- TMPL_VAR NAME="address" ESCAPE=JS -->';window.opener.document.form.city.value='<!-- TMPL_VAR NAME="city" ESCAPE=JS -->';window.opener.document.form.zipcode.value='<!-- TMPL_VAR NAME="zipcode" ESCAPE=JS -->';self.close();"><!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></a></td>
+ <td>
+ <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" -->
+ </td>
<td><!-- TMPL_VAR NAME="dateofbirth" --></td>
<td><p><!-- TMPL_VAR NAME="address" --> <!-- TMPL_VAR NAME="city" --></p></td>
+ <td>
+ <form action="">
+ <input type="button" onclick="fillguarantor('<!-- TMPL_VAR NAME="borrowernumber" -->', '<!-- TMPL_VAR NAME="surname" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="firstname" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="streetnumber" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="address" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="city" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="zipcode" ESCAPE=JS -->'); return false;" value="Select"/>
+ </form>
+ </td>
</tr>
<!-- /TMPL_LOOP -->
</table>
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
- $(document).ready(function() {
- $("#guarantordelete").click(function() {
- $("#guarantorid").attr("value","");
- $("#contactname").attr("value","");
- $("#contactfirstname").attr("value","");
- $("#guarantorsearch").attr("value","Find guarantor");
- });
- $("#select_city").change(function(){
- var myRegEx=new RegExp(/(.*)\|(.*)/);
- document.form.select_city.value.match(myRegEx);
- document.form.zipcode.value=RegExp.$1;
- document.form.city.value=RegExp.$2;
- });
- });
+ $(document).ready(function() {
+ $("#guarantordelete").click(function() {
+ $("#contact-details").hide().find('a').remove();
+ $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = "" });
+ $("#contactname, #contactfirstname")
+ .each(function () { this.type = 'text' })
+ .parent().find('span').remove();
+ $("#guarantorsearch").val("Set to Patron");
+ });
+ $("#select_city").change(function(){
+ var myRegEx=new RegExp(/(.*)\|(.*)/);
+ document.form.select_city.value.match(myRegEx);
+ document.form.zipcode.value=RegExp.$1;
+ document.form.city.value=RegExp.$2;
+ });
+ });
function clear_entry(node) {
var original = node.parentNode.parentNode;
<!-- /TMPL_IF -->
-<form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post">
<!-- field always hidden in different form (1,2,3) -->
<input type="hidden" name="BorrowerMandatoryField" value="<!--TMPL_VAR NAME="BorrowerMandatoryField"-->" />
<input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->" />
<!-- TMPL_ELSE -->
<label for="firstname">
<!-- /TMPL_IF-->
- Firstname: </label>
+ First name: </label>
<input type="text" id="firstname" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->" />
<!-- TMPL_IF NAME="mandatoryfirstname" --><span class="required">Required</span><!-- /TMPL_IF -->
</li>
</fieldset>
<!--TMPL_IF Name="showguarantor"--><input type="hidden" id="guarantorid" name="guarantorid" value="<!-- TMPL_VAR NAME="guarantorid" -->" />
- <fieldset class="rows">
- <legend>Guarantor Information</legend>
- <ol>
- <li>
- <label for="contactname">First Name: </label><input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
- </li>
- <li><label for="contactfirstname">Last Name: </label><input name="contactfirstname" id="contactfirstname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" /></li>
- <!-- TMPL_IF name="relshiploop" --><li><label for="relationship">Relationship: </label>
- <select name="relationship" id="relationship" >
- <!-- TMPL_LOOP name="relshiploop" -->
- <!-- TMPL_IF name="selected" -->
- <option value="<!-- TMPL_VAR name="relationship" -->" selected="selected" ><!-- TMPL_VAR name="relationship" --></option>
+ <fieldset class="rows">
+ <legend>Guarantor Information</legend>
+ <ol>
+ <!-- TMPL_IF NAME="guarantorid" -->
+ <li id="contact-details">
<!-- TMPL_ELSE -->
- <option value="<!-- TMPL_VAR name="relationship" -->"><!-- TMPL_VAR name="relationship" --></option>
+ <li id="contact-details" style="display: none">
<!-- /TMPL_IF -->
- <!-- /TMPL_LOOP -->
- </select></li>
- <!-- /TMPL_IF -->
- <li><span class="label"> </span><!-- TMPL_IF NAME="guarantorid"-->
- <input id="guarantorsearch" type="button" value="Change Guarantor" onclick="Dopopguarantor('guarantor_search.pl');" />
- <!-- TMPL_ELSE -->
- <input id="guarantorsearch" type="button" value="Find Guarantor" onclick="Dopopguarantor('guarantor_search.pl');" />
- <!-- /TMPL_IF --> <input id="guarantordelete" type="button" value="Delete Guarantor" /></li>
- </ol>
- </fieldset>
+ <span class="label">Patron #:</span> <!-- TMPL_IF NAME="guarantorid" --> <a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="guarantorid" -->" target="blank"><!-- TMPL_VAR NAME="guarantorid" --></a><!-- /TMPL_IF -->
+ </li>
+ <li>
+ <label for="contactname">Surname: </label>
+ <!-- TMPL_IF NAME="guarantorid" -->
+ <span><!-- TMPL_VAR NAME="contactname" --></span>
+ <input name="contactname" id="contactname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
+ <!-- TMPL_ELSE -->
+ <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
+ <!-- /TMPL_IF -->
+ </li>
+ <li>
+ <label for="contactfirstname">First name: </label>
+ <!-- TMPL_IF NAME="guarantorid" -->
+ <span><!-- TMPL_VAR NAME="contactfirstname" --></span>
+ <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" />
+ <!-- TMPL_ELSE -->
+ <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" />
+ <!-- /TMPL_IF -->
+ </li>
+ <!-- TMPL_IF name="relshiploop" -->
+ <li>
+ <label for="relationship">Relationship: </label>
+ <select name="relationship" id="relationship" >
+ <!-- TMPL_LOOP name="relshiploop" -->
+ <!-- TMPL_IF name="selected" -->
+ <option value="<!-- TMPL_VAR name="relationship" -->" selected="selected" ><!-- TMPL_VAR name="relationship" --></option>
+ <!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR name="relationship" -->"><!-- TMPL_VAR name="relationship" --></option>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP -->
+ </select>
+ </li>
+ <!-- /TMPL_IF -->
+ <li>
+ <span class="label"> </span>
+ <!-- TMPL_IF NAME="guarantorid" -->
+ <input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl');" />
+ <!-- TMPL_ELSE -->
+ <input id="guarantorsearch" type="button" value="Set to Patron" onclick="Dopopguarantor('guarantor_search.pl');" />
+ <!-- /TMPL_IF -->
+ <input id="guarantordelete" type="button" value="Delete" />
+ </li>
+ </ol>
+ </fieldset>
<!--/TMPL_IF-->
<fieldset class="rows">
<!-- TMPL_ELSE -->
<label for="altcontactfirstname">
<!-- /TMPL_IF -->
- Firstname:</label>
+ First name:</label>
<input type="text" name="altcontactfirstname" id="altcontactfirstname" value="<!-- TMPL_VAR NAME="altcontactfirstname" -->" />
<!-- TMPL_IF NAME="mandatoryaltcontactfirstname" --><span class="required">Required</span><!-- /TMPL_IF -->
</li>
<li><span class="label">Ethnicity:</span><!-- TMPL_VAR NAME="ethnicity" --></li>
<li><span class="label">Ethnicity notes: </span><!-- TMPL_VAR NAME="ethnotes" --></li>
<!-- /TMPL_IF -->
- <!-- TMPL_IF name="isguarantee" -->
+ <!-- TMPL_IF NAME="isguarantee" -->
<!-- TMPL_IF NAME="guaranteeloop" -->
- <li><span class="label">Guarantees:</span><ul><!-- tmpl_loop name="guaranteeloop" --><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="name" --> </a></li><!-- /tmpl_loop --></ul></li>
+ <li><span class="label">Guarantees:</span><ul><!-- TMPL_LOOP NAME="guaranteeloop" --><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="name" --> </a></li><!-- /tmpl_loop --></ul></li>
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
<!-- TMPL_IF name="guarantorborrowernumber" -->
- <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->"><!-- TMPL_VAR NAME="guarantorsurname" --> <!-- TMPL_VAR NAME="guarantorfirstname" --></a></li>
+ <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->"><!-- TMPL_VAR NAME="guarantorsurname" -->, <!-- TMPL_VAR NAME="guarantorfirstname" --></a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</ol>
<!-- /TMPL_UNLESS -->
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF NAME="C" -->
- <div class="rows"> <ol><li><span class="label">Name: </span><!-- TMPL_VAR NAME="contactname" --></li>
- <li><span class="label">Firstname: </span><!-- TMPL_VAR NAME="firstname" --></li>
+ <div class="rows"> <ol><li><span class="label">Surname: </span><!-- TMPL_VAR NAME="contactname" --></li>
+ <li><span class="label">First name: </span><!-- TMPL_VAR NAME="contactfirstname" --></li>
<li><span class="label">Phone: </span><!-- TMPL_VAR NAME="phone" --></li>
<li><span class="label">Email: </span><!-- TMPL_VAR NAME="email" --></li>
<li><span class="label">Relationship: </span><!-- TMPL_VAR NAME="relationship" --></li></ol></div>
<div id="patron-alternative-contact" style="padding-top: 1em;">
<h3>Alternative Contact</h3>
<div class="rows"> <ol><li><span class="label">Surname: </span><!-- TMPL_VAR NAME="altcontactsurname" --></li>
- <li><span class="label">Firstname: </span><!-- TMPL_VAR NAME="altcontactfirstname" --></li>
- <li><span class="label">Address1: </span><!-- TMPL_VAR NAME="altcontactaddress1" --></li>
- <li><span class="label">Address2: </span><!-- TMPL_VAR NAME="altcontactaddress2" --></li>
- <li><span class="label">City,State: </span><!-- TMPL_VAR NAME="altcontactaddress3" --></li>
- <li><span class="label">Zip/Post Code: </span><!-- TMPL_VAR NAME="altcontactzipcode" --></li>
+ <li><span class="label">First name: </span><!-- TMPL_VAR NAME="altcontactfirstname" --></li>
+ <li><span class="label">Address: </span><!-- TMPL_VAR NAME="altcontactaddress1" --></li>
+ <li><span class="label">Address (cont.): </span><!-- TMPL_VAR NAME="altcontactaddress2" --></li>
+ <li><span class="label">City, State: </span><!-- TMPL_VAR NAME="altcontactaddress3" --></li>
+ <li><span class="label">Zip/Postal Code: </span><!-- TMPL_VAR NAME="altcontactzipcode" --></li>
<li><span class="label">Phone: </span><!-- TMPL_VAR NAME="altcontactphone" --></li></ol></div>
</div>
<div class="action"><a href="memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&step=2">Edit</a></div>
surname => $results->[$i]{'surname'},
firstname => $results->[$i]{'firstname'},
categorycode => $results->[$i]{'categorycode'},
+ streetnumber => $results->[$i]{'streetnumber'},
address => $results->[$i]{'address'},
city => $results->[$i]{'city'},
zipcode => $results->[$i]{'zipcode'},
my $guarantordata=GetMember($guarantorid);
$guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
if (($data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'})) {
- $data{'contactfirstname'}= $guarantordata->{'firstname'};
+ $data{'contactfirstname'}= $guarantordata->{'firstname'};
$data{'contactname'} = $guarantordata->{'surname'};
- $data{'contacttitle'} = $guarantordata->{'title'};
+ $data{'contacttitle'} = $guarantordata->{'title'};
foreach (qw(streetnumber address streettype address2 zipcode city phone phonepro mobile fax email emailpro branchcode)) {
$data{$_} = $guarantordata->{$_};
}
nodouble => $nodouble,
borrowernumber => $borrowernumber,#register number
"contacttitle_".$data{'contacttitle'} => "SELECTED" ,
- guarantorid => $guarantorid,
+ guarantorid => $borrower_data ? $borrower_data->{'guarantorid'} : $guarantorid,
ethcatpopup => $ethcatpopup,
relshiploop => \@relshipdata,
citypopup => $citypopup,