Lines 4-39
Link Here
|
4 |
[% INCLUDE 'calendar.inc' %] |
4 |
[% INCLUDE 'calendar.inc' %] |
5 |
<script type="text/javascript"> |
5 |
<script type="text/javascript"> |
6 |
//<![CDATA[ |
6 |
//<![CDATA[ |
|
|
7 |
|
8 |
function clear_edit(){ |
9 |
var cancel = confirm(_("Are you sure you want to lost your changes?")); |
10 |
if ( !cancel ) return; |
11 |
$('#default-circulation-rules td').removeClass('highlighted-row'); |
12 |
var edit_row = $("#edit_row"); |
13 |
$(edit_row).find("input").each(function(){ |
14 |
var type = $(this).attr("type"); |
15 |
if (type != "button" && type != "submit" ) { |
16 |
$(this).val(""); |
17 |
$(this).removeAttr("disabled"); |
18 |
} |
19 |
}); |
20 |
$(edit_row).find("select").removeAttr("disabled"); |
21 |
$(edit_row).find("select option:first").attr("selected", "selected"); |
22 |
$(edit_row).find("td:last input[name='clear']").remove(); |
23 |
} |
24 |
|
7 |
$(document).ready(function() { |
25 |
$(document).ready(function() { |
8 |
$('#selectlibrary').find("input:submit").hide(); |
26 |
$('#selectlibrary').find("input:submit").hide(); |
9 |
$('#branch').change(function() { |
27 |
$('#branch').change(function() { |
10 |
$('#selectlibrary').submit(); |
28 |
$('#selectlibrary').submit(); |
11 |
}); |
29 |
}); |
12 |
$(".editrule").click(function(){ |
30 |
$(".editrule").click(function(){ |
|
|
31 |
if ( $(edit_row).find("input[type='text'][value!='']").length > 0 ) { |
32 |
var edit = confirm(_("Are you sure you want to edit another rule?")); |
33 |
if (!edit) return false; |
34 |
} |
13 |
$('#default-circulation-rules td').removeClass('highlighted-row'); |
35 |
$('#default-circulation-rules td').removeClass('highlighted-row'); |
14 |
$(this).parent().parent().find("td").each(function (i) { |
36 |
$(this).parent().parent().find("td").each(function (i) { |
15 |
$(this).addClass('highlighted-row'); |
37 |
$(this).addClass('highlighted-row'); |
16 |
itm = $(this).text(); |
38 |
itm = $(this).text(); |
17 |
itm = itm.replace(/^\s*|\s*$/g,''); |
39 |
itm = itm.replace(/^\s*|\s*$/g,''); |
18 |
var current = $("#default-circulation-rules tr:last td:eq("+i+")"); |
40 |
var current_column = $("#edit_row td:eq("+i+")"); |
19 |
if ( i != 5 ) { |
41 |
if ( i != 5 ) { |
20 |
$(current).find("input").val(itm); |
42 |
$(current_column).find("input[type='text']").val(itm); |
21 |
// select the corresponding option |
43 |
// select the corresponding option |
22 |
$(current).find("select option").each(function(){ |
44 |
$(current_column).find("select option").each(function(){ |
23 |
if ( $(this).text().toLowerCase() == itm.toLowerCase() ) { |
45 |
if ( $(this).text().toLowerCase() == itm.toLowerCase() ) { |
24 |
$(this).attr('selected', 'selected'); |
46 |
$(this).attr('selected', 'selected'); |
25 |
} |
47 |
} |
26 |
}); |
48 |
}); |
27 |
if ( i == 0 || i == 1 ) { |
49 |
if ( i == 0 || i == 1 ) { |
28 |
// Disable the 2 first columns, we cannot update them. |
50 |
// Disable the 2 first columns, we cannot update them. |
29 |
var val = $(current).find("select option:selected").val(); |
51 |
var val = $(current_column).find("select option:selected").val(); |
30 |
var name = "categorycode"; |
52 |
var name = "categorycode"; |
31 |
if ( i == 1 ) { |
53 |
if ( i == 1 ) { |
32 |
name="itemtype"; |
54 |
name="itemtype"; |
33 |
} |
55 |
} |
34 |
// Remove potential previous input added |
56 |
// Remove potential previous input added |
35 |
$(current).find("input").remove(); |
57 |
$(current_column).find("input").remove(); |
36 |
$(current).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); |
58 |
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); |
37 |
} |
59 |
} |
38 |
} else { |
60 |
} else { |
39 |
// specific processing for the Hard due date column |
61 |
// specific processing for the Hard due date column |
Lines 46-58
$(document).ready(function() {
Link Here
|
46 |
} else if ( s[0] == "after" ) { |
68 |
} else if ( s[0] == "after" ) { |
47 |
select_value = 1 |
69 |
select_value = 1 |
48 |
} |
70 |
} |
49 |
$(current).find("input").val(s[1]); |
71 |
$(current_column).find("input[type='text']").val(s[1]); |
50 |
$(current).find("select").val(select_value); |
72 |
$(current_column).find("select").val(select_value); |
51 |
} |
73 |
} |
52 |
}); |
74 |
}); |
53 |
$("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled'); |
75 |
$("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled'); |
54 |
$("#default-circulation-rules tr:last td:eq(1) select").attr('disabled', 'disabled'); |
76 |
$("#default-circulation-rules tr:last td:eq(1) select").attr('disabled', 'disabled'); |
55 |
$("#default-circulation-rules tr:last td:last input").val(_("Save")); |
|
|
56 |
return false; |
77 |
return false; |
57 |
}); |
78 |
}); |
58 |
}); |
79 |
}); |
Lines 109-114
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
109 |
<input type="hidden" name="op" value="add" /> |
130 |
<input type="hidden" name="op" value="add" /> |
110 |
<input type="hidden" name="branch" value="[% branch %]"/> |
131 |
<input type="hidden" name="branch" value="[% branch %]"/> |
111 |
<table id="default-circulation-rules"> |
132 |
<table id="default-circulation-rules"> |
|
|
133 |
<thead> |
112 |
<tr> |
134 |
<tr> |
113 |
<th>Patron category</th> |
135 |
<th>Patron category</th> |
114 |
<th>Item type</th> |
136 |
<th>Item type</th> |
Lines 126-136
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
126 |
<th>Rental discount (%)</th> |
148 |
<th>Rental discount (%)</th> |
127 |
<th colspan="2"> </th> |
149 |
<th colspan="2"> </th> |
128 |
</tr> |
150 |
</tr> |
|
|
151 |
</thead> |
152 |
<tbody> |
129 |
[% FOREACH rule IN rules %] |
153 |
[% FOREACH rule IN rules %] |
130 |
[% UNLESS ( loop.odd ) %] |
154 |
[% UNLESS ( loop.odd ) %] |
131 |
<tr class="highlight"> |
155 |
<tr class="highlight" id="row_[% loop.count %]"> |
132 |
[% ELSE %] |
156 |
[% ELSE %] |
133 |
<tr> |
157 |
<tr id="row_[% loop.count %]"> |
134 |
[% END %] |
158 |
[% END %] |
135 |
<td>[% IF ( rule.default_humancategorycode ) %] |
159 |
<td>[% IF ( rule.default_humancategorycode ) %] |
136 |
<em>All</em> |
160 |
<em>All</em> |
Lines 175-181
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
175 |
</td> |
199 |
</td> |
176 |
</tr> |
200 |
</tr> |
177 |
[% END %] |
201 |
[% END %] |
178 |
<tr> |
202 |
<tr id="edit_row"> |
179 |
<td> |
203 |
<td> |
180 |
<select name="categorycode" id="categorycode"> |
204 |
<select name="categorycode" id="categorycode"> |
181 |
<option value="*">All</option> |
205 |
<option value="*">All</option> |
Lines 192-199
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
192 |
[% END %] |
216 |
[% END %] |
193 |
</select> |
217 |
</select> |
194 |
</td> |
218 |
</td> |
195 |
<td><input name="maxissueqty" id="maxissueqty" size="3" /></td> |
219 |
<td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td> |
196 |
<td><input name="issuelength" id="issuelength" size="3" /> </td> |
220 |
<td><input type="text" name="issuelength" id="issuelength" size="3" /> </td> |
197 |
<td> |
221 |
<td> |
198 |
<select name="lengthunit" id="lengthunit"> |
222 |
<select name="lengthunit" id="lengthunit"> |
199 |
<option value="days" selected>Days</option> |
223 |
<option value="days" selected>Days</option> |
Lines 209-227
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
209 |
<input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" /> |
233 |
<input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" /> |
210 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
234 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
211 |
</td> |
235 |
</td> |
212 |
<td><input name="fine" id="fine" size="4" /></td> |
236 |
<td><input type="text" name="fine" id="fine" size="4" /></td> |
213 |
<td><input name="chargeperiod" id="chargeperiod" size="2" /></td> |
237 |
<td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td> |
214 |
<td><input name="firstremind" id="firstremind" size="2" /> </td> |
238 |
<td><input type="text" name="firstremind" id="firstremind" size="2" /> </td> |
215 |
<td><input name="overduefinescap" id="overduefinescap" size="6" /> </td> |
239 |
<td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td> |
216 |
<td><input name="finedays" id="fined" size="3" /> </td> |
240 |
<td><input type="text" name="finedays" id="fined" size="3" /> </td> |
217 |
<td><input name="renewalsallowed" id="renewalsallowed" size="2" /></td> |
241 |
<td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td> |
218 |
<td><input name="reservesallowed" id="reservesallowed" size="2" /></td> |
242 |
<td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td> |
219 |
<td><input name="rentaldiscount" id="rentaldiscount" size="2" /></td> |
243 |
<td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td> |
220 |
<td colspan="2"> |
244 |
<td colspan="2"> |
221 |
<input type="hidden" name="branch" value="[% current_branch %]"/> |
245 |
<input type="hidden" name="branch" value="[% current_branch %]"/> |
222 |
<input type="submit" value="Save" class="submit" /> |
246 |
<input type="submit" value="Save" class="submit" /> |
|
|
247 |
<input type="button" name="cancel" value="Clear" onclick="clear_edit();return false;" /> |
223 |
</td> |
248 |
</td> |
224 |
</tr> |
249 |
</tr> |
|
|
250 |
</tbody> |
225 |
</table> |
251 |
</table> |
226 |
</form> |
252 |
</form> |
227 |
</div> |
253 |
</div> |
228 |
- |
|
|