@@ -, +, @@ --- .../prog/en/modules/admin/smart-rules.tt | 96 +++++++++++++++----- 1 file changed, 73 insertions(+), 23 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -9,6 +9,50 @@ $(document).ready(function() { $('#branch').change(function() { $('#selectlibrary').submit(); }); + $(".editrule").click(function(){ + $(this).parent().parent().find("td").each(function (i) { + itm = $(this).text(); + itm = itm.replace(/^\s*|\s*$/g,''); + var current = $("#default-circulation-rules tr:last td:eq("+i+")"); + if ( i != 5 ) { + $(current).find("input").val(itm); + // select the corresponding option + $(current).find("select option").each(function(){ + if ( $(this).text().toLowerCase() == itm.toLowerCase() ) { + $(this).attr('selected', 'selected'); + } + }); + if ( i == 0 || i == 1 ) { + // Disable the 2 first columns, we cannot update them. + var val = $(current).find("select option:selected").val(); + var name = "categorycode"; + if ( i == 1 ) { + name="itemtype"; + } + // Remove potential previous input added + $(current).find("input").remove(); + $(current).append(""); + } + } else { + // specific processing for the Hard due date column + var s = itm.split(' '); + var select_value; + if ( s[0] == "before" ) { + select_value = -1 + } else if ( s[0] == "on" ) { + select_value = 0 + } else if ( s[0] == "after" ) { + select_value = 1 + } + $(current).find("input").val(s[1]); + $(current).find("select").val(select_value); + } + }); + $("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled'); + $("#default-circulation-rules tr:last td:eq(1) select").attr('disabled', 'disabled'); + $("#default-circulation-rules tr:last td:last input").val(_("Save")); + return false; + }); }); //]]> @@ -57,11 +101,12 @@ $(document).ready(function() { [% IF ( definedbranch ) %]
-
[% END %] + [% END %]
- + +
@@ -76,8 +121,8 @@ for="tobranch">Clone these rules to:  [% FOREACH rule IN rules %] [% UNLESS ( loop.odd ) %] @@ -122,6 +167,7 @@ for="tobranch">Clone these rules to:Edit @@ -129,7 +175,7 @@ for="tobranch">Clone these rules to: + + - - + + - + - - - - - - - - - + + + + + + + + +
Patron category Item type
Delete - - + + + + +
[% INCLUDE 'date-format.inc' %]
+ + +
--