|
Lines 9-14
$(document).ready(function() {
Link Here
|
| 9 |
$('#branch').change(function() { |
9 |
$('#branch').change(function() { |
| 10 |
$('#selectlibrary').submit(); |
10 |
$('#selectlibrary').submit(); |
| 11 |
}); |
11 |
}); |
|
|
12 |
$(".editrule").click(function(){ |
| 13 |
$(this).parent().parent().find("td").each(function (i) { |
| 14 |
itm = $(this).text(); |
| 15 |
itm = itm.replace(/^\s*|\s*$/g,''); |
| 16 |
var current = $("#default-circulation-rules tr:last td:eq("+i+")"); |
| 17 |
if ( i != 5 ) { |
| 18 |
$(current).find("input").val(itm); |
| 19 |
// select the corresponding option |
| 20 |
$(current).find("select option").each(function(){ |
| 21 |
if ( $(this).text().toLowerCase() == itm.toLowerCase() ) { |
| 22 |
$(this).attr('selected', 'selected'); |
| 23 |
} |
| 24 |
}); |
| 25 |
if ( i == 0 || i == 1 ) { |
| 26 |
// Disable the 2 first columns, we cannot update them. |
| 27 |
var val = $(current).find("select option:selected").val(); |
| 28 |
var name = "categorycode"; |
| 29 |
if ( i == 1 ) { |
| 30 |
name="itemtype"; |
| 31 |
} |
| 32 |
// Remove potential previous input added |
| 33 |
$(current).find("input").remove(); |
| 34 |
$(current).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); |
| 35 |
} |
| 36 |
} else { |
| 37 |
// specific processing for the Hard due date column |
| 38 |
var s = itm.split(' '); |
| 39 |
var select_value; |
| 40 |
if ( s[0] == "before" ) { |
| 41 |
select_value = -1 |
| 42 |
} else if ( s[0] == "on" ) { |
| 43 |
select_value = 0 |
| 44 |
} else if ( s[0] == "after" ) { |
| 45 |
select_value = 1 |
| 46 |
} |
| 47 |
$(current).find("input").val(s[1]); |
| 48 |
$(current).find("select").val(select_value); |
| 49 |
} |
| 50 |
}); |
| 51 |
$("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled'); |
| 52 |
$("#default-circulation-rules tr:last td:eq(1) select").attr('disabled', 'disabled'); |
| 53 |
$("#default-circulation-rules tr:last td:last input").val(_("Save")); |
| 54 |
return false; |
| 55 |
}); |
| 12 |
}); |
56 |
}); |
| 13 |
//]]> |
57 |
//]]> |
| 14 |
</script> |
58 |
</script> |
|
Lines 57-67
$(document).ready(function() {
Link Here
|
| 57 |
</form> |
101 |
</form> |
| 58 |
[% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label |
102 |
[% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label |
| 59 |
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" /> |
103 |
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" /> |
| 60 |
<select name="tobranch" id="tobranch">[% FOREACH branchloo IN branchloop %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]</select> <input type="submit" value="Clone" /></form>[% END %]</fieldset> |
104 |
<select name="tobranch" id="tobranch">[% FOREACH branchloo IN branchloop %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]</select> <input type="submit" value="Clone" /></form>[% END %] |
| 61 |
|
105 |
|
| 62 |
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
106 |
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
| 63 |
<input type="hidden" name="op" value="add" /> |
107 |
<input type="hidden" name="op" value="add" /> |
| 64 |
<table> |
108 |
<input type="hidden" name="branch" value="[% branch %]"/> |
|
|
109 |
<table id="default-circulation-rules"> |
| 65 |
<tr> |
110 |
<tr> |
| 66 |
<th>Patron category</th> |
111 |
<th>Patron category</th> |
| 67 |
<th>Item type</th> |
112 |
<th>Item type</th> |
|
Lines 76-83
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
| 76 |
<th>Suspension in days (day)</th> |
121 |
<th>Suspension in days (day)</th> |
| 77 |
<th>Renewals allowed (count)</th> |
122 |
<th>Renewals allowed (count)</th> |
| 78 |
<th>Holds allowed (count)</th> |
123 |
<th>Holds allowed (count)</th> |
| 79 |
<th>Rental discount (%)</th> |
124 |
<th>Rental discount (%)</th> |
| 80 |
<th> </th> |
125 |
<th colspan="2"> </th> |
| 81 |
</tr> |
126 |
</tr> |
| 82 |
[% FOREACH rule IN rules %] |
127 |
[% FOREACH rule IN rules %] |
| 83 |
[% UNLESS ( loop.odd ) %] |
128 |
[% UNLESS ( loop.odd ) %] |
|
Lines 122-127
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
| 122 |
<td>[% rule.renewalsallowed %]</td> |
167 |
<td>[% rule.renewalsallowed %]</td> |
| 123 |
<td>[% rule.reservesallowed %]</td> |
168 |
<td>[% rule.reservesallowed %]</td> |
| 124 |
<td>[% rule.rentaldiscount %]</td> |
169 |
<td>[% rule.rentaldiscount %]</td> |
|
|
170 |
<td><a href="#" class="editrule">Edit</a></td> |
| 125 |
<td> |
171 |
<td> |
| 126 |
<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]">Delete</a> |
172 |
<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]">Delete</a> |
| 127 |
</td> |
173 |
</td> |
|
Lines 129-135
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
| 129 |
[% END %] |
175 |
[% END %] |
| 130 |
<tr> |
176 |
<tr> |
| 131 |
<td> |
177 |
<td> |
| 132 |
<select name="categorycode"> |
178 |
<select name="categorycode" id="categorycode"> |
| 133 |
<option value="*">All</option> |
179 |
<option value="*">All</option> |
| 134 |
[% FOREACH categoryloo IN categoryloop %] |
180 |
[% FOREACH categoryloo IN categoryloop %] |
| 135 |
<option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option> |
181 |
<option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option> |
|
Lines 137-158
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
| 137 |
</select> |
183 |
</select> |
| 138 |
</td> |
184 |
</td> |
| 139 |
<td> |
185 |
<td> |
| 140 |
<select name="itemtype" style="width:13em;"> |
186 |
<select name="itemtype" id="matrixitemtype" style="width:13em;"> |
| 141 |
<option value="*">All</option> |
187 |
<option value="*">All</option> |
| 142 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
188 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
| 143 |
<option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> |
189 |
<option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> |
| 144 |
[% END %] |
190 |
[% END %] |
| 145 |
</select> |
191 |
</select> |
| 146 |
</td> |
192 |
</td> |
| 147 |
<td><input name="maxissueqty" size="3" /></td> |
193 |
<td><input name="maxissueqty" id="maxissueqty" size="3" /></td> |
| 148 |
<td><input name="issuelength" size="3" /> </td> |
194 |
<td><input name="issuelength" id="issuelength" size="3" /> </td> |
| 149 |
<td> |
195 |
<td> |
| 150 |
<select name="lengthunit"> |
196 |
<select name="lengthunit" id="lengthunit"> |
| 151 |
<option value="days" selected>Days</option> |
197 |
<option value="days" selected>Days</option> |
| 152 |
<option value="hours">Hours</option> |
198 |
<option value="hours">Hours</option> |
| 153 |
</select> |
199 |
</select> |
| 154 |
</td> |
200 |
</td> |
| 155 |
<td><select name="hardduedatecompare"> |
201 |
<td> |
|
|
202 |
<select name="hardduedatecompare" id="hardduedatecompare"> |
| 156 |
<option value="-1">Before</option> |
203 |
<option value="-1">Before</option> |
| 157 |
<option value="0">Exactly on</option> |
204 |
<option value="0">Exactly on</option> |
| 158 |
<option value="1">After</option> |
205 |
<option value="1">After</option> |
|
Lines 160-174
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
Link Here
|
| 160 |
<input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" /> |
207 |
<input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" /> |
| 161 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
208 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
| 162 |
</td> |
209 |
</td> |
| 163 |
<td><input name="fine" size="4" /></td> |
210 |
<td><input name="fine" id="fine" size="4" /></td> |
| 164 |
<td><input name="chargeperiod" size="2" /></td> |
211 |
<td><input name="chargeperiod" id="chargeperiod" size="2" /></td> |
| 165 |
<td><input name="firstremind" size="2" /> </td> |
212 |
<td><input name="firstremind" id="firstremind" size="2" /> </td> |
| 166 |
<td><input name="overduefinescap" size="6" /> </td> |
213 |
<td><input name="overduefinescap" id="overduefinescap" size="6" /> </td> |
| 167 |
<td><input name="finedays" size="3" /> </td> |
214 |
<td><input name="finedays" id="fined" size="3" /> </td> |
| 168 |
<td><input name="renewalsallowed" size="2" /></td> |
215 |
<td><input name="renewalsallowed" id="renewalsallowed" size="2" /></td> |
| 169 |
<td><input name="reservesallowed" size="2" /></td> |
216 |
<td><input name="reservesallowed" id="reservesallowed" size="2" /></td> |
| 170 |
<td><input name="rentaldiscount" size="2" /></td> |
217 |
<td><input name="rentaldiscount" id="rentaldiscount" size="2" /></td> |
| 171 |
<td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td> |
218 |
<td colspan="2"> |
|
|
219 |
<input type="hidden" name="branch" value="[% current_branch %]"/> |
| 220 |
<input type="submit" value="Save" class="submit" /> |
| 221 |
</td> |
| 172 |
</tr> |
222 |
</tr> |
| 173 |
</table> |
223 |
</table> |
| 174 |
</form> |
224 |
</form> |
| 175 |
- |
|
|