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

(-)a/Koha/Template/Plugin/CirculationRules.pm (-2 / +2 lines)
Lines 43-49 sub Get { Link Here
43
}
43
}
44
44
45
sub Search {
45
sub Search {
46
    my ( $self, $branchcode, $categorycode, $itemtype, $rule_name ) = @_;
46
    my ( $self, $branchcode, $categorycode, $itemtype, $rule_name, $want_rule) = @_;
47
47
48
    $branchcode   = undef if $branchcode eq q{}   or $branchcode eq q{*};
48
    $branchcode   = undef if $branchcode eq q{}   or $branchcode eq q{*};
49
    $categorycode = undef if $categorycode eq q{} or $categorycode eq q{*};
49
    $categorycode = undef if $categorycode eq q{} or $categorycode eq q{*};
Lines 58-65 sub Search { Link Here
58
        }
58
        }
59
    )->next;
59
    )->next;
60
60
61
    return $rule if $want_rule;
61
    return $rule->rule_value if $rule;
62
    return $rule->rule_value if $rule;
62
}
63
}
63
64
64
65
1;
65
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-24 / +34 lines)
Lines 543-570 Link Here
543
                    <th>Return policy</th>
543
                    <th>Return policy</th>
544
                    <th class="noExport">Actions</th>
544
                    <th class="noExport">Actions</th>
545
                </tr>
545
                </tr>
