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

(-)a/installer/onboarding.pl (+2 lines)
Lines 241-246 if ( $step == 5 ) { Link Here
241
        my $branchcode      = $input->param('branch');
241
        my $branchcode      = $input->param('branch');
242
        my $categorycode    = $input->param('categorycode');
242
        my $categorycode    = $input->param('categorycode');
243
        my $itemtype        = $input->param('itemtype');
243
        my $itemtype        = $input->param('itemtype');
244
        my $onsite_checkout   = $input->param('onsite_checkout');
244
        my $maxissueqty     = $input->param('maxissueqty');
245
        my $maxissueqty     = $input->param('maxissueqty');
245
        my $issuelength     = $input->param('issuelength');
246
        my $issuelength     = $input->param('issuelength');
246
        my $lengthunit      = $input->param('lengthunit');
247
        my $lengthunit      = $input->param('lengthunit');
Lines 258-263 if ( $step == 5 ) { Link Here
258
            branchcode      => $branchcode,
259
            branchcode      => $branchcode,
259
            categorycode    => $categorycode,
260
            categorycode    => $categorycode,
260
            itemtype        => $itemtype,
261
            itemtype        => $itemtype,
262
            onsite_checkout   => $onsite_checkout,
261
            rules => {
263
            rules => {
262
                renewalsallowed                  => $renewalsallowed,
264
                renewalsallowed                  => $renewalsallowed,
263
                renewalperiod                    => $renewalperiod,
265
                renewalperiod                    => $renewalperiod,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (+10 lines)
Lines 67-72 Link Here
67
                                    </select>
67
                                    </select>
68
                                    <span class="required"> Required</span>
68
                                    <span class="required"> Required</span>
69
                                </li>
69
                                </li>
70
                                <li>
71
                                    <label for="itemtype"> Checkout type: </label>
72
                                    <select id="onsite_checkout" name="onsite_checkout" required="required">
73
                                        <option value=""> Choose </option>
74
                                        <option value="*" selected="selected">All</option>
75
                                        <option value="CHECKOUT">Normal checkout</option>
76
                                        <option value="ONSITE">On-site checkout</option>
77
                                    </select>
78
                                    <span class="required"> Required</span>
79
                                </li>
70
                                <li>
80
                                <li>
71
                                    <label for="maxissueqty" class="required">Current checkouts allowed: </label>
81
                                    <label for="maxissueqty" class="required">Current checkouts allowed: </label>
72
                                    <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" />
82
                                    <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" />
(-)a/t/db_dependent/Circulation.t (-1 / +65 lines)
Lines 264-269 Koha::CirculationRules->set_rules( Link Here
264
        itemtype     => undef,
264
        itemtype     => undef,
265
        rules        => {
265
        rules        => {
266
            reservesallowed => 25,
266
            reservesallowed => 25,
267
        }
268
    }
269
);
270
271
Koha::CirculationRules->set_rules(
272
    {
273
        categorycode => undef,
274
        branchcode   => undef,
275
        itemtype     => undef,
276
        onsite_checkout => undef,
277
        rules        => {
267
            issuelength     => 14,
278
            issuelength     => 14,
268
            lengthunit      => 'days',
279
            lengthunit      => 'days',
269
            renewalsallowed => 1,
280
            renewalsallowed => 1,
Lines 772-777 subtest "CanBookBeRenewed tests" => sub { Link Here
772
                categorycode => undef,
783
                categorycode => undef,
773
                branchcode   => undef,
784
                branchcode   => undef,
774
                itemtype     => undef,
785
                itemtype     => undef,
786
                onsite_checkout => undef,
775
                rules        => {
787
                rules        => {
776
                    norenewalbefore       => '7',
788
                    norenewalbefore       => '7',
777
                    no_auto_renewal_after => '9',
789
                    no_auto_renewal_after => '9',
Lines 788-793 subtest "CanBookBeRenewed tests" => sub { Link Here
788
                categorycode => undef,
800
                categorycode => undef,
789
                branchcode   => undef,
801
                branchcode   => undef,
790
                itemtype     => undef,
802
                itemtype     => undef,
803
                onsite_checkout => undef,
791
                rules        => {
804
                rules        => {
792
                    norenewalbefore       => '7',
805
                    norenewalbefore       => '7',
793
                    no_auto_renewal_after => '10',
806
                    no_auto_renewal_after => '10',
Lines 804-809 subtest "CanBookBeRenewed tests" => sub { Link Here
804
                categorycode => undef,
817
                categorycode => undef,
805
                branchcode   => undef,
818
                branchcode   => undef,
806
                itemtype     => undef,
819
                itemtype     => undef,
820
                onsite_checkout => undef,
807
                rules        => {
821
                rules        => {
808
                    norenewalbefore       => '7',
822
                    norenewalbefore       => '7',
809
                    no_auto_renewal_after => '11',
823
                    no_auto_renewal_after => '11',
Lines 820-825 subtest "CanBookBeRenewed tests" => sub { Link Here
820
                categorycode => undef,
834
                categorycode => undef,
821
                branchcode   => undef,
835
                branchcode   => undef,
822
                itemtype     => undef,
836
                itemtype     => undef,
837
                onsite_checkout => undef,
823
                rules        => {
838
                rules        => {
824
                    norenewalbefore       => '10',
839
                    norenewalbefore       => '10',
825
                    no_auto_renewal_after => '11',
840
                    no_auto_renewal_after => '11',
Lines 836-841 subtest "CanBookBeRenewed tests" => sub { Link Here
836
                categorycode => undef,
851
                categorycode => undef,
837
                branchcode   => undef,
852
                branchcode   => undef,
838
                itemtype     => undef,
853
                itemtype     => undef,
854
                onsite_checkout => undef,
839
                rules        => {
855
                rules        => {
840
                    norenewalbefore       => '10',
856
                    norenewalbefore       => '10',
841
                    no_auto_renewal_after => undef,
857
                    no_auto_renewal_after => undef,
Lines 853-858 subtest "CanBookBeRenewed tests" => sub { Link Here
853
                categorycode => undef,
869
                categorycode => undef,
854
                branchcode   => undef,
870
                branchcode   => undef,
855
                itemtype     => undef,
871
                itemtype     => undef,
872
                onsite_checkout => undef,
856
                rules        => {
873
                rules        => {
857
                    norenewalbefore       => '7',
874
                    norenewalbefore       => '7',
858
                    no_auto_renewal_after => '15',
875
                    no_auto_renewal_after => '15',
Lines 870-875 subtest "CanBookBeRenewed tests" => sub { Link Here
870
                categorycode => undef,
887
                categorycode => undef,
871
                branchcode   => undef,
888
                branchcode   => undef,
872
                itemtype     => undef,
889
                itemtype     => undef,
890
                onsite_checkout => undef,
873
                rules        => {
891
                rules        => {
874
                    norenewalbefore       => '10',
892
                    norenewalbefore       => '10',
875
                    no_auto_renewal_after => undef,
893
                    no_auto_renewal_after => undef,
Lines 901-906 subtest "CanBookBeRenewed tests" => sub { Link Here
901
                categorycode => undef,
919
                categorycode => undef,
902
                branchcode   => undef,
920
                branchcode   => undef,
903
                itemtype     => undef,
921
                itemtype     => undef,
922
                onsite_checkout => undef,
904
                rules        => {
923
                rules        => {
905
                    norenewalbefore       => '10',
924
                    norenewalbefore       => '10',
906
                    no_auto_renewal_after => '11',
925
                    no_auto_renewal_after => '11',
Lines 991-996 subtest "CanBookBeRenewed tests" => sub { Link Here
991
                categorycode => undef,
1010
                categorycode => undef,
992
                branchcode   => undef,
1011
                branchcode   => undef,
993
                itemtype     => undef,
1012
                itemtype     => undef,
1013
                onsite_checkout => undef,
994
                rules        => {
1014
                rules        => {
995
                    norenewalbefore       => 10,
1015
                    norenewalbefore       => 10,
996
                    no_auto_renewal_after => 11,
1016
                    no_auto_renewal_after => 11,
Lines 1054-1059 subtest "CanBookBeRenewed tests" => sub { Link Here
1054
                categorycode => undef,
1074
                categorycode => undef,
1055
                branchcode   => undef,
1075
                branchcode   => undef,
1056
                itemtype     => undef,
1076
                itemtype     => undef,
1077
                onsite_checkout => undef,
1057
                rules        => {
1078
                rules        => {
1058
                    norenewalbefore       => '7',
1079
                    norenewalbefore       => '7',
1059
                    no_auto_renewal_after => '',
1080
                    no_auto_renewal_after => '',
Lines 1069-1074 subtest "CanBookBeRenewed tests" => sub { Link Here
1069
                categorycode => undef,
1090
                categorycode => undef,
1070
                branchcode   => undef,
1091
                branchcode   => undef,
1071
                itemtype     => undef,
1092
                itemtype     => undef,
1093
                onsite_checkout => undef,
1072
                rules        => {
1094
                rules        => {
1073
                    norenewalbefore       => '10',
1095
                    norenewalbefore       => '10',
1074
                    no_auto_renewal_after => '5',
1096
                    no_auto_renewal_after => '5',
Lines 1090-1095 subtest "CanBookBeRenewed tests" => sub { Link Here
1090
                categorycode => undef,
1112
                categorycode => undef,
1091
                branchcode   => undef,
1113
                branchcode   => undef,
1092
                itemtype     => undef,
1114
                itemtype     => undef,
1115
                onsite_checkout => undef,
1093
                rules        => {
1116
                rules        => {
1094
                    norenewalbefore       => '10',
1117
                    norenewalbefore       => '10',
1095
                    no_auto_renewal_after => '15',
1118
                    no_auto_renewal_after => '15',
Lines 1108-1113 subtest "CanBookBeRenewed tests" => sub { Link Here
1108
                categorycode => undef,
1131
                categorycode => undef,
1109
                branchcode   => undef,
1132
                branchcode   => undef,
1110
                itemtype     => undef,
1133
                itemtype     => undef,
1134
                onsite_checkout => undef,
1111
                rules        => {
1135
                rules        => {
1112
                    norenewalbefore       => '10',
1136
                    norenewalbefore       => '10',
1113
                    no_auto_renewal_after => '',
1137
                    no_auto_renewal_after => '',
Lines 1125-1130 subtest "CanBookBeRenewed tests" => sub { Link Here
1125
                categorycode => undef,
1149
                categorycode => undef,
1126
                branchcode   => undef,
1150
                branchcode   => undef,
1127
                itemtype     => undef,
1151
                itemtype     => undef,
1152
                onsite_checkout => undef,
1128
                rules        => {
1153
                rules        => {
1129
                    norenewalbefore       => '10',
1154
                    norenewalbefore       => '10',
1130
                    no_auto_renewal_after => '15',
1155
                    no_auto_renewal_after => '15',
Lines 1147-1152 subtest "CanBookBeRenewed tests" => sub { Link Here
1147
            categorycode => undef,
1172
            categorycode => undef,
1148
            branchcode   => undef,
1173
            branchcode   => undef,
1149
            itemtype     => undef,
1174
            itemtype     => undef,
1175
            onsite_checkout => undef,
1150
            rules        => {
1176
            rules        => {
1151
                norenewalbefore => undef,
1177
                norenewalbefore => undef,
1152
                renewalsallowed => 0,
1178
                renewalsallowed => 0,
Lines 1395-1400 subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { Link Here
1395
            branchcode   => undef,
1421
            branchcode   => undef,
1396
            rules        => {
1422
            rules        => {
1397
                reservesallowed => 25,
1423
                reservesallowed => 25,
1424
            }
1425
        }
1426
    );
1427
    Koha::CirculationRules->set_rules(
1428
        {
1429
            categorycode => undef,
1430
            itemtype     => undef,
1431
            branchcode   => undef,
1432
            onsite_checkout => undef,
1433
            rules        => {
1398
                issuelength     => 14,
1434
                issuelength     => 14,
1399
                lengthunit      => 'days',
1435
                lengthunit      => 'days',
1400
                renewalsallowed => 1,
1436
                renewalsallowed => 1,
Lines 2022-2027 subtest 'AddReturn + CumulativeRestrictionPeriods' => sub { Link Here
2022
            categorycode => undef,
2058
            categorycode => undef,
2023
            itemtype     => undef,
2059
            itemtype     => undef,
2024
            branchcode   => undef,
2060
            branchcode   => undef,
2061
            onsite_checkout => undef,
2025
            rules        => {
2062
            rules        => {
2026
                issuelength => 1,
2063
                issuelength => 1,
2027
                firstremind => 1,        # 1 day of grace
2064
                firstremind => 1,        # 1 day of grace
Lines 2128-2133 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2128
            categorycode => '*',
2165
            categorycode => '*',
2129
            itemtype     => '*',
2166
            itemtype     => '*',
2130
            branchcode   => '*',
2167
            branchcode   => '*',
2168
            onsite_checkout => '*',
2131
            rules        => {
2169
            rules        => {
2132
                issuelength => 1,
2170
                issuelength => 1,
2133
                firstremind => 0,    # 0 day of grace
2171
                firstremind => 0,    # 0 day of grace
Lines 2184-2189 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2184
            categorycode => undef,
2222
            categorycode => undef,
2185
            branchcode   => undef,
2223
            branchcode   => undef,
2186
            itemtype     => undef,
2224
            itemtype     => undef,
2225
            onsite_checkout => undef,
2187
            rules        => {
2226
            rules        => {
2188
                suspension_chargeperiod => 3,
2227
                suspension_chargeperiod => 3,
2189
                firstremind             => 1,
2228
                firstremind             => 1,
Lines 2208-2213 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2208
            categorycode => undef,
2247
            categorycode => undef,
2209
            branchcode   => undef,
2248
            branchcode   => undef,
2210
            itemtype     => undef,
2249
            itemtype     => undef,
2250
            onsite_checkout => undef,
2211
            rules        => {
2251
            rules        => {
2212
                finedays                => 2,
2252
                finedays                => 2,
2213
                suspension_chargeperiod => 1,
2253
                suspension_chargeperiod => 1,
Lines 2377-2382 subtest 'AddReturn | is_overdue' => sub { Link Here
2377
            categorycode => undef,
2417
            categorycode => undef,
2378
            itemtype     => undef,
2418
            itemtype     => undef,
2379
            branchcode   => undef,
2419
            branchcode   => undef,
2420
            onsite_checkout => undef,
2380
            rules        => {
2421
            rules        => {
2381
                issuelength  => 6,
2422
                issuelength  => 6,
2382
                lengthunit   => 'days',
2423
                lengthunit   => 'days',
Lines 2872-2879 subtest 'CanBookBeIssued | is_overdue' => sub { Link Here
2872
            branchcode   => undef,
2913
            branchcode   => undef,
2873
            itemtype     => undef,
2914
            itemtype     => undef,
2874
            rules        => {
2915
            rules        => {
2875
                maxissueqty     => 1,
2876
                reservesallowed => 25,
2916
                reservesallowed => 25,
2917
            }
2918
        }
2919
    );
2920
2921
    Koha::CirculationRules->set_rules(
2922
        {
2923
            categorycode => undef,
2924
            branchcode   => undef,
2925
            itemtype     => undef,
2926
            onsite_checkout => undef,
2927
            rules        => {
2928
                maxissueqty     => 1,
2877
                issuelength     => 14,
2929
                issuelength     => 14,
2878
                lengthunit      => 'days',
2930
                lengthunit      => 'days',
2879
                renewalsallowed => 1,
2931
                renewalsallowed => 1,
Lines 2919-2924 subtest 'ItemsDeniedRenewal preference' => sub { Link Here
2919
            branchcode   => $idr_lib->branchcode,
2971
            branchcode   => $idr_lib->branchcode,
2920
            rules        => {
2972
            rules        => {
2921
                reservesallowed => 25,
2973
                reservesallowed => 25,
2974
            }
2975
        }
2976
    );
2977
    Koha::CirculationRules->set_rules(
2978
        {
2979
            categorycode => '*',
2980
            itemtype     => '*',
2981
            branchcode   => $idr_lib->branchcode,
2982
            onsite_checkout => '*',
2983
            rules        => {
2922
                issuelength     => 14,
2984
                issuelength     => 14,
2923
                lengthunit      => 'days',
2985
                lengthunit      => 'days',
2924
                renewalsallowed => 10,
2986
                renewalsallowed => 10,
Lines 3678-3683 subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddReturn' => sub { Link Here
3678
            categorycode => undef,
3740
            categorycode => undef,
3679
            itemtype     => undef,
3741
            itemtype     => undef,
3680
            branchcode   => undef,
3742
            branchcode   => undef,
3743
            onsite_checkout => undef,
3681
            rules        => {
3744
            rules        => {
3682
                issuelength => 14,
3745
                issuelength => 14,
3683
                lengthunit  => 'days',
3746
                lengthunit  => 'days',
Lines 3871-3876 subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddIssue' => sub { Link Here
3871
            categorycode => undef,
3934
            categorycode => undef,
3872
            itemtype     => undef,
3935
            itemtype     => undef,
3873
            branchcode   => undef,
3936
            branchcode   => undef,
3937
            onsite_checkout => undef,
3874
            rules        => {
3938
            rules        => {
3875
                issuelength => 14,
3939
                issuelength => 14,
3876
                lengthunit  => 'days',
3940
                lengthunit  => 'days',
(-)a/t/db_dependent/Circulation/CalcDateDue.t (+4 lines)
Lines 10-15 use t::lib::Mocks; Link Here
10
use t::lib::TestBuilder;
10
use t::lib::TestBuilder;
11
use C4::Calendar;
11
use C4::Calendar;
12
12
13
use Koha::Checkouts;
13
use Koha::CirculationRules;
14
use Koha::CirculationRules;
14
15
15
use_ok('C4::Circulation');
16
use_ok('C4::Circulation');
Lines 21-26 my $builder = t::lib::TestBuilder->new; Link Here
21
my $categorycode = 'B';
22
my $categorycode = 'B';
22
my $itemtype = 'MX';
23
my $itemtype = 'MX';
23
my $branchcode = 'FPL';
24
my $branchcode = 'FPL';
25
my $onsite_checkout = 0;
24
my $issuelength = 10;
26
my $issuelength = 10;
25
my $renewalperiod = 5;
27
my $renewalperiod = 5;
26
my $lengthunit = 'days';
28
my $lengthunit = 'days';
Lines 31-36 Koha::CirculationRules->set_rules( Link Here
31
        categorycode => $categorycode,
33
        categorycode => $categorycode,
32
        itemtype     => $itemtype,
34
        itemtype     => $itemtype,
33
        branchcode   => $branchcode,
35
        branchcode   => $branchcode,
36
        onsite_checkout => $onsite_checkout,
34
        rules        => {
37
        rules        => {
35
            issuelength   => $issuelength,
38
            issuelength   => $issuelength,
36
            renewalperiod => $renewalperiod,
39
            renewalperiod => $renewalperiod,
Lines 170-175 Koha::CirculationRules->set_rules( Link Here
170
        categorycode => $dayweek_categorycode,
173
        categorycode => $dayweek_categorycode,
171
        itemtype     => $dayweek_itemtype,
174
        itemtype     => $dayweek_itemtype,
172
        branchcode   => $dayweek_branchcode,
175
        branchcode   => $dayweek_branchcode,
176
        onsite_checkout => $onsite_checkout,
173
        rules        => {
177
        rules        => {
174
            issuelength   => $dayweek_issuelength,
178
            issuelength   => $dayweek_issuelength,
175
            renewalperiod => $dayweek_renewalperiod,
179
            renewalperiod => $dayweek_renewalperiod,
(-)a/t/db_dependent/Circulation/GetHardDueDate.t (-9 / +34 lines)
Lines 5-10 use C4::Context; Link Here
5
use DateTime;
5
use DateTime;
6
use Koha::Database;
6
use Koha::Database;
7
use Koha::DateUtils;
7
use Koha::DateUtils;
8
use Koha::Checkouts;
8
use Koha::CirculationRules;
9
use Koha::CirculationRules;
9
use Koha::Library;
10
use Koha::Library;
10
11
Lines 120-125 my $sampleissuingrule1 = { Link Here
120
    branchcode   => $samplebranch1->{branchcode},
121
    branchcode   => $samplebranch1->{branchcode},
121
    categorycode => $samplecat->{categorycode},
122
    categorycode => $samplecat->{categorycode},
122
    itemtype     => $sampleitemtype1,
123
    itemtype     => $sampleitemtype1,
124
    onsite_checkout => 0,
123
    rules        => {
125
    rules        => {
124
        finedays                         => 0,
126
        finedays                         => 0,
125
        lengthunit                       => 'days',
127
        lengthunit                       => 'days',
Lines 130-136 my $sampleissuingrule1 = { Link Here
130
        chargeperiod                     => 0,
132
        chargeperiod                     => 0,
131
        chargeperiod_charge_at           => 0,
133
        chargeperiod_charge_at           => 0,
132
        rentaldiscount                   => 2,
134
        rentaldiscount                   => 2,
133
        reservesallowed                  => 0,
134
        hardduedate                      => '2013-01-01',
135
        hardduedate                      => '2013-01-01',
135
        fine                             => 0,
136
        fine                             => 0,
136
        hardduedatecompare               => 5,
137
        hardduedatecompare               => 5,
Lines 138-151 my $sampleissuingrule1 = { Link Here
138
        renewalsallowed                  => 0,
139
        renewalsallowed                  => 0,
139
        firstremind                      => 0,
140
        firstremind                      => 0,
140
        maxsuspensiondays                => 0,
141
        maxsuspensiondays                => 0,
141
        onshelfholds                     => 0,
142
        opacitemholds                    => 'N',
143
        cap_fine_to_replacement_price    => 0,
142
        cap_fine_to_replacement_price    => 0,
144
        holds_per_record                 => 1,
145
        article_requests                 => 'yes',
146
        no_auto_renewal_after            => undef,
143
        no_auto_renewal_after            => undef,
147
        no_auto_renewal_after_hard_limit => undef,
144
        no_auto_renewal_after_hard_limit => undef,
148
        suspension_chargeperiod          => 1,
145
        suspension_chargeperiod          => 1,
146
    }
147
};
148
my $sampleissuingrule1_holds = {
149
    branchcode   => $samplebranch1->{branchcode},
150
    categorycode => $samplecat->{categorycode},
151
    itemtype     => $sampleitemtype1,
152
    rules        => {
153
        onshelfholds                     => 0,
154
        opacitemholds                    => 'N',
155
        holds_per_record                 => 1,
156
        article_requests                 => 'yes',
149
        holds_per_day                    => undef,
157
        holds_per_day                    => undef,
150
    }
158
    }
151
};
159
};
Lines 153-164 my $sampleissuingrule2 = { Link Here
153
    branchcode   => $samplebranch2->{branchcode},
161
    branchcode   => $samplebranch2->{branchcode},
154
    categorycode => $samplecat->{categorycode},
162
    categorycode => $samplecat->{categorycode},
155
    itemtype     => $sampleitemtype1,
163
    itemtype     => $sampleitemtype1,
164
    onsite_checkout => 0,
156
    rules        => {
165
    rules        => {
157
        renewalsallowed               => 0,
166
        renewalsallowed               => 0,
158
        renewalperiod                 => 2,
167
        renewalperiod                 => 2,
159
        norenewalbefore               => 7,
168
        norenewalbefore               => 7,
160
        auto_renew                    => 0,
169
        auto_renew                    => 0,
161
        reservesallowed               => 0,
162
        issuelength                   => 2,
170
        issuelength                   => 2,
163
        lengthunit                    => 'days',
171
        lengthunit                    => 'days',
164
        hardduedate                   => 2,
172
        hardduedate                   => 2,
Lines 171-179 my $sampleissuingrule2 = { Link Here
171
        rentaldiscount                => 2.00,
179
        rentaldiscount                => 2.00,
172
        overduefinescap               => undef,
180
        overduefinescap               => undef,
173
        maxsuspensiondays             => 0,
181
        maxsuspensiondays             => 0,
182
        cap_fine_to_replacement_price => 0,
183
    }
184
};
185
my $sampleissuingrule2_holds = {
186
    branchcode   => $samplebranch2->{branchcode},
187
    categorycode => $samplecat->{categorycode},
188
    itemtype     => $sampleitemtype1,
189
    rules        => {
174
        onshelfholds                  => 1,
190
        onshelfholds                  => 1,
175
        opacitemholds                 => 'Y',
191
        opacitemholds                 => 'Y',
176
        cap_fine_to_replacement_price => 0,
177
        holds_per_record              => 1,
192
        holds_per_record              => 1,
178
        article_requests              => 'yes',
193
        article_requests              => 'yes',
179
    }
194
    }
Lines 182-193 my $sampleissuingrule3 = { Link Here
182
    branchcode   => $samplebranch1->{branchcode},
197
    branchcode   => $samplebranch1->{branchcode},
183
    categorycode => $samplecat->{categorycode},
198
    categorycode => $samplecat->{categorycode},
184
    itemtype     => $sampleitemtype2,
199
    itemtype     => $sampleitemtype2,
200
    onsite_checkout => 0,
185
    rules        => {
201
    rules        => {
186
        renewalsallowed               => 0,
202
        renewalsallowed               => 0,
187
        renewalperiod                 => 3,
203
        renewalperiod                 => 3,
188
        norenewalbefore               => 8,
204
        norenewalbefore               => 8,
189
        auto_renew                    => 0,
205
        auto_renew                    => 0,
190
        reservesallowed               => 0,
191
        issuelength                   => 3,
206
        issuelength                   => 3,
192
        lengthunit                    => 'days',
207
        lengthunit                    => 'days',
193
        hardduedate                   => 3,
208
        hardduedate                   => 3,
Lines 200-208 my $sampleissuingrule3 = { Link Here
200
        rentaldiscount                => 3.00,
215
        rentaldiscount                => 3.00,
201
        overduefinescap               => undef,
216
        overduefinescap               => undef,
202
        maxsuspensiondays             => 0,
217
        maxsuspensiondays             => 0,
218
        cap_fine_to_replacement_price => 0,
219
    }
220
};
221
my $sampleissuingrule3_holds = {
222
    branchcode   => $samplebranch1->{branchcode},
223
    categorycode => $samplecat->{categorycode},
224
    itemtype     => $sampleitemtype2,
225
    rules        => {
203
        onshelfholds                  => 1,
226
        onshelfholds                  => 1,
204
        opacitemholds                 => 'F',
227
        opacitemholds                 => 'F',
205
        cap_fine_to_replacement_price => 0,
206
        holds_per_record              => 1,
228
        holds_per_record              => 1,
207
        article_requests              => 'yes',
229
        article_requests              => 'yes',
208
    }
230
    }
Lines 211-216 my $sampleissuingrule3 = { Link Here
211
Koha::CirculationRules->set_rules( $sampleissuingrule1 );
233
Koha::CirculationRules->set_rules( $sampleissuingrule1 );
212
Koha::CirculationRules->set_rules( $sampleissuingrule2 );
234
Koha::CirculationRules->set_rules( $sampleissuingrule2 );
213
Koha::CirculationRules->set_rules( $sampleissuingrule3 );
235
Koha::CirculationRules->set_rules( $sampleissuingrule3 );
236
Koha::CirculationRules->set_rules( $sampleissuingrule1_holds );
237
Koha::CirculationRules->set_rules( $sampleissuingrule2_holds );
238
Koha::CirculationRules->set_rules( $sampleissuingrule3_holds );
214
239
215
#Test GetLoanLength
240
#Test GetLoanLength
216
is_deeply(
241
is_deeply(
(-)a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t (+4 lines)
Lines 33-38 Koha::CirculationRules->set_rules( Link Here
33
        categorycode => undef,
33
        categorycode => undef,
34
        itemtype     => undef,
34
        itemtype     => undef,
35
        branchcode   => undef,
35
        branchcode   => undef,
36
        onsite_checkout => undef,
36
        rules        => {
37
        rules        => {
37
            firstremind => 0,
38
            firstremind => 0,
38
            finedays    => 2,
39
            finedays    => 2,
Lines 90-95 Koha::CirculationRules->set_rules( Link Here
90
        categorycode => undef,
91
        categorycode => undef,
91
        itemtype     => undef,
92
        itemtype     => undef,
92
        branchcode   => undef,
93
        branchcode   => undef,
94
        onsite_checkout => undef,
93
        rules        => {
95
        rules        => {
94
            maxsuspensiondays => 10,
96
            maxsuspensiondays => 10,
95
        }
97
        }
Lines 113-118 subtest "suspension_chargeperiod" => sub { Link Here
113
            categorycode => undef,
115
            categorycode => undef,
114
            itemtype     => undef,
116
            itemtype     => undef,
115
            branchcode   => undef,
117
            branchcode   => undef,
118
            onsite_checkout => undef,
116
            rules        => {
119
            rules        => {
117
                firstremind  => 0,
120
                firstremind  => 0,
118
                finedays     => 7,
121
                finedays     => 7,
Lines 139-144 subtest "maxsuspensiondays" => sub { Link Here
139
            categorycode => undef,
142
            categorycode => undef,
140
            itemtype     => undef,
143
            itemtype     => undef,
141
            branchcode   => undef,
144
            branchcode   => undef,
145
            onsite_checkout => undef,
142
            rules        => {
146
            rules        => {
143
                firstremind  => 0,
147
                firstremind  => 0,
144
                finedays     => 15,
148
                finedays     => 15,
(-)a/t/db_dependent/Circulation/Returns.t (+1 lines)
Lines 237-242 subtest 'Handle ids duplication' => sub { Link Here
237
            categorycode => undef,
237
            categorycode => undef,
238
            itemtype     => undef,
238
            itemtype     => undef,
239
            branchcode   => undef,
239
            branchcode   => undef,
240
            onsite_checkout => undef,
240
            rules        => {
241
            rules        => {
241
                chargeperiod => 1,
242
                chargeperiod => 1,
242
                fine         => 1,
243
                fine         => 1,
(-)a/t/db_dependent/Circulation/issue.t (+2 lines)
Lines 93-98 Koha::CirculationRules->set_rules( Link Here
93
        itemtype     => '*',
93
        itemtype     => '*',
94
        categorycode => '*',
94
        categorycode => '*',
95
        branchcode   => '*',
95
        branchcode   => '*',
96
        onsite_checkout => '*',
96
        rules        => {
97
        rules        => {
97
            lengthunit      => 'days',
98
            lengthunit      => 'days',
98
            issuelength     => 0,
99
            issuelength     => 0,
Lines 355-360 Koha::CirculationRules->set_rules( Link Here
355
        categorycode => undef,
356
        categorycode => undef,
356
        itemtype     => undef,
357
        itemtype     => undef,
357
        branchcode   => undef,
358
        branchcode   => undef,
359
        onsite_checkout => undef,
358
        rules        => {
360
        rules        => {
359
            renewalsallowed => 3,
361
            renewalsallowed => 3,
360
        }
362
        }
(-)a/t/db_dependent/DecreaseLoanHighHolds.t (+11 lines)
Lines 104-112 Koha::CirculationRules->set_rules( Link Here
104
        branchcode   => undef,
104
        branchcode   => undef,
105
        categorycode => undef,
105
        categorycode => undef,
106
        itemtype     => $item->itype,
106
        itemtype     => $item->itype,
107
        onsite_checkout => undef,
107
        rules        => {
108
        rules        => {
108
            issuelength     => '14',
109
            issuelength     => '14',
109
            lengthunit      => 'days',
110
            lengthunit      => 'days',
111
        }
112
    }
113
);
114
115
Koha::CirculationRules->set_rules(
116
    {
117
        branchcode   => undef,
118
        categorycode => undef,
119
        itemtype     => $item->itype,
120
        rules        => {
110
            reservesallowed => '99',
121
            reservesallowed => '99',
111
            holds_per_record => '99',
122
            holds_per_record => '99',
112
        }
123
        }
(-)a/t/db_dependent/Fines.t (+2 lines)
Lines 20-25 my $issuingrule = Koha::CirculationRules->set_rules( Link Here
20
        categorycode => undef,
20
        categorycode => undef,
21
        itemtype     => undef,
21
        itemtype     => undef,
22
        branchcode   => undef,
22
        branchcode   => undef,
23
        onsite_checkout => undef,
23
        rules        => {
24
        rules        => {
24
            fine                   => 1,
25
            fine                   => 1,
25
            finedays               => 0,
26
            finedays               => 0,
Lines 49-54 $issuingrule = Koha::CirculationRules->set_rules( Link Here
49
        categorycode => undef,
50
        categorycode => undef,
50
        itemtype     => undef,
51
        itemtype     => undef,
51
        branchcode   => undef,
52
        branchcode   => undef,
53
        onsite_checkout => undef,
52
        rules        => {
54
        rules        => {
53
            chargeperiod_charge_at => 1,
55
            chargeperiod_charge_at => 1,
54
        }
56
        }
(-)a/t/db_dependent/Holds.t (+11 lines)
Lines 1244-1253 subtest 'non priority holds' => sub { Link Here
1244
    Koha::CirculationRules->set_rules(
1244
    Koha::CirculationRules->set_rules(
1245
        {
1245
        {
1246
            branchcode   => undef,
1246
            branchcode   => undef,
1247
            onsite_checkout => undef,
1247
            categorycode => undef,
1248
            categorycode => undef,
1248
            itemtype     => undef,
1249
            itemtype     => undef,
1249
            rules        => {
1250
            rules        => {
1250
                renewalsallowed => 5,
1251
                renewalsallowed => 5,
1252
            }
1253
        }
1254
    );
1255
1256
    Koha::CirculationRules->set_rules(
1257
        {
1258
            branchcode   => undef,
1259
            categorycode => undef,
1260
            itemtype     => undef,
1261
            rules        => {
1251
                reservesallowed => 5,
1262
                reservesallowed => 5,
1252
            }
1263
            }
1253
        }
1264
        }
(-)a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t (-6 / +42 lines)
Lines 88-100 Koha::CirculationRules->set_rules( Link Here
88
        itemtype     => $itemtype,
88
        itemtype     => $itemtype,
89
        branchcode   => undef,
89
        branchcode   => undef,
90
        rules        => {
90
        rules        => {
91
            issuelength     => 7,
92
            lengthunit      => 8,
93
            reservesallowed => 99,
91
            reservesallowed => 99,
94
            onshelfholds    => 2,
92
            onshelfholds    => 2,
95
        }
93
        }
96
    }
94
    }
97
);
95
);
96
Koha::CirculationRules->set_rules(
97
    {   categorycode => undef,
98
        itemtype     => $itemtype,
99
        branchcode   => undef,
100
        onsite_checkout => undef,
101
        rules        => {
102
            issuelength     => 7,
103
            lengthunit      => 8,
104
        }
105
    }
106
);
98
107
99
my $is;
108
my $is;
100
109
Lines 303-313 Koha::CirculationRules->set_rules( Link Here
303
        itemtype     => $itemtype2,
312
        itemtype     => $itemtype2,
304
        branchcode   => undef,
313
        branchcode   => undef,
305
        rules        => {
314
        rules        => {
306
            maxissueqty  => 99,
307
            onshelfholds => 0,
315
            onshelfholds => 0,
308
        }
316
        }
309
    }
317
    }
310
);
318
);
319
Koha::CirculationRules->set_rules(
320
    {   categorycode => undef,
321
        itemtype     => $itemtype2,
322
        branchcode   => undef,
323
        onsite_checkout => undef,
324
        rules        => {
325
            maxissueqty  => 99,
326
        }
327
    }
328
);
311
329
312
$is = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblionumber, patron => $patron1 } );    # patron1 in library A, library A 1 item
330
$is = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblionumber, patron => $patron1 } );    # patron1 in library A, library A 1 item
313
is( $is, 1, "Items availability: 1 item is available, 1 item held in T" );
331
is( $is, 1, "Items availability: 1 item is available, 1 item held in T" );
Lines 349-356 subtest 'Check holds availability with different item types' => sub { Link Here
349
            itemtype     => $itemtype,
367
            itemtype     => $itemtype,
350
            branchcode   => undef,
368
            branchcode   => undef,
351
            rules        => {
369
            rules        => {
352
                issuelength      => 7,
353
                lengthunit       => 8,
354
                reservesallowed  => 99,
370
                reservesallowed  => 99,
355
                holds_per_record => 99,
371
                holds_per_record => 99,
356
                onshelfholds     => 2,
372
                onshelfholds     => 2,
Lines 359-375 subtest 'Check holds availability with different item types' => sub { Link Here
359
    );
375
    );
360
    Koha::CirculationRules->set_rules(
376
    Koha::CirculationRules->set_rules(
361
        {   categorycode => undef,
377
        {   categorycode => undef,
362
            itemtype     => $itemtype2,
378
            itemtype     => $itemtype,
363
            branchcode   => undef,
379
            branchcode   => undef,
380
            onsite_checkout => undef,
364
            rules        => {
381
            rules        => {
365
                issuelength      => 7,
382
                issuelength      => 7,
366
                lengthunit       => 8,
383
                lengthunit       => 8,
384
            }
385
        }
386
    );
387
    Koha::CirculationRules->set_rules(
388
        {   categorycode => undef,
389
            itemtype     => $itemtype2,
390
            branchcode   => undef,
391
            rules        => {
367
                reservesallowed  => 0,
392
                reservesallowed  => 0,
368
                holds_per_record => 0,
393
                holds_per_record => 0,
369
                onshelfholds     => 2,
394
                onshelfholds     => 2,
370
            }
395
            }
371
        }
396
        }
372
    );
397
    );
398
    Koha::CirculationRules->set_rules(
399
        {   categorycode => undef,
400
            itemtype     => $itemtype2,
401
            branchcode   => undef,
402
            onsite_checkout => undef,
403
            rules        => {
404
                issuelength      => 7,
405
                lengthunit       => 8,
406
            }
407
        }
408
    );
373
409
374
    $is = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblionumber1, patron => $patron1 } );
410
    $is = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblionumber1, patron => $patron1 } );
375
    is( $is, 1, "Items availability: 2 items, one allowed by smart rule but not checked out, another one not allowed to be held by smart rule" );
411
    is( $is, 1, "Items availability: 2 items, one allowed by smart rule but not checked out, another one not allowed to be held by smart rule" );
(-)a/t/db_dependent/Koha/Charges/Fees.t (+2 lines)
Lines 327-332 subtest 'accumulate_rentalcharge tests' => sub { Link Here
327
            categorycode => $patron->categorycode,
327
            categorycode => $patron->categorycode,
328
            itemtype     => $itemtype->id,
328
            itemtype     => $itemtype->id,
329
            branchcode   => $library->id,
329
            branchcode   => $library->id,
330
            onsite_checkout => undef,
330
            rules => {
331
            rules => {
331
                lengthunit => 'days',
332
                lengthunit => 'days',
332
            }
333
            }
Lines 388-393 subtest 'accumulate_rentalcharge tests' => sub { Link Here
388
            categorycode => $patron->categorycode,
389
            categorycode => $patron->categorycode,
389
            itemtype     => $itemtype->id,
390
            itemtype     => $itemtype->id,
390
            branchcode   => $library->id,
391
            branchcode   => $library->id,
392
            onsite_checkout => undef,
391
            rules => {
393
            rules => {
392
                lengthunit => 'hours',
394
                lengthunit => 'hours',
393
            }
395
            }
(-)a/t/db_dependent/SIP/ILS.t (+11 lines)
Lines 96-101 subtest cancel_hold => sub { Link Here
96
                onshelfholds     => 1,
96
                onshelfholds     => 1,
97
                reservesallowed  => 3,
97
                reservesallowed  => 3,
98
                holds_per_record => 3,
98
                holds_per_record => 3,
99
            }
100
        }
101
    );
102
103
    Koha::CirculationRules->set_rules(
104
        {
105
            categorycode => $patron->categorycode,
106
            branchcode   => $library->branchcode,
107
            itemtype     => $item->effective_itemtype,
108
            onsite_checkout => undef,
109
            rules        => {
99
                issuelength      => 5,
110
                issuelength      => 5,
100
                lengthunit       => 'days',
111
                lengthunit       => 'days',
101
            }
112
            }
(-)a/t/db_dependent/SIP/Transaction.t (+23 lines)
Lines 75-86 subtest fill_holds_at_checkout => sub { Link Here
75
                onshelfholds     => 1,
75
                onshelfholds     => 1,
76
                reservesallowed  => 3,
76
                reservesallowed  => 3,
77
                holds_per_record => 3,
77
                holds_per_record => 3,
78
            }
79
        }
80
    );
81
82
    Koha::CirculationRules->set_rules(
83
        {
84
            categorycode => $borrower->{categorycode},
85
            branchcode   => $branch->{branchcode},
86
            itemtype     => $itype->{itemtype},
87
            onsite_checkout => undef,
88
            rules        => {
78
                issuelength      => 5,
89
                issuelength      => 5,
79
                lengthunit       => 'days',
90
                lengthunit       => 'days',
80
            }
91
            }
81
        }
92
        }
82
    );
93
    );
83
94
95
84
    my $reserve1 = AddReserve(
96
    my $reserve1 = AddReserve(
85
        {
97
        {
86
            branchcode     => $branch->{branchcode},
98
            branchcode     => $branch->{branchcode},
Lines 181-186 subtest cancel_hold => sub { Link Here
181
                onshelfholds     => 1,
193
                onshelfholds     => 1,
182
                reservesallowed  => 3,
194
                reservesallowed  => 3,
183
                holds_per_record => 3,
195
                holds_per_record => 3,
196
            }
197
        }
198
    );
199
200
    Koha::CirculationRules->set_rules(
201
        {
202
            categorycode => $patron->categorycode,
203
            branchcode   => $library->branchcode,
204
            itemtype     => $item->effective_itemtype,
205
            onsite_checkout => undef,
206
            rules        => {
184
                issuelength      => 5,
207
                issuelength      => 5,
185
                lengthunit       => 'days',
208
                lengthunit       => 'days',
186
            }
209
            }
(-)a/t/db_dependent/api/v1/checkouts.t (+1 lines)
Lines 76-81 Koha::CirculationRules->set_rules( Link Here
76
        categorycode => undef,
76
        categorycode => undef,
77
        itemtype     => undef,
77
        itemtype     => undef,
78
        branchcode   => undef,
78
        branchcode   => undef,
79
        onsite_checkout => undef,
79
        rules        => {
80
        rules        => {
80
            renewalperiod => 7,
81
            renewalperiod => 7,
81
            renewalsallowed => 1,
82
            renewalsallowed => 1,
(-)a/t/db_dependent/selenium/basic_workflow.t (-1 / +6 lines)
Lines 70-75 our $sample_data = { Link Here
70
        rentalcharge => 0,
70
        rentalcharge => 0,
71
        notforloan   => 0,
71
        notforloan   => 0,
72
    },
72
    },
73
    onsite_checkout => {
74
        itemtype     => 'CHECKOUT',
75
        description  => 'Just a onsite_checkout for tests',
76
        maxissueqty  => 80100,
77
    },
73
    issuingrule => {
78
    issuingrule => {
74
        categorycode  => 'test_cat',
79
        categorycode  => 'test_cat',
75
        itemtype      => 'IT4test',
80
        itemtype      => 'IT4test',
Lines 159-164 SKIP: { Link Here
159
            categorycode => $issuing_rules->{categorycode},
164
            categorycode => $issuing_rules->{categorycode},
160
            itemtype     => $issuing_rules->{itemtype},
165
            itemtype     => $issuing_rules->{itemtype},
161
            branchcode   => $issuing_rules->{branchcode},
166
            branchcode   => $issuing_rules->{branchcode},
167
            onsite_checkout => $issuing_rules->{onsite_checkout},
162
            rules => {
168
            rules => {
163
                maxissueqty     => $issuing_rules->{maxissueqty},
169
                maxissueqty     => $issuing_rules->{maxissueqty},
164
                issuelength     => $issuing_rules->{issuelength},
170
                issuelength     => $issuing_rules->{issuelength},
165
- 

Return to bug 26814