[Koha-patches] [PATCH 1/1] bug_5788: Moved ReservesMaxPickupDelay syspref to issue rules
Srdjan Jankovic
srdjan at catalyst.net.nz
Tue Aug 2 05:32:11 CEST 2011
---
admin/smart-rules.pl | 9 +++++----
installer/data/mysql/updatedatabase.pl | 10 +++++++++-
.../prog/en/modules/admin/smart-rules.tt | 5 ++++-
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl
index f290934..9496f47 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, reservesallowed, issuelength, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
+ my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, fine, finedays, firstremind, chargeperiod, reservesmaxpickupdelay, rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)");
+ my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, reservesmaxpickupdelay=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
my $br = $branch; # branch
my $bor = $input->param('categorycode'); # borrower category
@@ -121,14 +121,15 @@ elsif ($op eq 'add') {
$hardduedate = format_date_in_iso($hardduedate);
my $hardduedatecompare = $input->param('hardduedatecompare');
my $rentaldiscount = $input->param('rentaldiscount');
+ my $reservesmaxpickupdelay = $input->param('reservesmaxpickupdelay');
$debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
$sth_search->execute($br,$bor,$cat);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
- $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat);
+ $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength, $reservesmaxpickupdelay, $rentaldiscount, $br,$bor,$cat);
} else {
- $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount);
+ $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$fine,$finedays,$firstremind,$chargeperiod,$reservesmaxpickupdelay,$rentaldiscount);
}
}
elsif ($op eq "set-branch-defaults") {
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 9cbc8db..dbd2595 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2093,7 +2093,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
$dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
$dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
- $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='ReservesMaxPickupDelay'");
$dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
$dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
$dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
@@ -4370,6 +4369,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion($DBversion);
}
+$DBversion = '3.05.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ print "Upgrade to $DBversion done (Bug 5788 ReservesMaxPickupDelay circulation rule)\n";
+
+ $dbh->do("ALTER TABLE issuingrules ADD reservesmaxpickupdelay INTEGER");
+
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
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 0edcece..5bda091 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
@@ -80,6 +80,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>Holds Allowed (count)</th>
+ <th>Holds Max Pickup Delay (day)</th>
<th>Rental Discount (%)</th>
<th> </th>
</tr>
@@ -121,6 +122,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
<td>[% rule.finedays %]</td>
<td>[% rule.renewalsallowed %]</td>
<td>[% rule.reservesallowed %]</td>
+ <td>[% rule.reservesmaxpickupdelay %]</td>
<td>[% rule.rentaldiscount %]</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>
@@ -175,7 +177,8 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
<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 name="reservesmaxpickupdelay" 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>
</tr>
</table>
--
1.6.5
More information about the Koha-patches
mailing list