546
                [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', 1, 1 ) %]
547
                [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty', 1, 1 ) %]
548
                [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', 1, 1 ) %]
549
                [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', 1 ) %]
550
                [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', 1 ) %]
551
                [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', 1 ) %]
552
                [% SET dcharp = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
546
                <tr>
553
                <tr>
547
                    <td><em>Defaults</em></td>
548
                    <td>
554
                    <td>
549
                        [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
555
                        [% IF ( dcharp ) %]
550
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
556
                            <em>
557
                            Defaults
558
                            </em>
559
                        [% ELSE %]
560
                            Not set
561
                        [% END %]
562
                    </td>
563
                    <td>
564
                        <input type="text" name="patron_maxissueqty" size="9" value="[% patron_maxissueqty.rule_value | html %]" placeholder="Unlimited"/>
551
                    </td>
565
                    </td>
552
                    <td>
566
                    <td>
553
                        [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
567
                        <input type="text" name="patron_maxonsiteissueqty" size="9" value="[% patron_maxonsiteissueqty.rule_value | html %]" placeholder="Unlimited"/>
554
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
555
                    </td>
568
                    </td>
556
                    <td>
569
                    <td>
557
                        [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
570
                        <input name="max_holds" size="9" value="[% rule_value.rule_value | html %]" placeholder="Unlimited"/>
558
                        <input name="max_holds" size="3" value="[% rule_value | html %]" />
559
                    </td>
571
                    </td>
560
                    <td>
572
                    <td>
561
                        <select name="holdallowed">
573
                        <select name="holdallowed">
562
                            [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
563
                            <option value="">
574
                            <option value="">
564
                                Not set
575
                                Not set
565
                            </option>
576
                            </option>
566
577
567
                            [% IF holdallowed == 'from_any_library' %]
578
                            [% IF holdallowed.rule_value == 'from_any_library' %]
568
                                <option value="from_any_library" selected="selected">
579
                                <option value="from_any_library" selected="selected">
569
                            [% ELSE %]
580
                            [% ELSE %]
570
                                <option value="from_any_library">
581
                                <option value="from_any_library">
Lines 572-578 Link Here
572
                                From any library
583
                                From any library
573
                            </option>
584
                            </option>
574
585
575
                            [% IF holdallowed == 'from_local_hold_group' %]
586
                            [% IF holdallowed.rule_value == 'from_local_hold_group' %]
576
                            <option value="from_local_hold_group" selected="selected">
587
                            <option value="from_local_hold_group" selected="selected">
577
                            [% ELSE %]
588
                            [% ELSE %]
578
                            <option value="from_local_hold_group">
589
                            <option value="from_local_hold_group">
Lines 580-586 Link Here
580
                                From local hold group
591
                                From local hold group
581
                            </option>
592
                            </option>
582
593
583
                            [% IF holdallowed == 'from_home_library' %]
594
                            [% IF holdallowed.rule_value == 'from_home_library' %]
584
                                <option value="from_home_library" selected="selected">
595
                                <option value="from_home_library" selected="selected">
585
                            [% ELSE %]
596
                            [% ELSE %]
586
                                <option value="from_home_library">
597
                                <option value="from_home_library">
Lines 588-594 Link Here
588
                                From home library
599
                                From home library
589
                            </option>
600
                            </option>
590
601
591
                            [% IF holdallowed == 'not_allowed' %]
602
                            [% IF holdallowed.rule_value == 'not_allowed' %]
592
                                <option value="not_allowed" selected="selected">
603
                                <option value="not_allowed" selected="selected">
593
                            [% ELSE %]
604
                            [% ELSE %]
594
                                <option value="not_allowed">
605
                                <option value="not_allowed">
Lines 599-611 Link Here
599
                    </td>
610
                    </td>
600
                    <td>
611
                    <td>
601
                        <select name="hold_fulfillment_policy">
612
                        <select name="hold_fulfillment_policy">
602
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
603
613
604
                            <option value="">
614
                            <option value="">
605
                                Not set
615
                                Not set
606
                            </option>
616
                            </option>
607
617
608
                            [% IF hold_fulfillment_policy == 'any' %]
618
                            [% IF hold_fulfillment_policy.rule_value == 'any' %]
609
                                <option value="any" selected="selected">
619
                                <option value="any" selected="selected">
610
                                    any library
620
                                    any library
611
                                </option>
621
                                </option>
Lines 615-621 Link Here
615
                                </option>
625
                                </option>
616
                            [% END %]
626
                            [% END %]
617
627
618
                            [% IF hold_fulfillment_policy == 'holdgroup' %]
628
                            [% IF hold_fulfillment_policy.rule_value == 'holdgroup' %]
619
                                <option value="holdgroup" selected="selected">
629
                                <option value="holdgroup" selected="selected">
620
                                    item's hold group
630
                                    item's hold group
621
                                </option>
631
                                </option>
Lines 625-631 Link Here
625
                                </option>
635
                                </option>
626
                            [% END %]
636
                            [% END %]
627
637
628
                            [% IF hold_fulfillment_policy == 'patrongroup' %]
638
                            [% IF hold_fulfillment_policy.rule_value == 'patrongroup' %]
629
                                <option value="patrongroup" selected="selected">
639
                                <option value="patrongroup" selected="selected">
630
                                    patron's hold group
640
                                    patron's hold group
631
                                </option>
641
                                </option>
Lines 635-641 Link Here
635
                                </option>
645
                                </option>
636
                            [% END %]
646
                            [% END %]
637
647
638
                            [% IF hold_fulfillment_policy == 'homebranch' %]
648
                            [% IF hold_fulfillment_policy.rule_value == 'homebranch' %]
639
                                <option value="homebranch" selected="selected">
649
                                <option value="homebranch" selected="selected">
640
                                    item's home library
650
                                    item's home library
641
                                </option>
651
                                </option>
Lines 645-651 Link Here
645
                                </option>
655
                                </option>
646
                            [% END %]
656
                            [% END %]
647
657
648
                            [% IF hold_fulfillment_policy == 'holdingbranch' %]
658
                            [% IF hold_fulfillment_policy.rule_value == 'holdingbranch' %]
649
                                <option value="holdingbranch" selected="selected">
659
                                <option value="holdingbranch" selected="selected">
650
                                    item's holding library
660
                                    item's holding library
651
                                </option>
661
                                </option>
Lines 658-684 Link Here
658
                    </td>
668
                    </td>
659
                    <td>
669
                    <td>
660
                        <select name="returnbranch">
670
                        <select name="returnbranch">
661
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
662
671
663
                            <option value="">
672
                            <option value="">
664
                                Not set
673
                                Not set
665
                            </option>
674
                            </option>
666
675
667
                            [% IF returnbranch == 'homebranch' %]
676
                            [% IF returnbranch.rule_value == 'homebranch' %]
668
                            <option value="homebranch" selected="selected">
677
                            <option value="homebranch" selected="selected">
669
                            [% ELSE %]
678
                            [% ELSE %]
670
                            <option value="homebranch">
679
                            <option value="homebranch">
671
                            [% END %]
680
                            [% END %]
672
                                Item returns home
681
                                Item returns home
673
                            </option>
682
                            </option>
674
                            [% IF returnbranch == 'holdingbranch' %]
683
                            [% IF returnbranch.rule_value == 'holdingbranch' %]
675
                            <option value="holdingbranch" selected="selected">
684
                            <option value="holdingbranch" selected="selected">
676
                            [% ELSE %]
685
                            [% ELSE %]
677
                            <option value="holdingbranch">
686
                            <option value="holdingbranch">
678
                            [% END %]
687
                            [% END %]
679
                                Item returns to issuing library
688
                                Item returns to issuing library
680
                            </option>
689
                            </option>
681
                            [% IF returnbranch == 'noreturn' %]
690
                            [% IF returnbranch.rule_value == 'noreturn' %]
682
                            <option value="noreturn" selected="selected">
691
                            <option value="noreturn" selected="selected">
683
                            [% ELSE %]
692
                            [% ELSE %]
684
                            <option value="noreturn">
693
                            <option value="noreturn">
Lines 689-695 Link Here
689
                    </td>
698
                    </td>
690
                    <td class="actions">
699
                    <td class="actions">
691
                        <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
700
                        <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
692
                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
701
                        [% IF (dcharp) %]
702
                            <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
703
                        [% END %]
693
                    </td>
704
                    </td>
694
                </tr>
705
                </tr>
695
            </table>
706
            </table>
696
- 

Return to bug 24154