Bug 7413: Add "No renewal before" to the circulation and fine rules
This patch adds a column "No renewal before" to the circulation and fine rules table. To test: 1) Add or edit some issuing rules. 2) Confirm that an empty entry, zero and non-numerical values for "No renewal before" are saved as undefined. 3) Confirm that numerical values can be entered and saved. Sponsored-by: Hochschule für Gesundheit (hsg), Germany Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
069bf086fb
commit
6fd4b4f05a
2 changed files with 9 additions and 4 deletions
|
@ -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, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
|
||||
my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, 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, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
|
||||
my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
|
||||
|
||||
my $br = $branch; # branch
|
||||
my $bor = $input->param('categorycode'); # borrower category
|
||||
|
@ -114,6 +114,8 @@ elsif ($op eq 'add') {
|
|||
my $maxissueqty = $input->param('maxissueqty');
|
||||
my $renewalsallowed = $input->param('renewalsallowed');
|
||||
my $renewalperiod = $input->param('renewalperiod');
|
||||
my $norenewalbefore = $input->param('norenewalbefore');
|
||||
$norenewalbefore = undef if $norenewalbefore == 0;
|
||||
my $reservesallowed = $input->param('reservesallowed');
|
||||
$maxissueqty =~ s/\s//g;
|
||||
$maxissueqty = undef if $maxissueqty !~ /^\d+/;
|
||||
|
@ -129,9 +131,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,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
|
||||
$sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
|
||||
} else {
|
||||
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
|
||||
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
|
||||
}
|
||||
}
|
||||
elsif ($op eq "set-branch-defaults") {
|
||||
|
|
|
@ -150,6 +150,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
|
|||
<th>Suspension in days (day)</th>
|
||||
<th>Renewals allowed (count)</th>
|
||||
<th>Renewal period</th>
|
||||
<th>No renewal before</th>
|
||||
<th>Holds allowed (count)</th>
|
||||
<th>Rental discount (%)</th>
|
||||
<th colspan="2"> </th>
|
||||
|
@ -207,6 +208,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
|
|||
<td>[% rule.finedays %]</td>
|
||||
<td>[% rule.renewalsallowed %]</td>
|
||||
<td>[% rule.renewalperiod %]</td>
|
||||
<td>[% rule.norenewalbefore %]</td>
|
||||
<td>[% rule.reservesallowed %]</td>
|
||||
<td>[% rule.rentaldiscount %]</td>
|
||||
<td><a href="#" class="editrule">Edit</a></td>
|
||||
|
@ -256,6 +258,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
|
|||
<td><input type="text" name="finedays" id="fined" size="3" /> </td>
|
||||
<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><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
|
||||
<td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
|
||||
<td colspan="2">
|
||||
|
|
Loading…
Reference in a new issue