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 (-1 / +13 lines)
Lines 218-229 elsif ($op eq "set-branch-defaults") { Link Here
218
    my $holdallowed   = $input->param('holdallowed');
218
    my $holdallowed   = $input->param('holdallowed');
219
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
219
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
220
    my $returnbranch  = $input->param('returnbranch');
220
    my $returnbranch  = $input->param('returnbranch');
221
    my $max_holds = $input->param('max_holds');
221
    $maxissueqty =~ s/\s//g;
222
    $maxissueqty =~ s/\s//g;
222
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
223
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
223
    $maxonsiteissueqty =~ s/\s//g;
224
    $maxonsiteissueqty =~ s/\s//g;
224
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
225
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
225
    $holdallowed =~ s/\s//g;
226
    $holdallowed =~ s/\s//g;
226
    $holdallowed = undef if $holdallowed !~ /^\d+/;
227
    $holdallowed = undef if $holdallowed !~ /^\d+/;
228
    $max_holds =~ s/\s//g;
229
    $max_holds = undef if $max_holds !~ /^\d+/;
227
230
228
    if ($branch eq "*") {
231
    if ($branch eq "*") {
229
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
232
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
Lines 259-264 elsif ($op eq "set-branch-defaults") { Link Here
259
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
262
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
260
        }
263
        }
261
    }
264
    }
265
    Koha::CirculationRules->set_rule(
266
        {
267
            branchcode   => $branch,
268
            categorycode => '*',
269
            itemtype     => undef,
270
            rule_name    => 'max_holds',
271
            rule_value   => $max_holds,
272
        }
273
    );
262
}
274
}
263
elsif ($op eq "add-branch-cat") {
275
elsif ($op eq "add-branch-cat") {
264
    my $categorycode  = $input->param('categorycode');
276
    my $categorycode  = $input->param('categorycode');
Lines 326-332 elsif ($op eq "add-branch-cat") { Link Here
326
338
327
            Koha::CirculationRules->set_rule(
339
            Koha::CirculationRules->set_rule(
328
                {
340
                {
329
                    branchcode   => undef,
341
                    branchcode   => '*',
330
                    categorycode => $categorycode,
342
                    categorycode => $categorycode,
331
                    itemtype     => undef,
343
                    itemtype     => undef,
332
                    rule_name    => 'max_holds',
344
                    rule_name    => 'max_holds',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +5 lines)
Lines 348-353 Link Here
348
                    <th>&nbsp;</th>
348
                    <th>&nbsp;</th>
349
                    <th>Total current checkouts allowed</th>
349
                    <th>Total current checkouts allowed</th>
350
                    <th>Total current on-site checkouts allowed</th>
350
                    <th>Total current on-site checkouts allowed</th>
351
                    <th>Maximum total holds allowed (count)</th>
351
                    <th>Hold policy</th>
352
                    <th>Hold policy</th>
352
                    <th>Hold pickup library match</th>
353
                    <th>Hold pickup library match</th>
353
                    <th>Return policy</th>
354
                    <th>Return policy</th>
Lines 357-362 Link Here
357
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
358
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
358
                    <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
359
                    <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
359
                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
360
                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
361
                    <td>
362
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
363
                        <input name="max_holds" size="3" value="[% rule_value %]" />
364
                    </td>
360
                    <td>
365
                    <td>
361
                        <select name="holdallowed">
366
                        <select name="holdallowed">
362
                            [% IF ( default_holdallowed_any ) %]
367
                            [% IF ( default_holdallowed_any ) %]
363
- 

Return to bug 18887