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 224-235 elsif ($op eq "set-branch-defaults") { Link Here
224
    my $holdallowed   = $input->param('holdallowed');
224
    my $holdallowed   = $input->param('holdallowed');
225
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
225
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
226
    my $returnbranch  = $input->param('returnbranch');
226
    my $returnbranch  = $input->param('returnbranch');
227
    my $max_holds = $input->param('max_holds');
227
    $maxissueqty =~ s/\s//g;
228
    $maxissueqty =~ s/\s//g;
228
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
229
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
229
    $maxonsiteissueqty =~ s/\s//g;
230
    $maxonsiteissueqty =~ s/\s//g;
230
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
231
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
231
    $holdallowed =~ s/\s//g;
232
    $holdallowed =~ s/\s//g;
232
    $holdallowed = undef if $holdallowed !~ /^\d+/;
233
    $holdallowed = undef if $holdallowed !~ /^\d+/;
234
    $max_holds =~ s/\s//g;
235
    $max_holds = undef if $max_holds !~ /^\d+/;
233
236
234
    if ($branch eq "*") {
237
    if ($branch eq "*") {
235
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
238
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
Lines 265-270 elsif ($op eq "set-branch-defaults") { Link Here
265
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
268
            $sth_insert->execute($branch, $maxissueqty, $maxonsiteissueqty, $holdallowed, $hold_fulfillment_policy, $returnbranch);
266
        }
269
        }
267
    }
270
    }
271
    Koha::CirculationRules->set_rule(
272
        {
273
            branchcode   => $branch,
274
            categorycode => '*',
275
            itemtype     => undef,
276
            rule_name    => 'max_holds',
277
            rule_value   => $max_holds,
278
        }
279
    );
268
}
280
}
269
elsif ($op eq "add-branch-cat") {
281
elsif ($op eq "add-branch-cat") {
270
    my $categorycode  = $input->param('categorycode');
282
    my $categorycode  = $input->param('categorycode');
Lines 337-343 elsif ($op eq "add-branch-cat") { Link Here
337
349
338
            Koha::CirculationRules->set_rule(
350
            Koha::CirculationRules->set_rule(
339
                {
351
                {
340
                    branchcode   => undef,
352
                    branchcode   => '*',
341
                    categorycode => $categorycode,
353
                    categorycode => $categorycode,
342
                    itemtype     => undef,
354
                    itemtype     => undef,
343
                    rule_name    => 'max_holds',
355
                    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