Bugzilla – Attachment 14818 Details for
Bug 4354
Cannot edit existing issuing rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 4354: Cannot edit existing issuing rules
SIGNED-OFF-Bug-4354-Cannot-edit-existing-issuing-r.patch (text/plain), 10.24 KB, created by
Nicole C. Engard
on 2013-01-24 13:52:04 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 4354: Cannot edit existing issuing rules
Filename:
MIME Type:
Creator:
Nicole C. Engard
Created:
2013-01-24 13:52:04 UTC
Size:
10.24 KB
patch
obsolete
>From 8a5dd861b74af91c7bb0c82b3864292145910e7e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 16 Jan 2013 16:51:13 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 4354: Cannot edit existing issuing rules > >This patch adds javascript which pulls the values from the >chosen row of data and populates the last row's form with >that data. Some changes have been made to the markup to >better accommodate this. > >Possibly missing is some kind of visual feedback to the user >that the edit action is taking place in a different row from >where they clicked. Comments are especially welcomed on >this aspect of the interaction. > >The original author of this patch is Owen Leonard <oleonard@myacpl.org> > >Test Plan: >* Edit an existing circulation rule >* Delete a circulation rule >* Create a new circulation rule >* Create a new circulation rule that is a dup of an old one >and make sure that it still overwrites the old rule like before > >Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com> > >All tests passed. >--- > .../prog/en/modules/admin/smart-rules.tt | 96 +++++++++++++++----- > 1 files changed, 73 insertions(+), 23 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 586d72f..76f54a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/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("<input type='hidden' name='"+name+"' value='"+val+"' />"); >+ } >+ } 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; >+ }); > }); > //]]> > </script> >@@ -57,11 +101,12 @@ $(document).ready(function() { > </form> > [% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label > for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" /> >- <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> >+ <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 %] > > <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> > <input type="hidden" name="op" value="add" /> >- <table> >+ <input type="hidden" name="branch" value="[% branch %]"/> >+ <table id="default-circulation-rules"> > <tr> > <th>Patron category</th> > <th>Item type</th> >@@ -76,8 +121,8 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <th>Suspension in days (day)</th> > <th>Renewals allowed (count)</th> > <th>Holds allowed (count)</th> >- <th>Rental discount (%)</th> >- <th> </th> >+ <th>Rental discount (%)</th> >+ <th colspan="2"> </th> > </tr> > [% FOREACH rule IN rules %] > [% UNLESS ( loop.odd ) %] >@@ -122,6 +167,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td>[% rule.renewalsallowed %]</td> > <td>[% rule.reservesallowed %]</td> > <td>[% rule.rentaldiscount %]</td> >+ <td><a href="#" class="editrule">Edit</a></td> > <td> > <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> > </td> >@@ -129,7 +175,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > [% END %] > <tr> > <td> >- <select name="categorycode"> >+ <select name="categorycode" id="categorycode"> > <option value="*">All</option> > [% FOREACH categoryloo IN categoryloop %] > <option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option> >@@ -137,22 +183,23 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > </select> > </td> > <td> >- <select name="itemtype" style="width:13em;"> >+ <select name="itemtype" id="matrixitemtype" style="width:13em;"> > <option value="*">All</option> > [% FOREACH itemtypeloo IN itemtypeloop %] > <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> > [% END %] > </select> > </td> >- <td><input name="maxissueqty" size="3" /></td> >- <td><input name="issuelength" size="3" /> </td> >+ <td><input name="maxissueqty" id="maxissueqty" size="3" /></td> >+ <td><input name="issuelength" id="issuelength" size="3" /> </td> > <td> >- <select name="lengthunit"> >- <option value="days" selected>Days</option> >- <option value="hours">Hours</option> >- </select> >- </td> >- <td><select name="hardduedatecompare"> >+ <select name="lengthunit" id="lengthunit"> >+ <option value="days" selected>Days</option> >+ <option value="hours">Hours</option> >+ </select> >+ </td> >+ <td> >+ <select name="hardduedatecompare" id="hardduedatecompare"> > <option value="-1">Before</option> > <option value="0">Exactly on</option> > <option value="1">After</option> >@@ -160,15 +207,18 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" /> > <div class="hint">[% INCLUDE 'date-format.inc' %]</div> > </td> >- <td><input name="fine" size="4" /></td> >- <td><input name="chargeperiod" size="2" /></td> >- <td><input name="firstremind" size="2" /> </td> >- <td><input name="overduefinescap" size="6" /> </td> >- <td><input name="finedays" size="3" /> </td> >- <td><input name="renewalsallowed" size="2" /></td> >- <td><input name="reservesallowed" size="2" /></td> >- <td><input name="rentaldiscount" size="2" /></td> >- <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td> >+ <td><input name="fine" id="fine" size="4" /></td> >+ <td><input name="chargeperiod" id="chargeperiod" size="2" /></td> >+ <td><input name="firstremind" id="firstremind" size="2" /> </td> >+ <td><input name="overduefinescap" id="overduefinescap" size="6" /> </td> >+ <td><input name="finedays" id="fined" size="3" /> </td> >+ <td><input name="renewalsallowed" id="renewalsallowed" size="2" /></td> >+ <td><input name="reservesallowed" id="reservesallowed" size="2" /></td> >+ <td><input name="rentaldiscount" id="rentaldiscount" size="2" /></td> >+ <td colspan="2"> >+ <input type="hidden" name="branch" value="[% current_branch %]"/> >+ <input type="submit" value="Save" class="submit" /> >+ </td> > </tr> > </table> > </form> >-- >1.7.2.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4354
:
2182
|
2932
|
2946
|
14622
|
14818
|
14819
|
14821
|
14824
|
14829
|
16199
|
16200
|
16234
|
16610
|
16611
|
16615
|
16616
|
16617
|
16618
|
16650
|
16654
|
16655
|
16656
|
16657
|
16658