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 152-157 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
152
                <th>Renewals allowed (count)</th>
152
                <th>Renewals allowed (count)</th>
153
                <th>Renewal period</th>
153
                <th>Renewal period</th>
154
                <th>No renewal before</th>
154
                <th>No renewal before</th>
155
                <th>Automatic renewal</th>
155
                <th>Holds allowed (count)</th>
156
                <th>Holds allowed (count)</th>
156
                <th>Rental discount (%)</th>
157
                <th>Rental discount (%)</th>
157
                <th colspan="2">&nbsp;</th>
158
                <th colspan="2">&nbsp;</th>
Lines 211-216 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
211
							<td>[% rule.renewalsallowed %]</td>
212
							<td>[% rule.renewalsallowed %]</td>
212
                            <td>[% rule.renewalperiod %]</td>
213
                            <td>[% rule.renewalperiod %]</td>
213
                            <td>[% rule.norenewalbefore %]</td>
214
                            <td>[% rule.norenewalbefore %]</td>
215
                            <td>
216
                                [% IF ( rule.auto_renew ) %]
217
                                Yes
218
                                [% ELSE %]
219
                                No
220
                                [% END %]
221
                            </td>
214
							<td>[% rule.reservesallowed %]</td>
222
							<td>[% rule.reservesallowed %]</td>
215
							<td>[% rule.rentaldiscount %]</td>
223
							<td>[% rule.rentaldiscount %]</td>
216
                            <td><a href="#" class="editrule">Edit</a></td>
224
                            <td><a href="#" class="editrule">Edit</a></td>
Lines 262-267 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
262
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
270
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
263
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
271
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
264
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
272
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
273
                    <td>
274
                        <select name="auto_renew" id="auto_renew">
275
                            <option value="no" selected>No</option>
276
                            <option value="yes">Yes</option>
277
                        </select>
278
                    </td>
265
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
279
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
266
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
280
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
267
                    <td colspan="2">
281
                    <td colspan="2">
268
- 

Return to bug 11577