From 3f69ba42764a68b4701eed8db33031522dc56f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Mei=C3=9Fner?= <h.meissner.82@web.de> Date: Thu, 15 May 2014 16:30:39 +0200 Subject: [PATCH] Bug 11577: Add "Automatic renewal" to the circulation and fine rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a column "Automatic renewal" to the circulation and fine rules table. To test: 1) Add or edit some issuing rules. 2) Confirm that "Automatic Renewal" is set to "No" by default and can be switched to "Yes". Sponsored-by: Hochschule für Gesundheit (hsg), Germany Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> --- admin/smart-rules.pl | 9 +++++---- .../intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 5feba9f..eb3e875 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -101,8 +101,8 @@ elsif ($op eq 'delete-branch-item') { # save the values entered elsif ($op eq 'add') { my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?'); - my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, norenewalbefore, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); - my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); + my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, norenewalbefore, auto_renew, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); + my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, auto_renew=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); my $br = $branch; # branch my $bor = $input->param('categorycode'); # borrower category @@ -118,6 +118,7 @@ elsif ($op eq 'add') { my $renewalperiod = $input->param('renewalperiod'); my $norenewalbefore = $input->param('norenewalbefore'); $norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/; + my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0; my $reservesallowed = $input->param('reservesallowed'); $maxissueqty =~ s/\s//g; $maxissueqty = undef if $maxissueqty !~ /^\d+/; @@ -133,9 +134,9 @@ elsif ($op eq 'add') { $sth_search->execute($br,$bor,$cat); my $res = $sth_search->fetchrow_hashref(); if ($res->{total}) { - $sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); + $sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); } else { - $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); + $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); } } elsif ($op eq "set-branch-defaults") { 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 1b8b21a..fe846e6 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 @@ -154,6 +154,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde <th>Renewals allowed (count)</th> <th>Renewal period</th> <th>No renewal before</th> + <th>Automatic renewal</th> <th>Holds allowed (count)</th> <th>Rental discount (%)</th> <th colspan="2"> </th> @@ -213,6 +214,13 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde <td>[% rule.renewalsallowed %]</td> <td>[% rule.renewalperiod %]</td> <td>[% rule.norenewalbefore %]</td> + <td> + [% IF ( rule.auto_renew ) %] + Yes + [% ELSE %] + No + [% END %] + </td> <td>[% rule.reservesallowed %]</td> <td>[% rule.rentaldiscount %]</td> <td><a href="#" class="editrule">Edit</a></td> @@ -264,6 +272,12 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td> <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td> <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td> + <td> + <select name="auto_renew" id="auto_renew"> + <option value="no" selected>No</option> + <option value="yes">Yes</option> + </select> + </td> <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td> <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td> <td colspan="2"> -- 1.9.1