Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tt
Frédéric Demians f64aaf063e Bug 6750 Guarantor search broken on translated templates
Fix the JavaScript to avoid implementing complex string substitution into JS
function call. This patch solves the bug and keep the ability to copy
borrower's address, name, etc., containing new line, simple quote, etc.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-09-07 20:59:26 +12:00

120 lines
4.7 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Guarantor Search</title>
[% INCLUDE '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>
<script type="text/javascript">
<!--
function fillguarantor(id) {
var $ = window.$;
var surname = $('#' + id + 'surname').text();
var firstname = $('#' + id + 'firstname').text();
var streetnumber = $('#' + id + 'streetnumber').text();
var address = $('#' + id + 'address').text();
var address2 = $('#' + id + 'address2').text();
var city = $('#' + id + 'city').text();
var state = $('#' + id + 'state').text();
var zipcode = $('#' + id + 'zipcode').text();
var country = $('#' + id + 'country').text();
var branchcode = $('#' + id + 'branchcode').text();
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?borrowernumber=' + 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.address2.value = address2;
form.city.value = city;
form.state.value = state;
form.zipcode.value = zipcode;
form.country.value = country;
form.branchcode.value = branchcode;
form.guarantorsearch.value = 'Change';
self.close();
}
// -->
</script>
</head>
<div id="custom-doc" class="yui-t7">
<div id="bd">
<div class="yui-g">
<h3>Search for guarantor</h3>
<form action="/cgi-bin/koha/members/guarantor_search.pl" method="post">
<fieldset>
<input type="hidden" name="category_type" id="category_type" value="[% category_type %]" />
<input type="text" name="member" id="member" value="[% member %]" class="focus" /> Ordered by
<select name="orderby">
<option value="surname,firstname">Surname</option>
<option value="cardnumber">Cardnumber</option>
</select> <input type="submit" class="button" value="Search" /></fieldset>
</form>
[% IF ( results ) %]
<p>Searched for <span class="ex">[% member %]</span>, [% numresults %] patron(s) found:</p>
<table>
<tr>
<th>Cardnumber</th>
<th>Name</th>
<th>Date of birth</th>
<th>Address</th>
<th>Select?</th>
</tr>
[% FOREACH resultsloo IN resultsloop %]
[% import(resultsloo) %]
<tr>
<td>[% cardnumber %]</td>
<td>
[% surname %], [% firstname %]
</td>
<td>[% dateofbirth %]</td>
<td><p>[% address %] [% address2 %] [% city %] [% state %] [% zipcode %] [% country %]</p></td>
<td>
<span style="display:none;">
<span id="[% borrowernumber %]surname">[% surname %]</span>
<span id="[% borrowernumber %]firstname">[% firstname %]</span>
<span id="[% borrowernumber %]streetnumber">[% streetnumber %]</span>
<span id="[% borrowernumber %]address">[% address %]</span>
<span id="[% borrowernumber %]address2">[% address2 %]</span>
<span id="[% borrowernumber %]city">[% city %]</span>
<span id="[% borrowernumber %]state">[% state %]</span>
<span id="[% borrowernumber %]zipcode">[% zipcode %]</span>
<span id="[% borrowernumber %]country">[% country %]</span>
<span id="[% borrowernumber %]branchcode">[% branchcode %]</span>
</span>
<form action="">
<input type="button" onclick="fillguarantor('[% borrowernumber %]'); return false;" value="Select"/>
</form>
</td>
</tr>
[% END %]
</table>
[% END %]
<div id="closewindow"><a href="#" class="close">Cancel</a></div>
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]