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, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
104
    my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, fine, finedays, firstremind, chargeperiod,rentaldiscount, reservesmaxpickupdelay, rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
105
    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=?");
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, rentaldiscount=?, reservesmaxpickupdelay=?, rentaldiscount=?  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 121-134 elsif ($op eq 'add') { Link Here
121
    $hardduedate = format_date_in_iso($hardduedate);
121
    $hardduedate = format_date_in_iso($hardduedate);
122
    my $hardduedatecompare = $input->param('hardduedatecompare');
122
    my $hardduedatecompare = $input->param('hardduedatecompare');
123
    my $rentaldiscount = $input->param('rentaldiscount');
123
    my $rentaldiscount = $input->param('rentaldiscount');
124
    my $reservesmaxpickupdelay = $input->param('reservesmaxpickupdelay');
124
    $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
125
    $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
125
126
126
    $sth_search->execute($br,$bor,$cat);
127
    $sth_search->execute($br,$bor,$cat);
127
    my $res = $sth_search->fetchrow_hashref();
128
    my $res = $sth_search->fetchrow_hashref();
128
    if ($res->{total}) {
129
    if ($res->{total}) {
129
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat);
130
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$rentaldiscount, $reservesmaxpickupdelay, $rentaldiscount, $br,$bor,$cat);
130
    } else {
131
    } else {
131
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount);
132
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$reservesmaxpickupdelay,$rentaldiscount);
132
    }
133
    }
133
} 
134
} 
134
elsif ($op eq "set-branch-defaults") {
135
elsif ($op eq "set-branch-defaults") {
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +9 lines)
Lines 2093-2099 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
2093
    $dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
2093
    $dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
2094
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
2094
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
2095
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
2095
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
2096
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='ReservesMaxPickupDelay'");
2097
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
2096
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
2098
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
2097
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
2099
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
2098
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
Lines 4370-4375 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4370
    SetVersion($DBversion);
4369
    SetVersion($DBversion);
4371
}
4370
}
4372
4371
4372
$DBversion = '3.05.00.XXX';
4373
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4374
    print "Upgrade to $DBversion done (Bug 5788 ReservesMaxPickupDelay circulation rule)\n";
4375
4376
    $dbh->do("ALTER TABLE issuingrules ADD reservesmaxpickupdelay INTEGER");
4377
4378
    SetVersion ($DBversion);
4379
}
4380
4373
=head1 FUNCTIONS
4381
=head1 FUNCTIONS
4374
4382
4375
=head2 DropAllForeignKeys($table)
4383
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-2 / +4 lines)
Lines 80-85 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
80
                <th>Suspension in Days (day)</th>
80
                <th>Suspension in Days (day)</th>
81
                <th>Renewals Allowed (count)</th>
81
                <th>Renewals Allowed (count)</th>
82
                <th>Holds Allowed (count)</th>
82
                <th>Holds Allowed (count)</th>
83
                <th>Holds Max Pickup Delay (day)</th>
83
		        <th>Rental Discount (%)</th>
84
		        <th>Rental Discount (%)</th>
84
				<th>&nbsp;</th>
85
				<th>&nbsp;</th>
85
            </tr>
86
            </tr>
Lines 121-126 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
121
							<td>[% rule.finedays %]</td>
122
							<td>[% rule.finedays %]</td>
122
							<td>[% rule.renewalsallowed %]</td>
123
							<td>[% rule.renewalsallowed %]</td>
123
							<td>[% rule.reservesallowed %]</td>
124
							<td>[% rule.reservesallowed %]</td>
125
							<td>[% rule.reservesmaxpickupdelay %]</td>
124
							<td>[% rule.rentaldiscount %]</td>
126
							<td>[% rule.rentaldiscount %]</td>
125
							<td>
127
							<td>
126
								<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>
128
								<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 175-181 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
175
                    <td><input name="finedays" size="3" /> </td>
177
                    <td><input name="finedays" size="3" /> </td>
176
                    <td><input name="renewalsallowed" size="2" /></td>
178
                    <td><input name="renewalsallowed" size="2" /></td>
177
                    <td><input name="reservesallowed" size="2" /></td>
179
                    <td><input name="reservesallowed" size="2" /></td>
178
		    <td><input name="rentaldiscount" size="2" /></td>
180
                    <td><input name="reservesmaxpickupdelay" size="2" /></td>
181
		            <td><input name="rentaldiscount" size="2" /></td>
179
                    <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
182
                    <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
180
                </tr>
183
                </tr>
181
            </table>
184
            </table>
182
- 

Return to bug 5788