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.
---
.../prog/en/modules/members/guarantor_search.tmpl | 50 ++++++++-
.../prog/en/modules/members/memberentrygen.tmpl | 110 +++++++++++++-------
.../prog/en/modules/members/moremember.tmpl | 20 ++--
members/guarantor_search.pl | 1 +
members/memberentry.pl | 6 +-
5 files changed, 130 insertions(+), 57 deletions(-)
diff --git
a/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
index add0071..bbb677e 100755
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
@@ -1,9 +1,43 @@
<!-- 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">
@@ -29,13 +63,21 @@
<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>
diff --git
a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
index 5ccff55..ca486e1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
@@ -6,20 +6,22 @@
<!-- 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;
@@ -138,7 +140,7 @@
<!-- /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" -->" />
@@ -190,7 +192,7 @@
<!-- 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>
@@ -267,31 +269,59 @@
</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">
@@ -516,7 +546,7 @@
<!-- 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>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
index 29c0b55..128968c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
@@ -175,13 +175,13 @@ if (nodename =="barcodes[]"){
<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>
@@ -298,8 +298,8 @@ if (nodename =="barcodes[]"){
<!-- /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>
@@ -309,11 +309,11 @@ if (nodename =="barcodes[]"){
<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>
diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl
index 30921c5..881df94 100755
--- a/members/guarantor_search.pl
+++ b/members/guarantor_search.pl
@@ -79,6 +79,7 @@ if ($member ne ''){
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'},
diff --git a/members/memberentry.pl b/members/memberentry.pl
index 1cfedd8..f049b34 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -159,9 +159,9 @@ if (($category_type eq 'C' || $category_type eq 'P') and
$guarantorid ne '' ){
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->{$_};
}
@@ -555,7 +555,7 @@ $template->param(
nodouble => $nodouble,
borrowernumber => $borrowernumber,#register number
"contacttitle_".$data{'contacttitle'} => "SELECTED" ,
- guarantorid => $guarantorid,
+ guarantorid => $borrower_data ? $borrower_data->{'guarantorid'} :
$guarantorid,
ethcatpopup => $ethcatpopup,
relshiploop => [EMAIL PROTECTED],
citypopup => $citypopup,
--
1.5.5.GIT
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches