---
 admin/smart-rules.pl                               |    9 +++++----
 installer/data/mysql/kohastructure.sql             |    1 +
 installer/data/mysql/updatedatabase.pl             |    9 ++++++++-
 .../prog/en/modules/admin/smart-rules.tt           |    5 ++++-
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl
index 0b8012f..c23b334 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, lengthunit, hardduedate, hardduedatecompare, fine, finedays, 
firstremind, chargeperiod,rentaldiscount) 
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
-    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, 
firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, 
reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, 
hardduedatecompare=?, rentaldiscount=?  WHERE branchcode=? AND categorycode=? 
AND itemtype=?");
+    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, 
categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, 
issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, 
firstremind, chargeperiod,rentaldiscount,reservesmaxpickupdelay) 
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
+    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, 
firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, 
reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, 
hardduedatecompare=?, rentaldiscount=?, reservesmaxpickupdelay=?  WHERE 
branchcode=? AND categorycode=? AND itemtype=?");
     
     my $br = $branch; # branch
     my $bor  = $input->param('categorycode'); # borrower category
@@ -122,14 +122,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,$lengthunit, 
$hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat);
+        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, 
$maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, 
$hardduedate,$hardduedatecompare,$rentaldiscount,$reservesmaxpickupdelay, 
$br,$bor,$cat);
     } else {
-        
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount);
+        
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$reservesmaxpickupdelay);
     }
 } 
 elsif ($op eq "set-branch-defaults") {
diff --git a/installer/data/mysql/kohastructure.sql 
b/installer/data/mysql/kohastructure.sql
index 77423d1..a03d180 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -995,6 +995,7 @@ CREATE TABLE `issuingrules` (
   `renewalsallowed` smallint(6) NOT NULL default "0",
   `reservesallowed` smallint(6) NOT NULL default "0",
   `branchcode` varchar(10) NOT NULL default '',
+  `reservesmaxpickupdelay` smallint(6) default NULL,
   PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
   KEY `categorycode` (`categorycode`),
   KEY `itemtype` (`itemtype`)
diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 8259bf2..9848f80 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2092,7 +2092,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'");
@@ -5036,6 +5035,14 @@ if ( C4::Context->preference("Version") < 
TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = '3.07.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE issuingrules ADD reservesmaxpickupdelay smallint(6) 
DEFAULT NULL");
+
+    print "Upgrade to $DBversion done (Bug 5788 ReservesMaxPickupDelay 
circulation rule)\n";
+    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 7b01ac7..f35953a 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
@@ -81,6 +81,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>&nbsp;</th>
             </tr>
@@ -125,6 +126,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&amp;itemtype=[% 
rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% 
rule.current_branch %]">Delete</a>
@@ -185,7 +187,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.7.5.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to