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 / +68 lines)
Lines 270-275 Koha::CirculationRules->set_rules( Link Here
270
        itemtype     => undef,
270
        itemtype     => undef,
271
        rules        => {
271
        rules        => {
272
            reservesallowed => 25,
272
            reservesallowed => 25,
273
        }
274
    }
275
);
276
277
Koha::CirculationRules->set_rules(
278
    {
279
        categorycode => undef,
280
        branchcode   => undef,
281
        itemtype     => undef,
282
        onsite_checkout => undef,
283
        rules        => {
273
            issuelength     => 14,
284
            issuelength     => 14,
274
            lengthunit      => 'days',
285
            lengthunit      => 'days',
275
            renewalsallowed => 1,
286
            renewalsallowed => 1,
Lines 778-783 subtest "CanBookBeRenewed tests" => sub { Link Here
778
                categorycode => undef,
789
                categorycode => undef,
779
                branchcode   => undef,
790
                branchcode   => undef,
780
                itemtype     => undef,
791
                itemtype     => undef,
792
                onsite_checkout => undef,
781
                rules        => {
793
                rules        => {
782
                    norenewalbefore       => '7',
794
                    norenewalbefore       => '7',
783
                    no_auto_renewal_after => '9',
795
                    no_auto_renewal_after => '9',
Lines 794-799 subtest "CanBookBeRenewed tests" => sub { Link Here
794
                categorycode => undef,
806
                categorycode => undef,
795
                branchcode   => undef,
807
                branchcode   => undef,
796
                itemtype     => undef,
808
                itemtype     => undef,
809
                onsite_checkout => undef,
797
                rules        => {
810
                rules        => {
798
                    norenewalbefore       => '7',
811
                    norenewalbefore       => '7',
799
                    no_auto_renewal_after => '10',
812
                    no_auto_renewal_after => '10',
Lines 810-815 subtest "CanBookBeRenewed tests" => sub { Link Here
810
                categorycode => undef,
823
                categorycode => undef,
811
                branchcode   => undef,
824
                branchcode   => undef,
812
                itemtype     => undef,
825
                itemtype     => undef,
826
                onsite_checkout => undef,
813
                rules        => {
827
                rules        => {
814
                    norenewalbefore       => '7',
828
                    norenewalbefore       => '7',
815
                    no_auto_renewal_after => '11',
829
                    no_auto_renewal_after => '11',
Lines 826-831 subtest "CanBookBeRenewed tests" => sub { Link Here
826
                categorycode => undef,
840
                categorycode => undef,
827
                branchcode   => undef,
841
                branchcode   => undef,
828
                itemtype     => undef,
842
                itemtype     => undef,
843
                onsite_checkout => undef,
829
                rules        => {
844
                rules        => {
830
                    norenewalbefore       => '10',
845
                    norenewalbefore       => '10',
831
                    no_auto_renewal_after => '11',
846
                    no_auto_renewal_after => '11',
Lines 842-847 subtest "CanBookBeRenewed tests" => sub { Link Here
842
                categorycode => undef,
857
                categorycode => undef,
843
                branchcode   => undef,
858
                branchcode   => undef,
844
                itemtype     => undef,
859
                itemtype     => undef,
860
                onsite_checkout => undef,
845
                rules        => {
861
                rules        => {
846
                    norenewalbefore       => '10',
862
                    norenewalbefore       => '10',
847
                    no_auto_renewal_after => undef,
863
                    no_auto_renewal_after => undef,
Lines 859-864 subtest "CanBookBeRenewed tests" => sub { Link Here
859
                categorycode => undef,
875
                categorycode => undef,
860
                branchcode   => undef,
876
                branchcode   => undef,
861
                itemtype     => undef,
877
                itemtype     => undef,
878
                onsite_checkout => undef,
862
                rules        => {
879
                rules        => {
863
                    norenewalbefore       => '7',
880
                    norenewalbefore       => '7',
864
                    no_auto_renewal_after => '15',
881
                    no_auto_renewal_after => '15',
Lines 876-881 subtest "CanBookBeRenewed tests" => sub { Link Here
876
                categorycode => undef,
893
                categorycode => undef,
877
                branchcode   => undef,
894
                branchcode   => undef,
878
                itemtype     => undef,
895
                itemtype     => undef,
896
                onsite_checkout => undef,
879
                rules        => {
897
                rules        => {
880
                    norenewalbefore       => '10',
898
                    norenewalbefore       => '10',
881
                    no_auto_renewal_after => undef,
899
                    no_auto_renewal_after => undef,
Lines 907-912 subtest "CanBookBeRenewed tests" => sub { Link Here
907
                categorycode => undef,
925
                categorycode => undef,
908
                branchcode   => undef,
926
                branchcode   => undef,
909
                itemtype     => undef,
927
                itemtype     => undef,
928
                onsite_checkout => undef,
910
                rules        => {
929
                rules        => {
911
                    norenewalbefore       => '10',
930
                    norenewalbefore       => '10',
912
                    no_auto_renewal_after => '11',
931
                    no_auto_renewal_after => '11',
Lines 997-1002 subtest "CanBookBeRenewed tests" => sub { Link Here
997
                categorycode => undef,
1016
                categorycode => undef,
998
                branchcode   => undef,
1017
                branchcode   => undef,
999
                itemtype     => undef,
1018
                itemtype     => undef,
1019
                onsite_checkout => undef,
1000
                rules        => {
1020
                rules        => {
1001
                    norenewalbefore       => 10,
1021
                    norenewalbefore       => 10,
1002
                    no_auto_renewal_after => 11,
1022
                    no_auto_renewal_after => 11,
Lines 1060-1065 subtest "CanBookBeRenewed tests" => sub { Link Here
1060
                categorycode => undef,
1080
                categorycode => undef,
1061
                branchcode   => undef,
1081
                branchcode   => undef,
1062
                itemtype     => undef,
1082
                itemtype     => undef,
1083
                onsite_checkout => undef,
1063
                rules        => {
1084
                rules        => {
1064
                    norenewalbefore       => '7',
1085
                    norenewalbefore       => '7',
1065
                    no_auto_renewal_after => '',
1086
                    no_auto_renewal_after => '',
Lines 1075-1080 subtest "CanBookBeRenewed tests" => sub { Link Here
1075
                categorycode => undef,
1096
                categorycode => undef,
1076
                branchcode   => undef,
1097
                branchcode   => undef,
1077
                itemtype     => undef,
1098
                itemtype     => undef,
1099
                onsite_checkout => undef,
1078
                rules        => {
1100
                rules        => {
1079
                    norenewalbefore       => '10',
1101
                    norenewalbefore       => '10',
1080
                    no_auto_renewal_after => '5',
1102
                    no_auto_renewal_after => '5',
Lines 1096-1101 subtest "CanBookBeRenewed tests" => sub { Link Here
1096
                categorycode => undef,
1118
                categorycode => undef,
1097
                branchcode   => undef,
1119
                branchcode   => undef,
1098
                itemtype     => undef,
1120
                itemtype     => undef,
1121
                onsite_checkout => undef,
1099
                rules        => {
1122
                rules        => {
1100
                    norenewalbefore       => '10',
1123
                    norenewalbefore       => '10',
1101
                    no_auto_renewal_after => '15',
1124
                    no_auto_renewal_after => '15',
Lines 1114-1119 subtest "CanBookBeRenewed tests" => sub { Link Here
1114
                categorycode => undef,
1137
                categorycode => undef,
1115
                branchcode   => undef,
1138
                branchcode   => undef,
1116
                itemtype     => undef,
1139
                itemtype     => undef,
1140
                onsite_checkout => undef,
1117
                rules        => {
1141
                rules        => {
1118
                    norenewalbefore       => '10',
1142
                    norenewalbefore       => '10',
1119
                    no_auto_renewal_after => '',
1143
                    no_auto_renewal_after => '',
Lines 1131-1136 subtest "CanBookBeRenewed tests" => sub { Link Here
1131
                categorycode => undef,
1155
                categorycode => undef,
1132
                branchcode   => undef,
1156
                branchcode   => undef,
1133
                itemtype     => undef,
1157
                itemtype     => undef,
1158
                onsite_checkout => undef,
1134
                rules        => {
1159
                rules        => {
1135
                    norenewalbefore       => '10',
1160
                    norenewalbefore       => '10',
1136
                    no_auto_renewal_after => '15',
1161
                    no_auto_renewal_after => '15',
Lines 1153-1158 subtest "CanBookBeRenewed tests" => sub { Link Here
1153
            categorycode => undef,
1178
            categorycode => undef,
1154
            branchcode   => undef,
1179
            branchcode   => undef,
1155
            itemtype     => undef,
1180
            itemtype     => undef,
1181
            onsite_checkout => undef,
1156
            rules        => {
1182
            rules        => {
1157
                norenewalbefore => undef,
1183
                norenewalbefore => undef,
1158
                renewalsallowed => 0,
1184
                renewalsallowed => 0,
Lines 1170-1175 subtest "CanBookBeRenewed tests" => sub { Link Here
1170
            categorycode => undef,
1196
            categorycode => undef,
1171
            branchcode   => undef,
1197
            branchcode   => undef,
1172
            itemtype     => undef,
1198
            itemtype     => undef,
1199
            onsite_checkout => undef,
1173
            rules        => {
1200
            rules        => {
1174
                unseen_renewals_allowed => 2,
1201
                unseen_renewals_allowed => 2,
1175
                renewalsallowed => 10,
1202
                renewalsallowed => 10,
Lines 1186-1191 subtest "CanBookBeRenewed tests" => sub { Link Here
1186
            categorycode => undef,
1213
            categorycode => undef,
1187
            branchcode   => undef,
1214
            branchcode   => undef,
1188
            itemtype     => undef,
1215
            itemtype     => undef,
1216
            onsite_checkout => undef,
1189
            rules        => {
1217
            rules        => {
1190
                norenewalbefore => undef,
1218
                norenewalbefore => undef,
1191
                renewalsallowed => 0,
1219
                renewalsallowed => 0,
Lines 1431-1436 subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { Link Here
1431
            branchcode   => undef,
1459
            branchcode   => undef,
1432
            rules        => {
1460
            rules        => {
1433
                reservesallowed => 25,
1461
                reservesallowed => 25,
1462
            }
1463
        }
1464
    );
1465
    Koha::CirculationRules->set_rules(
1466
        {
1467
            categorycode => undef,
1468
            itemtype     => undef,
1469
            branchcode   => undef,
1470
            onsite_checkout => undef,
1471
            rules        => {
1434
                issuelength     => 14,
1472
                issuelength     => 14,
1435
                lengthunit      => 'days',
1473
                lengthunit      => 'days',
1436
                renewalsallowed => 1,
1474
                renewalsallowed => 1,
Lines 2058-2063 subtest 'AddReturn + CumulativeRestrictionPeriods' => sub { Link Here
2058
            categorycode => undef,
2096
            categorycode => undef,
2059
            itemtype     => undef,
2097
            itemtype     => undef,
2060
            branchcode   => undef,
2098
            branchcode   => undef,
2099
            onsite_checkout => undef,
2061
            rules        => {
2100
            rules        => {
2062
                issuelength => 1,
2101
                issuelength => 1,
2063
                firstremind => 1,        # 1 day of grace
2102
                firstremind => 1,        # 1 day of grace
Lines 2164-2169 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2164
            categorycode => '*',
2203
            categorycode => '*',
2165
            itemtype     => '*',
2204
            itemtype     => '*',
2166
            branchcode   => '*',
2205
            branchcode   => '*',
2206
            onsite_checkout => '*',
2167
            rules        => {
2207
            rules        => {
2168
                issuelength => 1,
2208
                issuelength => 1,
2169
                firstremind => 0,    # 0 day of grace
2209
                firstremind => 0,    # 0 day of grace
Lines 2196-2201 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2196
            categorycode => '*',
2236
            categorycode => '*',
2197
            itemtype     => '*',
2237
            itemtype     => '*',
2198
            branchcode   => '*',
2238
            branchcode   => '*',
2239
            onsite_checkout => '*',
2199
            rules        => {
2240
            rules        => {
2200
                issuelength => 1,
2241
                issuelength => 1,
2201
                firstremind => undef,    # 0 day of grace
2242
                firstremind => undef,    # 0 day of grace
Lines 2252-2257 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2252
            categorycode => undef,
2293
            categorycode => undef,
2253
            branchcode   => undef,
2294
            branchcode   => undef,
2254
            itemtype     => undef,
2295
            itemtype     => undef,
2296
            onsite_checkout => undef,
2255
            rules        => {
2297
            rules        => {
2256
                suspension_chargeperiod => 3,
2298
                suspension_chargeperiod => 3,
2257
                firstremind             => 1,
2299
                firstremind             => 1,
Lines 2276-2281 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2276
            categorycode => undef,
2318
            categorycode => undef,
2277
            branchcode   => undef,
2319
            branchcode   => undef,
2278
            itemtype     => undef,
2320
            itemtype     => undef,
2321
            onsite_checkout => undef,
2279
            rules        => {
2322
            rules        => {
2280
                finedays                => 2,
2323
                finedays                => 2,
2281
                suspension_chargeperiod => 1,
2324
                suspension_chargeperiod => 1,
Lines 2445-2450 subtest 'AddReturn | is_overdue' => sub { Link Here
2445
            categorycode => undef,
2488
            categorycode => undef,
2446
            itemtype     => undef,
2489
            itemtype     => undef,
2447
            branchcode   => undef,
2490
            branchcode   => undef,
2491
            onsite_checkout => undef,
2448
            rules        => {
2492
            rules        => {
2449
                issuelength  => 6,
2493
                issuelength  => 6,
2450
                lengthunit   => 'days',
2494
                lengthunit   => 'days',
Lines 3395-3402 subtest 'CanBookBeIssued | is_overdue' => sub { Link Here
3395
            branchcode   => undef,
3439
            branchcode   => undef,
3396
            itemtype     => undef,
3440
            itemtype     => undef,
3397
            rules        => {
3441
            rules        => {
3398
                maxissueqty     => 1,
3399
                reservesallowed => 25,
3442
                reservesallowed => 25,
3443
            }
3444
        }
3445
    );
3446
3447
    Koha::CirculationRules->set_rules(
3448
        {
3449
            categorycode => undef,
3450
            branchcode   => undef,
3451
            itemtype     => undef,
3452
            onsite_checkout => undef,
3453
            rules        => {
3454
                maxissueqty     => 1,
3400
                issuelength     => 14,
3455
                issuelength     => 14,
3401
                lengthunit      => 'days',
3456
                lengthunit      => 'days',
3402
                renewalsallowed => 1,
3457
                renewalsallowed => 1,
Lines 3442-3447 subtest 'ItemsDeniedRenewal preference' => sub { Link Here
3442
            branchcode   => $idr_lib->branchcode,
3497
            branchcode   => $idr_lib->branchcode,
3443
            rules        => {
3498
            rules        => {
3444
                reservesallowed => 25,
3499
                reservesallowed => 25,
3500
            }
3501
        }
3502
    );
3503
    Koha::CirculationRules->set_rules(
3504
        {
3505
            categorycode => '*',
3506
            itemtype     => '*',
3507
            branchcode   => $idr_lib->branchcode,
3508
            onsite_checkout => '*',
3509
            rules        => {
3445
                issuelength     => 14,
3510
                issuelength     => 14,
3446
                lengthunit      => 'days',
3511
                lengthunit      => 'days',
3447
                renewalsallowed => 10,
3512
                renewalsallowed => 10,
Lines 4200-4205 subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddReturn' => sub { Link Here
4200
            categorycode => undef,
4265
            categorycode => undef,
4201
            itemtype     => undef,
4266
            itemtype     => undef,
4202
            branchcode   => undef,
4267
            branchcode   => undef,
4268
            onsite_checkout => undef,
4203
            rules        => {
4269
            rules        => {
4204
                issuelength => 14,
4270
                issuelength => 14,
4205
                lengthunit  => 'days',
4271
                lengthunit  => 'days',
Lines 4394-4399 subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddIssue' => sub { Link Here
4394
            categorycode => undef,
4460
            categorycode => undef,
4395
            itemtype     => undef,
4461
            itemtype     => undef,
4396
            branchcode   => undef,
4462
            branchcode   => undef,
4463
            onsite_checkout => undef,
4397
            rules        => {
4464
            rules        => {
4398
                issuelength => 14,
4465
                issuelength => 14,
4399
                lengthunit  => 'days',
4466
                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 (+3 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
        }
Lines 498-503 Koha::CirculationRules->set_rules( Link Here
498
        categorycode => undef,
500
        categorycode => undef,
499
        itemtype     => undef,
501
        itemtype     => undef,
500
        branchcode   => undef,
502
        branchcode   => undef,
503
        onsite_checkout => undef,
501
        rules        => {
504
        rules        => {
502
            renewalsallowed => 10,
505
            renewalsallowed => 10,
503
            unseen_renewals_allowed => 3
506
            unseen_renewals_allowed => 3
(-)a/t/db_dependent/DecreaseLoanHighHolds.t (+22 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
            decreaseloanholds => 0,
123
            decreaseloanholds => 0,
Lines 141-149 Koha::CirculationRules->set_rules( Link Here
141
        branchcode   => undef,
152
        branchcode   => undef,
142
        categorycode => undef,
153
        categorycode => undef,
143
        itemtype     => $item->itype,
154
        itemtype     => $item->itype,
155
        onsite_checkout => undef,
144
        rules        => {
156
        rules        => {
145
            issuelength     => '14',
157
            issuelength     => '14',
146
            lengthunit      => 'days',
158
            lengthunit      => 'days',
159
        }
160
    }
161
);
162
163
Koha::CirculationRules->set_rules(
164
    {
165
        branchcode   => undef,
166
        categorycode => undef,
167
        itemtype     => $item->itype,
168
        rules        => {
147
            reservesallowed => '99',
169
            reservesallowed => '99',
148
            holds_per_record => '99',
170
            holds_per_record => '99',
149
            decreaseloanholds => undef,
171
            decreaseloanholds => undef,
(-)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