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 220-231 elsif ($op eq "set-branch-defaults") { Link Here
220
    my $holdallowed   = $input->param('holdallowed');
220
    my $holdallowed   = $input->param('holdallowed');
221
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
221
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
222
    my $returnbranch  = $input->param('returnbranch');
222
    my $returnbranch  = $input->param('returnbranch');
223
    my $max_holds = $input->param('max_holds');
223
    $maxissueqty =~ s/\s//g;
224
    $maxissueqty =~ s/\s//g;
224
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
225
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
225
    $maxonsiteissueqty =~ s/\s//g;
226
    $maxonsiteissueqty =~ s/\s//g;
226
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
227
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
227
    $holdallowed =~ s/\s//g;
228
    $holdallowed =~ s/\s//g;
228
    $holdallowed = undef if $holdallowed !~ /^\d+/;
229
    $holdallowed = undef if $holdallowed !~ /^\d+/;
230
    $max_holds =~ s/\s//g;
231
    $max_holds = undef if $max_holds !~ /^\d+/;
229
232
230
    if ($branch eq "*") {
233
    if ($branch eq "*") {
231
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
234
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
Lines 261-266 elsif ($op eq "set-branch-defaults") { Link Here
261
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
264
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
262
        }
265
        }
263
    }
266
    }
267
    Koha::CirculationRules->set_rule(
268
        {
269
            branchcode   => $branch,
270
            categorycode => '*',
271
            itemtype     => undef,
272
            rule_name    => 'max_holds',
273
            rule_value   => $max_holds,
274
        }
275
    );
264
}
276
}
265
elsif ($op eq "add-branch-cat") {
277
elsif ($op eq "add-branch-cat") {
266
    my $categorycode  = $input->param('categorycode');
278
    my $categorycode  = $input->param('categorycode');
Lines 333-339 elsif ($op eq "add-branch-cat") { Link Here
333
345
334
            Koha::CirculationRules->set_rule(
346
            Koha::CirculationRules->set_rule(
335
                {
347
                {
336
                    branchcode   => undef,
348
                    branchcode   => '*',
337
                    categorycode => $categorycode,
349
                    categorycode => $categorycode,
338
                    itemtype     => undef,
350
                    itemtype     => undef,
339
                    rule_name    => 'max_holds',
351
                    rule_name    => 'max_holds',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +5 lines)
Lines 369-374 Link Here
369
                    <th>&nbsp;</th>
369
                    <th>&nbsp;</th>
370
                    <th>Total current checkouts allowed</th>
370
                    <th>Total current checkouts allowed</th>
371
                    <th>Total current on-site checkouts allowed</th>
371
                    <th>Total current on-site checkouts allowed</th>
372
                    <th>Maximum total holds allowed (count)</th>
372
                    <th>Hold policy</th>
373
                    <th>Hold policy</th>
373
                    <th>Hold pickup library match</th>
374
                    <th>Hold pickup library match</th>
374
                    <th>Return policy</th>
375
                    <th>Return policy</th>
Lines 379-384 Link Here
379
                    <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty | html %]"/></td>
380
                    <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty | html %]"/></td>
380
                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty | html %]"/></td>
381
                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty | html %]"/></td>
381
                    <td>
382
                    <td>
383
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
384
                        <input name="max_holds" size="3" value="[% rule_value %]" />
385
                    </td>
386
                    <td>
382
                        <select name="holdallowed">
387
                        <select name="holdallowed">
383
                            [% IF ( default_holdallowed_any ) %]
388
                            [% IF ( default_holdallowed_any ) %]
384
                            <option value="2" selected="selected">
389
                            <option value="2" selected="selected">
385
- 

Return to bug 18887