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

(-)a/Koha/CirculationRules.pm (-1 / +4 lines)
Lines 136-142 sub set_rule { Link Here
136
136
137
sub set_rules {
137
sub set_rules {
138
    my ( $self, $params ) = @_;
138
    my ( $self, $params ) = @_;
139
    warn Data::Dumper::Dumper( $params );
140
139
141
    my $branchcode   = $params->{branchcode};
140
    my $branchcode   = $params->{branchcode};
142
    my $categorycode = $params->{categorycode};
141
    my $categorycode = $params->{categorycode};
Lines 164-169 sub _type { Link Here
164
    return 'CirculationRule';
163
    return 'CirculationRule';
165
}
164
}
166
165
166
=head3 object_class
167
168
=cut
169
167
sub object_class {
170
sub object_class {
168
    return 'Koha::CirculationRule';
171
    return 'Koha::CirculationRule';
169
}
172
}
(-)a/admin/smart-rules.pl (-2 / +14 lines)
Lines 219-230 elsif ($op eq "set-branch-defaults") { Link Here
219
    my $holdallowed   = $input->param('holdallowed');
219
    my $holdallowed   = $input->param('holdallowed');
220
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
220
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
221
    my $returnbranch  = $input->param('returnbranch');
221
    my $returnbranch  = $input->param('returnbranch');
222
    my $max_holds = $input->param('max_holds');
222
    $maxissueqty =~ s/\s//g;
223
    $maxissueqty =~ s/\s//g;
223
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
224
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
224
    $maxonsiteissueqty =~ s/\s//g;
225
    $maxonsiteissueqty =~ s/\s//g;
225
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
226
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
226
    $holdallowed =~ s/\s//g;
227
    $holdallowed =~ s/\s//g;
227
    $holdallowed = undef if $holdallowed !~ /^\d+/;
228
    $holdallowed = undef if $holdallowed !~ /^\d+/;
229
    $max_holds =~ s/\s//g;
230
    $max_holds = undef if $max_holds !~ /^\d+/;
228
231
229
    if ($branch eq "*") {
232
    if ($branch eq "*") {
230
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
233
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
Lines 260-265 elsif ($op eq "set-branch-defaults") { Link Here
260
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
263
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
261
        }
264
        }
262
    }
265
    }
266
    Koha::CirculationRules->set_rule(
267
        {
268
            branchcode   => $branch,
269
            categorycode => '*',
270
            itemtype     => undef,
271
            rule_name    => 'max_holds',
272
            rule_value   => $max_holds,
273
        }
274
    );
263
}
275
}
264
elsif ($op eq "add-branch-cat") {
276
elsif ($op eq "add-branch-cat") {
265
    my $categorycode  = $input->param('categorycode');
277
    my $categorycode  = $input->param('categorycode');
Lines 312-318 elsif ($op eq "add-branch-cat") { Link Here
312
            my $sth_insert = $dbh->prepare(q|
324
            my $sth_insert = $dbh->prepare(q|
313
                INSERT INTO default_borrower_circ_rules
325
                INSERT INTO default_borrower_circ_rules
314
                    (categorycode, maxissueqty, maxonsiteissueqty)
326
                    (categorycode, maxissueqty, maxonsiteissueqty)
315
                    VALUES (?, ?, ?, ?)
327
                    VALUES (?, ?, ?)
316
            |);
328
            |);
317
            my $sth_update = $dbh->prepare(q|
329
            my $sth_update = $dbh->prepare(q|
318
                UPDATE default_borrower_circ_rules
330
                UPDATE default_borrower_circ_rules
Lines 330-336 elsif ($op eq "add-branch-cat") { Link Here
330
342
331
            Koha::CirculationRules->set_rule(
343
            Koha::CirculationRules->set_rule(
332
                {
344
                {
333
                    branchcode   => undef,
345
                    branchcode   => '*',
334
                    categorycode => $categorycode,
346
                    categorycode => $categorycode,
335
                    itemtype     => undef,
347
                    itemtype     => undef,
336
                    rule_name    => 'max_holds',
348
                    rule_name    => 'max_holds',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +5 lines)
Lines 452-457 $(document).ready(function() { Link Here
452
                    <th>&nbsp;</th>
452
                    <th>&nbsp;</th>
453
                    <th>Total current checkouts allowed</th>
453
                    <th>Total current checkouts allowed</th>
454
                    <th>Total current on-site checkouts allowed</th>
454
                    <th>Total current on-site checkouts allowed</th>
455
                    <th>Maximum total holds allowed (count)</th>
455
                    <th>Hold policy</th>
456
                    <th>Hold policy</th>
456
                    <th>Hold pickup library match</th>
457
                    <th>Hold pickup library match</th>
457
                    <th>Return policy</th>
458
                    <th>Return policy</th>
Lines 462-467 $(document).ready(function() { Link Here
462
                    <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
463
                    <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
463
                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
464
                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
464
                    <td>
465
                    <td>
466
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
467
                        <input name="max_holds" size="3" value="[% rule_value %]" />
468
                    </td>
469
                    <td>
465
                        <select name="holdallowed">
470
                        <select name="holdallowed">
466
                            [% IF ( default_holdallowed_any ) %]
471
                            [% IF ( default_holdallowed_any ) %]
467
                            <option value="2" selected="selected">
472
                            <option value="2" selected="selected">
468
- 

Return to bug 18887