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

(-)a/C4/Circulation.pm (-4 / +54 lines)
Lines 461-466 sub TooMany { Link Here
461
        }
461
        }
462
    );
462
    );
463
463
464
    my $default_priority_no_branch_no_cat_patron_maxissueqty = Koha::CirculationRules->get_effective_rule(
465
        {
466
            rule_name    => 'patron_maxissueqty',
467
            has_priority => 1,
468
        }
469
    );
470
471
    my $default_priority_no_branch_patron_maxissueqty = Koha::CirculationRules->get_effective_rule(
472
        {
473
            categorycode => $cat_borrower,
474
            rule_name    => 'patron_maxissueqty',
475
            has_priority => 1,
476
        }
477
    );
478
479
    my $default_priority_patron_maxissueqty = $default_priority_no_branch_patron_maxissueqty->rule_value // $default_priority_no_branch_no_cat_patron_maxissueqty->rule_value;
480
481
    my $default_priority_no_branch_no_cat_patron_maxonsiteissueqty = Koha::CirculationRules->get_effective_rule(
482
        {
483
            rule_name    => 'patron_maxonsiteissueqty',
484
            has_priority => 1,
485
        }
486
    );
487
    my $default_priority_no_branch_patron_maxonsiteissueqty = Koha::CirculationRules->get_effective_rule(
488
        {
489
            categorycode => $cat_borrower,
490
            rule_name    => 'patron_maxonsiteissueqty',
491
            has_priority => 1,
492
        }
493
    );
494
495
    my $default_priority_patron_maxonsiteissueqty = $default_priority_no_branch_patron_maxonsiteissueqty->rule_value // $default_priority_no_branch_no_cat_patron_maxonsiteissueqty->rule_value;
496
464
    # if a rule is found and has a loan limit set, count
497
    # if a rule is found and has a loan limit set, count
465
    # how many loans the patron already has that meet that
498
    # how many loans the patron already has that meet that
466
    # rule
499
    # rule
