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, 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, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
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=?");
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, 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 116-121 elsif ($op eq 'add') { Link Here
116
    my $renewalperiod    = $input->param('renewalperiod');
116
    my $renewalperiod    = $input->param('renewalperiod');
117
    my $norenewalbefore  = $input->param('norenewalbefore');
117
    my $norenewalbefore  = $input->param('norenewalbefore');
118
    $norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/;
118
    $norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/;
119
    my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0;
119
    my $reservesallowed  = $input->param('reservesallowed');
120
    my $reservesallowed  = $input->param('reservesallowed');
120
    $maxissueqty =~ s/\s//g;
121
    $maxissueqty =~ s/\s//g;
121
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
122
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
Lines 131-139 elsif ($op eq 'add') { Link Here
131
    $sth_search->execute($br,$bor,$cat);
132
    $sth_search->execute($br,$bor,$cat);
132
    my $res = $sth_search->fetchrow_hashref();
133
    my $res = $sth_search->fetchrow_hashref();
133
    if ($res->{total}) {
134
    if ($res->{total}) {
134
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
135
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
135
    } else {
136
    } else {
136
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
137
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
137
    }
138
    }
138
} 
139
} 
139
elsif ($op eq "set-branch-defaults") {
140
elsif ($op eq "set-branch-defaults") {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +14 lines)
Lines 151-156 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
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>No renewal before</th>
154
                <th>Automatic renewal</th>
154
                <th>Holds allowed (count)</th>
155
                <th>Holds allowed (count)</th>
155
                <th>Rental discount (%)</th>
156
                <th>Rental discount (%)</th>
156
                <th colspan="2">&nbsp;</th>
157
                <th colspan="2">&nbsp;</th>
Lines 209-214 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
209
							<td>[% rule.renewalsallowed %]</td>
210
							<td>[% rule.renewalsallowed %]</td>
210
                            <td>[% rule.renewalperiod %]</td>
211
                            <td>[% rule.renewalperiod %]</td>
211
                            <td>[% rule.norenewalbefore %]</td>
212
                            <td>[% rule.norenewalbefore %]</td>
213
                            <td>
214
                                [% IF ( rule.auto_renew ) %]
215
                                Yes
216
                                [% ELSE %]
217
                                No
218
                                [% END %]
219
                            </td>
212
							<td>[% rule.reservesallowed %]</td>
220
							<td>[% rule.reservesallowed %]</td>
213
							<td>[% rule.rentaldiscount %]</td>
221
							<td>[% rule.rentaldiscount %]</td>
214
                            <td><a href="#" class="editrule">Edit</a></td>
222
                            <td><a href="#" class="editrule">Edit</a></td>
Lines 259-264 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
259
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
267
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
260
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
268
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
261
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
269
                    <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
270
                    <td>
271
                        <select name="auto_renew" id="auto_renew">
272
                            <option value="no" selected>No</option>
273
                            <option value="yes">Yes</option>
274
                        </select>
275
                    </td>
262
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
276
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
263
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
277
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
264
                    <td colspan="2">
278
                    <td colspan="2">
265
- 

Return to bug 11577