Lines 7-13
Link Here
|
7 |
<script type="text/javascript"> |
7 |
<script type="text/javascript"> |
8 |
//<![CDATA[ |
8 |
//<![CDATA[ |
9 |
$(document).ready(function() { |
9 |
$(document).ready(function() { |
10 |
|
|
|
11 |
[% IF categorycode %] |
10 |
[% IF categorycode %] |
12 |
update_category_code( "[% categorycode %]" ); |
11 |
update_category_code( "[% categorycode %]" ); |
13 |
[% ELSE %] |
12 |
[% ELSE %] |
Lines 16-164
$(document).ready(function() {
Link Here
|
16 |
update_category_code( category_code ); |
15 |
update_category_code( category_code ); |
17 |
} |
16 |
} |
18 |
[% END %] |
17 |
[% END %] |
19 |
$("#dateofbirth").datepicker({ maxDate: "-1D", yearRange: "c-120:" }); |
|
|
20 |
dateformat = $("#dateofbirth").siblings(".hint").first().html(); |
21 |
if( $('#dateofbirth').length ) { |
22 |
write_age(); |
23 |
} |
24 |
$("#entryform").validate({ |
25 |
rules: { |
26 |
email: { |
27 |
email: true |
28 |
}, |
29 |
emailpro: { |
30 |
email: true |
31 |
}, |
32 |
B_email: { |
33 |
email: true |
34 |
} |
35 |
}, |
36 |
submitHandler: function(form) { |
37 |
$("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting'); |
38 |
if (form.beenSubmitted) |
39 |
return false; |
40 |
else |
41 |
form.beenSubmitted = true; |
42 |
form.submit(); |
43 |
} |
44 |
}); |
45 |
|
46 |
var mrform = $("#manual_restriction_form"); |
47 |
var mrlink = $("#add_manual_restriction"); |
48 |
mrform.hide(); |
49 |
mrlink.on("click",function(e){ |
50 |
$(this).hide(); |
51 |
mrform.show(); |
52 |
e.preventDefault(); |
53 |
}); |
54 |
$("#cancel_manual_restriction").on("click",function(e){ |
55 |
$('#debarred_expiration').val(''); |
56 |
$('#add_debarment').val(0); |
57 |
$('#debarred_comment').val(''); |
58 |
mrlink.show(); |
59 |
mrform.hide(); |
60 |
e.preventDefault(); |
61 |
}); |
62 |
$('#floating-save').css( { bottom: parseInt( $('#floating-save').css('bottom') ) + $('#changelanguage').height() + 'px' } ); |
63 |
}); |
18 |
}); |
64 |
|
19 |
|
65 |
function clear_entry(node) { |
|
|
66 |
var original = $(node).parent(); |
67 |
$("textarea", original).attr('value', ''); |
68 |
$("select", original).attr('value', ''); |
69 |
} |
70 |
|
71 |
function clone_entry(node) { |
72 |
var original = $(node).parent(); |
73 |
var clone = original.clone(); |
74 |
|
75 |
var newId = 50 + parseInt(Math.random() * 100000); |
76 |
$("input,select,textarea", clone).attr('id', function() { |
77 |
return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
78 |
}); |
79 |
$("input,select,textarea", clone).attr('name', function() { |
80 |
return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
81 |
}); |
82 |
$("label", clone).attr('for', function() { |
83 |
return $(this).attr("for").replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
84 |
}); |
85 |
$("input#patron_attr_" + newId, clone).attr('value',''); |
86 |
$("select#patron_attr_" + newId, clone).attr('value',''); |
87 |
$(original).after(clone); |
88 |
return false; |
89 |
} |
90 |
|
91 |
function update_category_code(category_code) { |
92 |
if ( $(category_code).is("select") ) { |
93 |
category_code = $("#categorycode_entry").find("option:selected").val(); |
94 |
} |
95 |
var mytables = $(".attributes_table"); |
96 |
$(mytables).find("li").hide(); |
97 |
$(mytables).find(" li[data-category_code='"+category_code+"']").show(); |
98 |
$(mytables).find(" li[data-category_code='']").show(); |
99 |
} |
100 |
|
101 |
function select_user(borrowernumber, borrower) { |
102 |
var form = $('#entryform').get(0); |
103 |
if (form.guarantorid.value) { |
104 |
$("#contact-details").find('a').remove(); |
105 |
$("#contactname, #contactfirstname").parent().find('span').remove(); |
106 |
} |
107 |
|
108 |
var id = borrower.borrowernumber; |
109 |
form.guarantorid.value = id; |
110 |
$('#contact-details') |
111 |
.show() |
112 |
.find('span') |
113 |
.after('<a target="blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + id + '">' + id + '</a>'); |
114 |
|
115 |
$(form.contactname) |
116 |
.val(borrower.surname) |
117 |
.before('<span>' + borrower.surname + '</span>').get(0).type = 'hidden'; |
118 |
$(form.contactfirstname) |
119 |
.val(borrower.firstname) |
120 |
.before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden'; |
121 |
|
122 |
form.streetnumber.value = borrower.streetnumber; |
123 |
form.address.value = borrower.address; |
124 |
form.address2.value = borrower.address2; |
125 |
form.city.value = borrower.city; |
126 |
form.state.value = borrower.state; |
127 |
form.zipcode.value = borrower.zipcode; |
128 |
form.country.value = borrower.country; |
129 |
form.branchcode.value = borrower.branchcode; |
130 |
|
131 |
form.guarantorsearch.value = _("Change"); |
132 |
|
133 |
return 0; |
134 |
} |
135 |
|
136 |
function write_age() { |
137 |
var hint = $("#dateofbirth").siblings(".hint").first(); |
138 |
hint.html(dateformat); |
139 |
|
140 |
var age = CalculateAge(document.form.dateofbirth.value); |
141 |
|
142 |
if (!age.year && !age.month) { |
143 |
return; |
144 |
} |
145 |
|
146 |
var age_string; |
147 |
if (age.year || age.month) { |
148 |
age_string = _("Age: "); |
149 |
} |
150 |
|
151 |
if (age.year) { |
152 |
age_string += age.year > 1 ? _("%s years ").format(age.year) : _("%s year ").format(age.year); |
153 |
} |
154 |
|
155 |
if (age.month) { |
156 |
age_string += age.month > 1 ? _("%s months ").format(age.month) : _("%s month ").format(age.month); |
157 |
} |
158 |
|
159 |
hint.html(age_string); |
160 |
} |
161 |
|
162 |
var MSG_SEPARATOR = _("Separator must be / in field %s"); |
20 |
var MSG_SEPARATOR = _("Separator must be / in field %s"); |
163 |
var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); |
21 |
var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); |
164 |
var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); |
22 |
var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); |
Lines 169-176
function select_user(borrowernumber, borrower) {
Link Here
|
169 |
var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron"); |
27 |
var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron"); |
170 |
var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match"); |
28 |
var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match"); |
171 |
var MSG_PASSWORD_CONTAINS_TRAILING_SPACES = _("Password contains leading and/or trailing spaces."); |
29 |
var MSG_PASSWORD_CONTAINS_TRAILING_SPACES = _("Password contains leading and/or trailing spaces."); |
|
|
30 |
var MSG_MONTH = _("%s month") |
31 |
var MSG_MONTHS = _("%s months") |
32 |
var MSG_YEAR = _("%s year") |
33 |
var MSG_YEARS = _("%s years") |
172 |
var LABEL_CHANGE = _("Change"); |
34 |
var LABEL_CHANGE = _("Change"); |
173 |
var LABEL_SET_TO_PATRON = _("Set to patron"); |
35 |
var LABEL_SET_TO_PATRON = _("Set to patron"); |
|
|
36 |
var LABEL_AGE = _("Age"); |
37 |
|
174 |
//]]> |
38 |
//]]> |
175 |
</script> |
39 |
</script> |
176 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members.js"></script> |
40 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members.js"></script> |