Lines 534-545 sub TooMany { Link Here
534
        my $checkout_count = $sum_checkouts->{total} || 0;
567
        my $checkout_count = $sum_checkouts->{total} || 0;
535
        my $onsite_checkout_count = $sum_checkouts->{onsite_checkouts} || 0;
568
        my $onsite_checkout_count = $sum_checkouts->{onsite_checkouts} || 0;
536
569
570
        my $max_checkouts_allowed = $default_priority_patron_maxissueqty ? $default_priority_patron_maxissueqty : $maxissueqty_rule->rule_value;
571
        my $max_onsite_checkouts_allowed = $default_priority_patron_maxonsiteissueqty ? $default_priority_patron_maxonsiteissueqty : $maxonsiteissueqty_rule->rule_value;
572
537
        my $checkout_rules = {
573
        my $checkout_rules = {
538
            checkout_count               => $checkout_count,
574
            checkout_count               => $checkout_count,
539
            onsite_checkout_count        => $onsite_checkout_count,
575
            onsite_checkout_count        => $onsite_checkout_count,
540
            onsite_checkout              => $onsite_checkout,
576
            onsite_checkout              => $onsite_checkout,
541
            max_checkouts_allowed        => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef,
577
            max_checkouts_allowed        => $max_checkouts_allowed,
542
            max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef,
578
            max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed,
543
            switch_onsite_checkout       => $switch_onsite_checkout,
579
            switch_onsite_checkout       => $switch_onsite_checkout,
544
        };
580
        };
545
        # If parent rules exists
581
        # If parent rules exists
Lines 579-586 sub TooMany { Link Here
579
615
580
        my $checkout_count = $checkouts->count;
616
        my $checkout_count = $checkouts->count;
581
        my $onsite_checkout_count = $checkouts->search({ onsite_checkout => 1 })->count;
617
        my $onsite_checkout_count = $checkouts->search({ onsite_checkout => 1 })->count;
582
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
618
        my $max_checkouts_allowed = $default_priority_patron_maxissueqty ? $default_priority_patron_maxissueqty : $branch_borrower_circ_rule->{patron_maxissueqty};
583
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty} || undef;
619
        my $max_onsite_checkouts_allowed = $default_priority_patron_maxonsiteissueqty ? $default_priority_patron_maxonsiteissueqty : $branch_borrower_circ_rule->{patron_maxonsiteissueqty};
584
620
585
        my $qty_over = _check_max_qty(
621
        my $qty_over = _check_max_qty(
586
            {
622
            {
Lines 603-608 sub TooMany { Link Here
603
    return;
639
    return;
604
}
640
}
605
641
642
sub _get_has_priority_circulation_rule {
643
    my ($categorycode, $branchcode, $rule_name) = @_;
644
645
    return Koha::CirculationRules->get_effective_rule(
646
        {
647
            categorycode => $categorycode,
648
            itemtype     => undef,
649
            branchcode   => $branchcode,
650
            rule_name    => $rule_name,
651
            has_priority => 1,
652
        }
653
    );
654
}
655
606
sub _check_max_qty {
656
sub _check_max_qty {
607
    my $params                       = shift;
657
    my $params                       = shift;
608
    my $checkout_count               = $params->{checkout_count};
658
    my $checkout_count               = $params->{checkout_count};
(-)a/Koha/CirculationRules.pm (-8 / +25 lines)
Lines 216-221 our $RULE_KINDS = { Link Here
216
    holds_pickup_period => {
216
    holds_pickup_period => {
217
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
217
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
218
    },
218
    },
219
    has_priority => {
220
        scope => [ 'branchcode', 'categorycode' ],
221
    },
219
    # Not included (deprecated?):
222
    # Not included (deprecated?):
220
    #   * accountsent
223
    #   * accountsent
221
    #   * reservecharge
224
    #   * reservecharge
Lines 248-258 sub get_effective_rule { Link Here
248
    $params->{categorycode} //= undef;
251
    $params->{categorycode} //= undef;
249
    $params->{branchcode}   //= undef;
252
    $params->{branchcode}   //= undef;
250
    $params->{itemtype}     //= undef;
253
    $params->{itemtype}     //= undef;
254
    $params->{has_priority} //= undef;
251
255
252
    my $rule_name    = $params->{rule_name};
256
    my $rule_name    = $params->{rule_name};
253
    my $categorycode = $params->{categorycode};
257
    my $categorycode = $params->{categorycode};
254
    my $itemtype     = $params->{itemtype};
258
    my $itemtype     = $params->{itemtype};
255
    my $branchcode   = $params->{branchcode};
259
    my $branchcode   = $params->{branchcode};
260
    my $has_priority = $params->{has_priority};
256
261
257
    Koha::Exceptions::MissingParameter->throw(
262
    Koha::Exceptions::MissingParameter->throw(
258
        "Required parameter 'rule_name' missing")
263
        "Required parameter 'rule_name' missing")
Lines 271-276 sub get_effective_rule { Link Here
271
    $search_params->{categorycode} = defined $categorycode ? [ $categorycode, undef ] : undef;
276
    $search_params->{categorycode} = defined $categorycode ? [ $categorycode, undef ] : undef;
272
    $search_params->{itemtype}     = defined $itemtype     ? [ $itemtype, undef ] : undef;
277
    $search_params->{itemtype}     = defined $itemtype     ? [ $itemtype, undef ] : undef;
273
    $search_params->{branchcode}   = defined $branchcode   ? [ $branchcode,   undef ] : undef;
278
    $search_params->{branchcode}   = defined $branchcode   ? [ $branchcode,   undef ] : undef;
279
    $search_params->{has_priority} = defined $has_priority ? [ $has_priority, undef ] : undef;
274
280
275
    my $rule = $self->search(
281
    my $rule = $self->search(
276
        $search_params,
282
        $search_params,
Lines 308-317 sub get_effective_rule_value { Link Here
308
    my $categorycode = $params->{categorycode};
314
    my $categorycode = $params->{categorycode};
309
    my $itemtype     = $params->{itemtype};
315
    my $itemtype     = $params->{itemtype};
310
    my $branchcode   = $params->{branchcode};
316
    my $branchcode   = $params->{branchcode};
311
317
    my $has_priority = $params->{has_priority};
312
    my $memory_cache = Koha::Cache::Memory::Lite->get_instance;
318
    my $memory_cache = Koha::Cache::Memory::Lite->get_instance;
313
    my $cache_key = sprintf "CircRules:%s:%s:%s:%s", $rule_name // q{},
319
    my $cache_key = sprintf "CircRules:%s:%s:%s:%s", $rule_name // q{},
314
      $categorycode // q{}, $branchcode // q{}, $itemtype // q{};
320
      $categorycode // q{}, $branchcode // q{}, $itemtype // q{} ,$has_priority // q{};
315
321
316
    my $cached       = $memory_cache->get_from_cache($cache_key);
322
    my $cached       = $memory_cache->get_from_cache($cache_key);
317
    return $cached if $cached;
323
    return $cached if $cached;
Lines 334-339 sub get_effective_rules { Link Here
334
    my $categorycode = $params->{categorycode};
340
    my $categorycode = $params->{categorycode};
335
    my $itemtype     = $params->{itemtype};
341
    my $itemtype     = $params->{itemtype};
336
    my $branchcode   = $params->{branchcode};
342
    my $branchcode   = $params->{branchcode};
343
    my $has_priority = $params->{has_priority};
337
344
338
    my $r;
345
    my $r;
339
    foreach my $rule (@$rules) {
346
    foreach my $rule (@$rules) {
Lines 343-351 sub get_effective_rules { Link Here
343
                categorycode => $categorycode,
350
                categorycode => $categorycode,
344
                itemtype     => $itemtype,
351
                itemtype     => $itemtype,
345
                branchcode   => $branchcode,
352
                branchcode   => $branchcode,
353
                has_priority => $has_priority,
346
            }
354
            }
347
        );
355
        );
348
356
        
349
        $r->{$rule} = $effective_rule if defined $effective_rule;
357
        $r->{$rule} = $effective_rule if defined $effective_rule;
350
    }
358
    }
351
359
Lines 357-363 sub get_effective_rules { Link Here
357
=cut
365
=cut
358
366
359
sub set_rule {
367
sub set_rule {
360
    my ( $self, $params ) = @_;
368
    my ( $self, $params ) = @_;    
361
369
362
    for my $mandatory_parameter (qw( rule_name rule_value ) ) {
370
    for my $mandatory_parameter (qw( rule_name rule_value ) ) {
363
        Koha::Exceptions::MissingParameter->throw(
371
        Koha::Exceptions::MissingParameter->throw(
Lines 386-391 sub set_rule { Link Here
386
    my $itemtype     = $params->{itemtype};
394
    my $itemtype     = $params->{itemtype};
387
    my $rule_name    = $params->{rule_name};
395
    my $rule_name    = $params->{rule_name};
388
    my $rule_value   = $params->{rule_value};
396
    my $rule_value   = $params->{rule_value};
397
    my $has_priority = $params->{has_priority};
398
    
389
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
399
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
390
    $rule_value = undef if defined $rule_value && $rule_value eq "" && !$can_be_blank;
400
    $rule_value = undef if defined $rule_value && $rule_value eq "" && !$can_be_blank;
391
    my $is_monetary = defined $kind_info->{is_monetary} ? $kind_info->{is_monetary} : 0;
401
    my $is_monetary = defined $kind_info->{is_monetary} ? $kind_info->{is_monetary} : 0;
Lines 407-412 sub set_rule { Link Here
407
    if ($rule) {
417
    if ($rule) {
408
        if ( defined $rule_value ) {
418
        if ( defined $rule_value ) {
409
            $rule->rule_value($rule_value);
419
            $rule->rule_value($rule_value);
420
            $rule->has_priority($has_priority);
410
            $rule->update();
421
            $rule->update();
411
        }
422
        }
412
        else {
423
        else {
Lines 422-427 sub set_rule { Link Here
422
                    itemtype     => $itemtype,
433
                    itemtype     => $itemtype,
423
                    rule_name    => $rule_name,
434
                    rule_name    => $rule_name,
424
                    rule_value   => $rule_value,
435
                    rule_value   => $rule_value,
436
                    has_priority => $has_priority,
425
                }
437
                }
426
            );
438
            );
427
            $rule->store();
439
            $rule->store();
Lines 442-453 sub set_rule { Link Here
442
454
443
sub set_rules {
455
sub set_rules {
444
    my ( $self, $params ) = @_;
456
    my ( $self, $params ) = @_;
445
457
   
446
    my %set_params;
458
    my %set_params;
447
    $set_params{branchcode} = $params->{branchcode} if exists $params->{branchcode};
459
    $set_params{branchcode} = $params->{branchcode}
448
    $set_params{categorycode} = $params->{categorycode} if exists $params->{categorycode};
460
      if exists $params->{branchcode};
461
    $set_params{categorycode} = $params->{categorycode}
462
      if exists $params->{categorycode};
449
    $set_params{itemtype} = $params->{itemtype} if exists $params->{itemtype};
463
    $set_params{itemtype} = $params->{itemtype} if exists $params->{itemtype};
450
    my $rules        = $params->{rules};
464
    $set_params{has_priority} = $params->{has_priority}
465
      if exists $params->{has_priority};
466
    my $rules = $params->{rules};
467
451
468
452
    my $rule_objects = [];
469
    my $rule_objects = [];
453
    while ( my ( $rule_name, $rule_value ) = each %$rules ) {
470
    while ( my ( $rule_name, $rule_value ) = each %$rules ) {
(-)a/admin/smart-rules.pl (+11 lines)
Lines 362-373 elsif ($op eq "set-branch-defaults") { Link Here
362
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
362
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
363
    my $returnbranch  = $input->param('returnbranch');
363
    my $returnbranch  = $input->param('returnbranch');
364
    my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
364
    my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
365
    my $has_priority = $input->param('has_priority') ? 1 : 0;   
365
366
366
    if ($branch eq "*") {
367
    if ($branch eq "*") {
367
        Koha::CirculationRules->set_rules(
368
        Koha::CirculationRules->set_rules(
368
            {
369
            {
369
                itemtype     => undef,
370
                itemtype     => undef,
370
                branchcode   => undef,
371
                branchcode   => undef,
372
                has_priority => $has_priority,
371
                rules        => {
373
                rules        => {
372
                    holdallowed             => $holdallowed,
374
                    holdallowed             => $holdallowed,
373
                    hold_fulfillment_policy => $hold_fulfillment_policy,
375
                    hold_fulfillment_policy => $hold_fulfillment_policy,
Lines 379-384 elsif ($op eq "set-branch-defaults") { Link Here
379
            {
381
            {
380
                categorycode => undef,
382
                categorycode => undef,
381
                branchcode   => undef,
383
                branchcode   => undef,
384
                has_priority => $has_priority,
382
                rules        => {
385
                rules        => {
383
                    patron_maxissueqty             => $patron_maxissueqty,
386
                    patron_maxissueqty             => $patron_maxissueqty,
384
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
387
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
Lines 390-395 elsif ($op eq "set-branch-defaults") { Link Here
390
            {
393
            {
391
                itemtype     => undef,
394
                itemtype     => undef,
392
                branchcode   => $branch,
395
                branchcode   => $branch,
396
                has_priority => $has_priority,
393
                rules        => {
397
                rules        => {
394
                    holdallowed             => $holdallowed,
398
                    holdallowed             => $holdallowed,
395
                    hold_fulfillment_policy => $hold_fulfillment_policy,
399
                    hold_fulfillment_policy => $hold_fulfillment_policy,
Lines 401-406 elsif ($op eq "set-branch-defaults") { Link Here
401
            {
405
            {
402
                categorycode => undef,
406
                categorycode => undef,
403
                branchcode   => $branch,
407
                branchcode   => $branch,
408
                has_priority => $has_priority,
404
                rules        => {
409
                rules        => {
405
                    patron_maxissueqty             => $patron_maxissueqty,
410
                    patron_maxissueqty             => $patron_maxissueqty,
406
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
411
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
Lines 424-429 elsif ($op eq "add-branch-cat") { Link Here
424
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
429
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
425
    my $max_holds = $input->param('max_holds');
430
    my $max_holds = $input->param('max_holds');
426
    $max_holds = strip_non_numeric($max_holds);
431
    $max_holds = strip_non_numeric($max_holds);
432
    my $has_priority = $input->param('has_priority') ? 1 : 0;
427
433
428
    if ($branch eq "*") {
434
    if ($branch eq "*") {
429
        if ($categorycode eq "*") {
435
        if ($categorycode eq "*") {
Lines 431-436 elsif ($op eq "add-branch-cat") { Link Here
431
                {
437
                {
432
                    categorycode => undef,
438
                    categorycode => undef,
433
                    branchcode   => undef,
439
                    branchcode   => undef,
440
                    has_priority      => $has_priority,
434
                    rules        => {
441
                    rules        => {
435
                        max_holds         => $max_holds,
442
                        max_holds         => $max_holds,
436
                        patron_maxissueqty       => $patron_maxissueqty,
443
                        patron_maxissueqty       => $patron_maxissueqty,
Lines 439-448 elsif ($op eq "add-branch-cat") { Link Here
439
                }
446
                }
440
            );
447
            );
441
        } else {
448
        } else {
449
            
442
            Koha::CirculationRules->set_rules(
450
            Koha::CirculationRules->set_rules(
443
                {
451
                {
444
                    categorycode => $categorycode,
452
                    categorycode => $categorycode,
445
                    branchcode   => undef,
453
                    branchcode   => undef,
454
                    has_priority      => $has_priority,
446
                    rules        => {
455
                    rules        => {
447
                        max_holds         => $max_holds,
456
                        max_holds         => $max_holds,
448
                        patron_maxissueqty       => $patron_maxissueqty,
457
                        patron_maxissueqty       => $patron_maxissueqty,
Lines 456-461 elsif ($op eq "add-branch-cat") { Link Here
456
            {
465
            {
457
                categorycode => undef,
466
                categorycode => undef,
458
                branchcode   => $branch,
467
                branchcode   => $branch,
468
                has_priority      => $has_priority,
459
                rules        => {
469
                rules        => {
460
                    max_holds         => $max_holds,
470
                    max_holds         => $max_holds,
461
                    patron_maxissueqty       => $patron_maxissueqty,
471
                    patron_maxissueqty       => $patron_maxissueqty,
Lines 468-473 elsif ($op eq "add-branch-cat") { Link Here
468
            {
478
            {
469
                categorycode => $categorycode,
479
                categorycode => $categorycode,
470
                branchcode   => $branch,
480
                branchcode   => $branch,
481
                has_priority      => $has_priority,
471
                rules        => {
482
                rules        => {
472
                    max_holds         => $max_holds,
483
                    max_holds         => $max_holds,
473
                    patron_maxissueqty       => $patron_maxissueqty,
484
                    patron_maxissueqty       => $patron_maxissueqty,
(-)a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.pl (+13 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "BUG_8137",
5
    description => "Add column has_priority",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do('ALTER TABLE circulation_rules ADD IF NOT EXISTS has_priority INT(1) DEFAULT 0');
11
        say $out "Added column 'has_priority'";
12
    },
13
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-3 / +22 lines)
Lines 634-639 Link Here
634
                                <th>Hold policy</th>
634
                                <th>Hold policy</th>
635
                                <th>Hold pickup library match</th>
635
                                <th>Hold pickup library match</th>
636
                                <th>Return policy</th>
636
                                <th>Return policy</th>
637
                                <th class="hasPriority">Has priority</th>
637
                                <th class="noExport">Actions</th>
638
                                <th class="noExport">Actions</th>
638
                            </tr>
639
                            </tr>
639
                            [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
640
                            [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
Lines 643-648 Link Here
643
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
644
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
644
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
645
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
645
                            [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
646
                            [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
647
                            [% SET has_priority = patron_maxissueqty.has_priority || patron_maxonsiteissueqty.has_priority %]
646
                            <tr>
648
                            <tr>
647
                                <td>
649
                                <td>
648
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
650
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
Lines 796-801 Link Here
796
                                        </option>
798
                                        </option>
797
                                    </select>
799
                                    </select>
798
                                </td>
800
                                </td>
801
                                <td class="hasPriority">
802
                                    <input type="checkbox" name="has_priority" [% IF has_priority %]checked="checked"[% END %]/>
803
                                </td>
799
                                <td class="actions">
804
                                <td class="actions">
800
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
805
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
801
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
806
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
Lines 825-830 Link Here
825
                                <th>Total current checkouts allowed</th>
830
                                <th>Total current checkouts allowed</th>
826
                                <th>Total current on-site checkouts allowed</th>
831
                                <th>Total current on-site checkouts allowed</th>
827
                                <th>Total holds allowed</th>
832
                                <th>Total holds allowed</th>
833
                                <th class="hasPriority">Has priority</th>
828
                                <th>&nbsp;</th>
834
                                <th>&nbsp;</th>
829
                            </tr>
835
                            </tr>
830
                            [% FOREACH c IN categorycodes %]
836
                            [% FOREACH c IN categorycodes %]
Lines 832-838 Link Here
832
                                [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
838
                                [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
833
                                [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
839
                                [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
834
                                [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
840
                                [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
835
841
                                [% SET nobranch_patron_maxissueqty = CirculationRules.Search( undef, c, undef, 'patron_maxissueqty', {want_rule => 1} ) %]
842
                                [% SET nobranch_patron_maxonsiteissueqty = CirculationRules.Search( undef, c, undef, 'patron_maxonsiteissueqty', {want_rule => 1} ) %]
843
                                [% SET nobranch_max_holds = CirculationRules.Search( undef, c, undef, 'max_holds', {want_rule => 1} ) %]
844
                                [% SET has_priority = nobranch_patron_maxissueqty.has_priority || nobranch_patron_maxonsiteissueqty.has_priority %]                                
845
                                
836
                                [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
846
                                [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
837
                                <tr>
847
                                <tr>
838
                                    <td>
848
                                    <td>
Lines 863-869 Link Here
863
                                            <span>Unlimited</span>
873
                                            <span>Unlimited</span>
864
                                        [% END %]
874
                                        [% END %]
865
                                    </td>
875
                                    </td>
866
876
                                    <td class="hasPriority">
877
                                        <input type="checkbox" name="has_priority" [% IF has_priority %]checked="checked"[% END %] disabled/>
878
                                    </td>
867
                                    <td class="actions">
879
                                    <td class="actions">
868
                                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash-can"></i> Delete</a>
880
                                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash-can"></i> Delete</a>
869
                                    </td>
881
                                    </td>
Lines 881-886 Link Here
881
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
893
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
882
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
894
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
883
                                <td><input name="max_holds" size="3" type="text" /></td>
895
                                <td><input name="max_holds" size="3" type="text" /></td>
896
                                <td class="hasPriority">
897
                                    <input type="checkbox" name="has_priority" [% IF has_priority %]checked="checked"[% END %]/>
898
                                </td>
884
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
899
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
885
                            </tr>
900
                            </tr>
886
                        </table>
901
                        </table>
Lines 1582-1587 Link Here
1582
                }
1597
                }
1583
                return true;
1598
                return true;
1584
            });
1599
            });
1600
            if($("#branch").val() != '*') {
1601
                $(".hasPriority").each(function() {
1602
                    $(this).remove(); 
1603
                });
1604
            }
1585
        });
1605
        });
1586
    </script>
1606
    </script>
1587
[% END %]
1607
[% END %]
1588
- 

Return to bug 8137