View | Details | Raw Unified | Return to bug 5788
Collapse All | Expand All

(-)a/admin/smart-rules.pl (-4 / +5 lines)
Lines 101-108 elsif ($op eq 'delete-branch-item') { Link Here
101
# save the values entered
101
# save the values entered
102
elsif ($op eq 'add') {
102
elsif ($op eq 'add') {
103
    my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?');
103
    my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?');
104
    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
104
    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(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
105
    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=?");
105
    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=?");
106
    
106
    
107
    my $br = $branch; # branch
107
    my $br = $branch; # branch
108
    my $bor  = $input->param('categorycode'); # borrower category
108
    my $bor  = $input->param('categorycode'); # borrower category
Lines 122-135 elsif ($op eq 'add') { Link Here
122
    $hardduedate = format_date_in_iso($hardduedate);
122
    $hardduedate = format_date_in_iso($hardduedate);
123
    my $hardduedatecompare = $input->param('hardduedatecompare');
123
    my $hardduedatecompare = $input->param('hardduedatecompare');
124
    my $rentaldiscount = $input->param('rentaldiscount');
124
    my $rentaldiscount = $input->param('rentaldiscount');
125
    my $reservesmaxpickupdelay = $input->param('reservesmaxpickupdelay');
125
    $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
126
    $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
126
127
127
    $sth_search->execute($br,$bor,$cat);
128
    $sth_search->execute($br,$bor,$cat);
128
    my $res = $sth_search->fetchrow_hashref();
129
    my $res = $sth_search->fetchrow_hashref();
129
    if ($res->{total}) {
130
    if ($res->{total}) {
130
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat);
131
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$reservesmaxpickupdelay, $br,$bor,$cat);
131
    } else {
132
    } else {
132
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount);
133
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$reservesmaxpickupdelay);
133
    }
134
    }
134
} 
135
} 
135
elsif ($op eq "set-branch-defaults") {
136
elsif ($op eq "set-branch-defaults") {
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 995-1000 CREATE TABLE `issuingrules` ( Link Here
995
  `renewalsallowed` smallint(6) NOT NULL default "0",
995
  `renewalsallowed` smallint(6) NOT NULL default "0",
996
  `reservesallowed` smallint(6) NOT NULL default "0",
996
  `reservesallowed` smallint(6) NOT NULL default "0",
997
  `branchcode` varchar(10) NOT NULL default '',
997
  `branchcode` varchar(10) NOT NULL default '',
998
  `reservesmaxpickupdelay` smallint(6) default NULL,
998
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
999
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
999
  KEY `categorycode` (`categorycode`),
1000
  KEY `categorycode` (`categorycode`),
1000
  KEY `itemtype` (`itemtype`)
1001
  KEY `itemtype` (`itemtype`)
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +8 lines)
Lines 2092-2098 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
2092
    $dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
2092
    $dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
2093
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
2093
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
2094
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
2094
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
2095
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='ReservesMaxPickupDelay'");
2096
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
2095
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
2097
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
2096
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
2098
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
2097
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
Lines 5036-5041 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5036
    SetVersion($DBversion);
5035
    SetVersion($DBversion);
5037
}
5036
}
5038
5037
5038
$DBversion = '3.07.00.XXX';
5039
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5040
    $dbh->do("ALTER TABLE issuingrules ADD reservesmaxpickupdelay smallint(6) DEFAULT NULL");
5041
5042
    print "Upgrade to $DBversion done (Bug 5788 ReservesMaxPickupDelay circulation rule)\n";
5043
    SetVersion ($DBversion);
5044
}
5045
5039
=head1 FUNCTIONS
5046
=head1 FUNCTIONS
5040
5047
5041
=head2 DropAllForeignKeys($table)
5048
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-2 / +4 lines)
Lines 81-86 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
81
                <th>Suspension in days (day)</th>
81
                <th>Suspension in days (day)</th>
82
                <th>Renewals allowed (count)</th>
82
                <th>Renewals allowed (count)</th>
83
                <th>Holds allowed (count)</th>
83
                <th>Holds allowed (count)</th>
84
                <th>Holds Max Pickup Delay (day)</th>
84
		<th>Rental discount (%)</th>
85
		<th>Rental discount (%)</th>
85
				<th>&nbsp;</th>
86
				<th>&nbsp;</th>
86
            </tr>
87
            </tr>
Lines 125-130 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
125
							<td>[% rule.finedays %]</td>
126
							<td>[% rule.finedays %]</td>
126
							<td>[% rule.renewalsallowed %]</td>
127
							<td>[% rule.renewalsallowed %]</td>
127
							<td>[% rule.reservesallowed %]</td>
128
							<td>[% rule.reservesallowed %]</td>
129
							<td>[% rule.reservesmaxpickupdelay %]</td>
128
							<td>[% rule.rentaldiscount %]</td>
130
							<td>[% rule.rentaldiscount %]</td>
129
							<td>
131
							<td>
130
								<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>
132
								<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>
Lines 185-191 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
185
                    <td><input name="finedays" size="3" /> </td>
187
                    <td><input name="finedays" size="3" /> </td>
186
                    <td><input name="renewalsallowed" size="2" /></td>
188
                    <td><input name="renewalsallowed" size="2" /></td>
187
                    <td><input name="reservesallowed" size="2" /></td>
189
                    <td><input name="reservesallowed" size="2" /></td>
188
		    <td><input name="rentaldiscount" size="2" /></td>
190
                    <td><input name="reservesmaxpickupdelay" size="2" /></td>
191
		            <td><input name="rentaldiscount" size="2" /></td>
189
                    <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
192
                    <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
190
                </tr>
193
                </tr>
191
            </table>
194
            </table>
192
- 

Return to bug 5788