View | Details | Raw Unified | Return to bug 11577
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, renewalperiod, norenewalbefore, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
104
    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, norenewalbefore, auto_renew, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=?  WHERE branchcode=? AND categorycode=? AND itemtype=?");
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, auto_renew=?, 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 118-123 elsif ($op eq 'add') { Link Here
118
    my $renewalperiod    = $input->param('renewalperiod');
118
    my $renewalperiod    = $input->param('renewalperiod');
119
    my $norenewalbefore  = $input->param('norenewalbefore');
119
    my $norenewalbefore  = $input->param('norenewalbefore');
120
    $norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/;
120
    $norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/;
121
    my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0;
121
    my $reservesallowed  = $input->param('reservesallowed');
122
    my $reservesallowed  = $input->param('reservesallowed');
122
    $maxissueqty =~ s/\s//g;
123
    $maxissueqty =~ s/\s//g;
123
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
124
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
Lines 133-141 elsif ($op eq 'add') { Link Here
133
    $sth_search->execute($br,$bor,$cat);
134
    $sth_search->execute($br,$bor,$cat);
134
    my $res = $sth_search->fetchrow_hashref();
135
    my $res = $sth_search->fetchrow_hashref();
135
    if ($res->{total}) {
136
    if ($res->{total}) {
136
        $sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
137
        $sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
137
    } else {
138
    } else {
138
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
139
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
139
    }
140
    }
140
} 
141
} 
141
elsif ($op eq "set-branch-defaults") {
142
elsif ($op eq "set-branch-defaults") {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +14 lines)
Lines 154-159 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
154
                <th>Renewals allowed (count)</th>
154
                <th>Renewals allowed (count)</th>
155
                <th>Renewal period</th>
155
                <th>Renewal period</th>
156
                <th>No renewal before</th>
156
                <th>No renewal before</th>
157
                <th>Automatic renewal</th>
157
                <th>Holds allowed (count)</th>
158
                <th>Holds allowed (count)</th>
158
                <th>Rental discount (%)</th>
159
                <th>Rental discount (%)</th>
159
                <th colspan="2">&nbsp;</th>
160
                <th colspan="2">&nbsp;</th>
Lines 213-218 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
213
							<td>[% rule.renewalsallowed %]</td>
214
							<td>[% rule.renewalsallowed %]</td>
214
                            <td>[% rule.renewalperiod %]</td>
215
                            <td>[% rule.renewalperiod %]</td>
215
                            <td>[% rule.norenewalbefore %]</td>
216
                            <td>[% rule.norenewalbefore %]</td>
217
                            <td>
218
                                [% IF ( rule.auto_renew ) %]
219
                                Yes
220
                                [% ELSE %]
221
                                No
222
                                [% END %]
223
                            </td>
216
							<td>[% rule.reservesallowed %]</td>
224
							<td>[% rule.reservesallowed %]</td>
217
							<td>[% rule.rentaldiscount %]</td>
225
							<td>[% rule.rentaldiscount %]</td>
218
                            <td><a href="#" class="editrule">Edit</a></td>
226
                            <td><a href="#" class="editrule">Edit</a></td>
Lines 264-269 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
264
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
272
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
265
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
273
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
266
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
274
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
275
                    <td>
276
                        <select name="auto_renew" id="auto_renew">
277
                            <option value="no" selected>No</option>
278
                            <option value="yes">Yes</option>
279
                        </select>
280
                    </td>
267
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
281
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
268
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
282
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
269
                    <td colspan="2">
283
                    <td colspan="2">
270
- 

Return to bug 11577