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

(-)a/admin/smart-rules.pl (-4 / +6 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, renewalperiod, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
104
    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(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
105
    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=?");
105
    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=?");
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 114-119 elsif ($op eq 'add') { Link Here
114
    my $maxissueqty  = $input->param('maxissueqty');
114
    my $maxissueqty  = $input->param('maxissueqty');
115
    my $renewalsallowed  = $input->param('renewalsallowed');
115
    my $renewalsallowed  = $input->param('renewalsallowed');
116
    my $renewalperiod    = $input->param('renewalperiod');
116
    my $renewalperiod    = $input->param('renewalperiod');
117
    my $norenewalbefore  = $input->param('norenewalbefore');
118
    $norenewalbefore = undef if $norenewalbefore == 0;
117
    my $reservesallowed  = $input->param('reservesallowed');
119
    my $reservesallowed  = $input->param('reservesallowed');
118
    $maxissueqty =~ s/\s//g;
120
    $maxissueqty =~ s/\s//g;
119
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
121
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
Lines 129-137 elsif ($op eq 'add') { Link Here
129
    $sth_search->execute($br,$bor,$cat);
131
    $sth_search->execute($br,$bor,$cat);
130
    my $res = $sth_search->fetchrow_hashref();
132
    my $res = $sth_search->fetchrow_hashref();
131
    if ($res->{total}) {
133
    if ($res->{total}) {
132
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
134
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
133
    } else {
135
    } else {
134
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
136
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
135
    }
137
    }
136
} 
138
} 
137
elsif ($op eq "set-branch-defaults") {
139
elsif ($op eq "set-branch-defaults") {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +3 lines)
Lines 150-155 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
150
                <th>Suspension in days (day)</th>
150
                <th>Suspension in days (day)</th>
151
                <th>Renewals allowed (count)</th>
151
                <th>Renewals allowed (count)</th>
152
                <th>Renewal period</th>
152
                <th>Renewal period</th>
153
                <th>No renewal before</th>
153
                <th>Holds allowed (count)</th>
154
                <th>Holds allowed (count)</th>
154
                <th>Rental discount (%)</th>
155
                <th>Rental discount (%)</th>
155
                <th colspan="2">&nbsp;</th>
156
                <th colspan="2">&nbsp;</th>
Lines 207-212 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
207
							<td>[% rule.finedays %]</td>
208
							<td>[% rule.finedays %]</td>
208
							<td>[% rule.renewalsallowed %]</td>
209
							<td>[% rule.renewalsallowed %]</td>
209
                            <td>[% rule.renewalperiod %]</td>
210
                            <td>[% rule.renewalperiod %]</td>
211
                            <td>[% rule.norenewalbefore %]</td>
210
							<td>[% rule.reservesallowed %]</td>
212
							<td>[% rule.reservesallowed %]</td>
211
							<td>[% rule.rentaldiscount %]</td>
213
							<td>[% rule.rentaldiscount %]</td>
212
                            <td><a href="#" class="editrule">Edit</a></td>
214
                            <td><a href="#" class="editrule">Edit</a></td>
Lines 256-261 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
256
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
258
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
257
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
259
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
258
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
260
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
261
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
259
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
262
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
260
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
263
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
261
                    <td colspan="2">
264
                    <td colspan="2">
262
- 

Return to bug 7413