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

(-)a/Koha/CirculationRules.pm (+6 lines)
Lines 216-221 our $RULE_KINDS = { Link Here
216
    holds_pickup_period => {
216
    holds_pickup_period => {
217
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
217
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
218
    },
218
    },
219
    bookings_lead_period => {
220
        scope => [ 'branchcode', 'itemtype' ],
221
    },
222
    bookings_trail_period => {
223
        scope => [ 'branchcode', 'itemtype' ],
224
    },
219
    # Not included (deprecated?):
225
    # Not included (deprecated?):
220
    #   * accountsent
226
    #   * accountsent
221
    #   * reservecharge
227
    #   * reservecharge
(-)a/admin/smart-rules.pl (-41 / +69 lines)
Lines 138-148 elsif ($op eq 'cud-delete-branch-cat') { Link Here
138
            );
138
            );
139
            Koha::CirculationRules->set_rules(
139
            Koha::CirculationRules->set_rules(
140
                {
140
                {
141
                    branchcode   => undef,
141
                    branchcode => undef,
142
                    itemtype     => undef,
142
                    itemtype   => undef,
143
                    rules        => {
143
                    rules      => {
144
                        holdallowed             => undef,
144
                        holdallowed             => undef,
145
                        hold_fulfillment_policy => undef,
145
                        hold_fulfillment_policy => undef,
146
                        bookings_lead_period    => undef,
147
                        bookings_trail_period   => undef,
146
                        returnbranch            => undef,
148
                        returnbranch            => undef,
147
                    }
149
                    }
148
                }
150
                }
Lines 174-184 elsif ($op eq 'cud-delete-branch-cat') { Link Here
174
        );
176
        );
175
        Koha::CirculationRules->set_rules(
177
        Koha::CirculationRules->set_rules(
176
            {
178
            {
177
                branchcode   => $branch,
179
                branchcode => $branch,
178
                itemtype     => undef,
180
                itemtype   => undef,
179
                rules        => {
181
                rules      => {
180
                    holdallowed             => undef,
182
                    holdallowed             => undef,
181
                    hold_fulfillment_policy => undef,
183
                    hold_fulfillment_policy => undef,
184
                    bookings_lead_period    => undef,
185
                    bookings_trail_period   => undef,
182
                    returnbranch            => undef,
186
                    returnbranch            => undef,
183
                }
187
                }
184
            }
188
            }
Lines 203-213 elsif ($op eq 'cud-delete-branch-item') { Link Here
203
        if ($itemtype eq "*") {
207
        if ($itemtype eq "*") {
204
            Koha::CirculationRules->set_rules(
208
            Koha::CirculationRules->set_rules(
205
                {
209
                {
206
                    branchcode   => undef,
210
                    branchcode => undef,
207
                    itemtype     => undef,
211
                    itemtype   => undef,
208
                    rules        => {
212
                    rules      => {
209
                        holdallowed             => undef,
213
                        holdallowed             => undef,
210
                        hold_fulfillment_policy => undef,
214
                        hold_fulfillment_policy => undef,
215
                        bookings_lead_period    => undef,
216
                        bookings_trail_period   => undef,
211
                        returnbranch            => undef,
217
                        returnbranch            => undef,
212
                    }
218
                    }
213
                }
219
                }
Lines 215-225 elsif ($op eq 'cud-delete-branch-item') { Link Here
215
        } else {
221
        } else {
216
            Koha::CirculationRules->set_rules(
222
            Koha::CirculationRules->set_rules(
217
                {
223
                {
218
                    branchcode   => undef,
224
                    branchcode => undef,
219
                    itemtype     => $itemtype,
225
                    itemtype   => $itemtype,
220
                    rules        => {
226
                    rules      => {
221
                        holdallowed             => undef,
227
                        holdallowed             => undef,
222
                        hold_fulfillment_policy => undef,
228
                        hold_fulfillment_policy => undef,
229
                        bookings_lead_period    => undef,
230
                        bookings_trail_period   => undef,
223
                        returnbranch            => undef,
231
                        returnbranch            => undef,
224
                    }
232
                    }
225
                }
233
                }
Lines 228-238 elsif ($op eq 'cud-delete-branch-item') { Link Here
228
    } elsif ($itemtype eq "*") {
236
    } elsif ($itemtype eq "*") {
229
        Koha::CirculationRules->set_rules(
237
        Koha::CirculationRules->set_rules(
230
            {
238
            {
231
                branchcode   => $branch,
239
                branchcode => $branch,
232
                itemtype     => undef,
240
                itemtype   => undef,
233
                rules        => {
241
                rules      => {
234
                    holdallowed             => undef,
242
                    holdallowed             => undef,
235
                    hold_fulfillment_policy => undef,
243
                    hold_fulfillment_policy => undef,
244
                    bookings_lead_period    => undef,
245
                    bookings_trail_period   => undef,
236
                    returnbranch            => undef,
246
                    returnbranch            => undef,
237
                }
247
                }
238
            }
248
            }
Lines 240-250 elsif ($op eq 'cud-delete-branch-item') { Link Here
240
    } else {
250
    } else {
241
        Koha::CirculationRules->set_rules(
251
        Koha::CirculationRules->set_rules(
242
            {
252
            {
243
                branchcode   => $branch,
253
                branchcode => $branch,
244
                itemtype     => $itemtype,
254
                itemtype   => $itemtype,
245
                rules        => {
255
                rules      => {
246
                    holdallowed             => undef,
256
                    holdallowed             => undef,
247
                    hold_fulfillment_policy => undef,
257
                    hold_fulfillment_policy => undef,
258
                    bookings_lead_period    => undef,
259
                    bookings_trail_period   => undef,
248
                    returnbranch            => undef,
260
                    returnbranch            => undef,
249
                }
261
                }
250
            }
262
            }
Lines 357-379 elsif ( $op eq 'cud-add' ) { Link Here
357
369
358
}
370
}
359
elsif ($op eq "cud-set-branch-defaults") {
371
elsif ($op eq "cud-set-branch-defaults") {
360
    my $categorycode  = $input->param('categorycode');
372
    my $categorycode             = $input->param('categorycode');
361
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
373
    my $patron_maxissueqty       = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
362
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
374
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
363
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
375
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
364
    my $holdallowed   = $input->param('holdallowed');
376
    my $holdallowed             = $input->param('holdallowed');
365
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
377
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
366
    my $returnbranch  = $input->param('returnbranch');
378
    my $bookings_lead_period    = $input->param('bookings_lead_period');
367
    my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
379
    my $bookings_trail_period   = $input->param('bookings_trail_period');
380
    my $returnbranch            = $input->param('returnbranch');
381
    my $max_holds               = strip_non_numeric( scalar $input->param('max_holds') );
368
382
369
    if ($branch eq "*") {
383
    if ($branch eq "*") {
370
        Koha::CirculationRules->set_rules(
384
        Koha::CirculationRules->set_rules(
371
            {
385
            {
372
                itemtype     => undef,
386
                itemtype   => undef,
373
                branchcode   => undef,
387
                branchcode => undef,
374
                rules        => {
388
                rules      => {
375
                    holdallowed             => $holdallowed,
389
                    holdallowed             => $holdallowed,
376
                    hold_fulfillment_policy => $hold_fulfillment_policy,
390
                    hold_fulfillment_policy => $hold_fulfillment_policy,
391
                    bookings_lead_period    => $bookings_lead_period,
392
                    bookings_trail_period   => $bookings_trail_period,
377
                    returnbranch            => $returnbranch,
393
                    returnbranch            => $returnbranch,
378
                }
394
                }
379
            }
395
            }
Lines 391-401 elsif ($op eq "cud-set-branch-defaults") { Link Here
391
    } else {
407
    } else {
392
        Koha::CirculationRules->set_rules(
408
        Koha::CirculationRules->set_rules(
393
            {
409
            {
394
                itemtype     => undef,
410
                itemtype   => undef,
395
                branchcode   => $branch,
411
                branchcode => $branch,
396
                rules        => {
412
                rules      => {
397
                    holdallowed             => $holdallowed,
413
                    holdallowed             => $holdallowed,
398
                    hold_fulfillment_policy => $hold_fulfillment_policy,
414
                    hold_fulfillment_policy => $hold_fulfillment_policy,
415
                    bookings_lead_period    => $bookings_lead_period,
416
                    bookings_trail_period   => $bookings_trail_period,
399
                    returnbranch            => $returnbranch,
417
                    returnbranch            => $returnbranch,
400
                }
418
                }
401
            }
419
            }
Lines 584-600 elsif ($op eq "cud-add-branch-item") { Link Here
584
    my $itemtype                = $input->param('itemtype');
602
    my $itemtype                = $input->param('itemtype');
585
    my $holdallowed             = $input->param('holdallowed');
603
    my $holdallowed             = $input->param('holdallowed');
586
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
604
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
605
    my $bookings_lead_period    = $input->param('bookings_lead_period');
606
    my $bookings_trail_period   = $input->param('bookings_trail_period');
587
    my $returnbranch            = $input->param('returnbranch');
607
    my $returnbranch            = $input->param('returnbranch');
588
608
589
    if ($branch eq "*") {
609
    if ($branch eq "*") {
590
        if ($itemtype eq "*") {
610
        if ($itemtype eq "*") {
591
            Koha::CirculationRules->set_rules(
611
            Koha::CirculationRules->set_rules(
592
                {
612
                {
593
                    itemtype     => undef,
613
                    itemtype   => undef,
594
                    branchcode   => undef,
614
                    branchcode => undef,
595
                    rules        => {
615
                    rules      => {
596
                        holdallowed             => $holdallowed,
616
                        holdallowed             => $holdallowed,
597
                        hold_fulfillment_policy => $hold_fulfillment_policy,
617
                        hold_fulfillment_policy => $hold_fulfillment_policy,
618
                        bookings_lead_period    => $bookings_lead_period,
619
                        bookings_trail_period   => $bookings_trail_period,
598
                        returnbranch            => $returnbranch,
620
                        returnbranch            => $returnbranch,
599
                    }
621
                    }
600
                }
622
                }
Lines 602-612 elsif ($op eq "cud-add-branch-item") { Link Here
602
        } else {
624
        } else {
603
            Koha::CirculationRules->set_rules(
625
            Koha::CirculationRules->set_rules(
604
                {
626
                {
605
                    itemtype     => $itemtype,
627
                    itemtype   => $itemtype,
606
                    branchcode   => undef,
628
                    branchcode => undef,
607
                    rules        => {
629
                    rules      => {
608
                        holdallowed             => $holdallowed,
630
                        holdallowed             => $holdallowed,
609
                        hold_fulfillment_policy => $hold_fulfillment_policy,
631
                        hold_fulfillment_policy => $hold_fulfillment_policy,
632
                        bookings_lead_period    => $bookings_lead_period,
633
                        bookings_trail_period   => $bookings_trail_period,
610
                        returnbranch            => $returnbranch,
634
                        returnbranch            => $returnbranch,
611
                    }
635
                    }
612
                }
636
                }
Lines 615-625 elsif ($op eq "cud-add-branch-item") { Link Here
615
    } elsif ($itemtype eq "*") {
639
    } elsif ($itemtype eq "*") {
616
            Koha::CirculationRules->set_rules(
640
            Koha::CirculationRules->set_rules(
617
                {
641
                {
618
                    itemtype     => undef,
642
                    itemtype   => undef,
619
                    branchcode   => $branch,
643
                    branchcode => $branch,
620
                    rules        => {
644
                    rules      => {
621
                        holdallowed             => $holdallowed,
645
                        holdallowed             => $holdallowed,
622
                        hold_fulfillment_policy => $hold_fulfillment_policy,
646
                        hold_fulfillment_policy => $hold_fulfillment_policy,
647
                        bookings_lead_period    => $bookings_lead_period,
648
                        bookings_trail_period   => $bookings_trail_period,
623
                        returnbranch            => $returnbranch,
649
                        returnbranch            => $returnbranch,
624
                    }
650
                    }
625
                }
651
                }
Lines 627-637 elsif ($op eq "cud-add-branch-item") { Link Here
627
    } else {
653
    } else {
628
        Koha::CirculationRules->set_rules(
654
        Koha::CirculationRules->set_rules(
629
            {
655
            {
630
                itemtype     => $itemtype,
656
                itemtype   => $itemtype,
631
                branchcode   => $branch,
657
                branchcode => $branch,
632
                rules        => {
658
                rules      => {
633
                    holdallowed             => $holdallowed,
659
                    holdallowed             => $holdallowed,
634
                    hold_fulfillment_policy => $hold_fulfillment_policy,
660
                    hold_fulfillment_policy => $hold_fulfillment_policy,
661
                    bookings_lead_period    => $bookings_lead_period,
662
                    bookings_trail_period   => $bookings_trail_period,
635
                    returnbranch            => $returnbranch,
663
                    returnbranch            => $returnbranch,
636
                }
664
                }
637
            }
665
            }
(-)a/installer/onboarding.pl (+2 lines)
Lines 288-293 if ( $step == 5 ) { Link Here
288
                recall_overdue_fine              => undef,
288
                recall_overdue_fine              => undef,
289
                recall_shelf_time                => undef,
289
                recall_shelf_time                => undef,
290
                holds_pickup_period              => undef,
290
                holds_pickup_period              => undef,
291
                bookings_lead_period             => undef,
292
                bookings_trail_period            => undef,
291
              }
293
              }
292
        };
294
        };
293
295
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-4 / +29 lines)
Lines 627-632 Link Here
627
                                <th>Maximum total holds allowed (count)</th>
627
                                <th>Maximum total holds allowed (count)</th>
628
                                <th>Hold policy</th>
628
                                <th>Hold policy</th>
629
                                <th>Hold pickup library match</th>
629
                                <th>Hold pickup library match</th>
630
                                <th>Booking preparation period</th>
631
                                <th>Booking precaution period</th>
630
                                <th>Return policy</th>
632
                                <th>Return policy</th>
631
                                <th class="noExport">Actions</th>
633
                                <th class="noExport">Actions</th>
632
                            </tr>
634
                            </tr>
Lines 635-640 Link Here
635
                            [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
637
                            [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
636
                            [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
638
                            [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
637
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
639
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
640
                            [% SET bookings_lead_period = CirculationRules.Search( current_branch, undef, undef, 'bookings_lead_period', { want_rule => 1 }) %]
641
                            [% SET bookings_trail_period = CirculationRules.Search( current_branch, undef, undef, 'bookings_trail_period', { want_rule => 1 }) %]
638
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
642
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
639
                            [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
643
                            [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
640
                            <tr>
644
                            <tr>
Lines 753-758 Link Here
753
                                        [% END %]
757
                                        [% END %]
754
                                    </select>
758
                                    </select>
755
                                </td>
759
                                </td>
760
                                <td>
761
                                    <input type="text" name="bookings_lead_period" class="bookinglead" size="3" value="[% bookings_lead_period | html %]">
762
                                </td>
763
                                <td>
764
                                    <input type="text" name="bookings_trail_period" class="bookingtrail" size="3" value="[% bookings_trail_period | html %]">
765
                                </td>
756
                                <td>
766
                                <td>
757
                                    <select name="returnbranch">
767
                                    <select name="returnbranch">
758
768
Lines 1269-1280 Link Here
1269
                </div>
1279
                </div>
1270
1280
1271
                <div id="holds-policy-by-item-type" class="page-section">
1281
                <div id="holds-policy-by-item-type" class="page-section">
1272
                    <h2>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h2>
1282
                    <h2>[% IF humanbranch %]Holds and bookings policies by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds and bookings policies by item type[% END %]</h2>
1273
                    <p>
1283
                    <p>
1274
                        For this library, you can edit rules for given itemtypes, regardless of the patron's category.
1284
                        For this library, you can edit rules for given itemtypes, regardless of the patron's category.
1275
                    </p>
1285
                    </p>
1276
                    <p>
1286
                    <p>
1277
                        Currently, this means hold policies. The various policies have the following effects:
1287
                        Currently, this means holds and bookings policies. The various policies have the following effects:
1278
                    </p>
1288
                    </p>
1279
                    <ul>
1289
                    <ul>
1280
                        <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
1290
                        <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
Lines 1301-1306 Link Here
1301
                                <th>Item type</th>
1311
                                <th>Item type</th>
1302
                                <th>Hold policy</th>
1312
                                <th>Hold policy</th>
1303
                                <th>Hold pickup library match</th>
1313
                                <th>Hold pickup library match</th>
1314
                                <th>Booking preparation period</th>
1315
                                <th>Booking precaution period</th>
1304
                                <th>Return policy</th>
1316
                                <th>Return policy</th>
1305
                                <th>&nbsp;</th>
1317
                                <th>&nbsp;</th>
1306
                            </tr>
1318
                            </tr>
Lines 1309-1317 Link Here
1309
                                [% SET c = undef %]
1321
                                [% SET c = undef %]
1310
                                [% SET holdallowed = all_rules.$c.$it.holdallowed %]
1322
                                [% SET holdallowed = all_rules.$c.$it.holdallowed %]
1311
                                [% SET hold_fulfillment_policy = all_rules.$c.$it.hold_fulfillment_policy %]
1323
                                [% SET hold_fulfillment_policy = all_rules.$c.$it.hold_fulfillment_policy %]
1324
                                [% SET bookings_lead_period = all_rules.$c.$it.bookings_lead_period %]
1325
                                [% SET bookings_trail_period = all_rules.$c.$it.bookings_trail_period %]
1312
                                [% SET returnbranch = all_rules.$c.$it.returnbranch %]
1326
                                [% SET returnbranch = all_rules.$c.$it.returnbranch %]
1313
1327
1314
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1328
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch || bookings_lead_period || bookings_trail_period %]
1315
                                    <tr>
1329
                                    <tr>
1316
                                        <td>
1330
                                        <td>
1317
                                            [% i.translated_description | html %]
1331
                                            [% i.translated_description | html %]
Lines 1340-1345 Link Here
1340
                                                <span>item's holding library</span>
1354
                                                <span>item's holding library</span>
1341
                                            [% END %]
1355
                                            [% END %]
1342
                                        </td>
1356
                                        </td>
1357
                                        <td>
1358
                                            <span>[% bookings_lead_period | html %]</span>
1359
                                        </td>
1360
                                        <td>
1361
                                            <span>[% bookings_trail_period | html %]</span>
1362
                                        </td>
1343
                                        <td>
1363
                                        <td>
1344
                                            [% IF returnbranch == 'homebranch' %]
1364
                                            [% IF returnbranch == 'homebranch' %]
1345
                                                <span>Item returns home</span>
1365
                                                <span>Item returns home</span>
Lines 1396-1401 Link Here
1396
                                        </option>
1416
                                        </option>
1397
                                    </select>
1417
                                    </select>
1398
                                </td>
1418
                                </td>
1419
                                <td>
1420
                                    <input type="text" name="bookings_lead_period" class="bookinglead" size="3" value="[% bookings_lead_period | html %]">
1421
                                </td>
1422
                                <td>
1423
                                    <input type="text" name="bookings_trail_period" class="bookingtrail" size="3" value="[% bookings_trail_period | html %]">
1424
                                </td>
1399
                                <td>
1425
                                <td>
1400
                                    <select name="returnbranch">
1426
                                    <select name="returnbranch">
1401
                                        <option value="homebranch">Item returns home</option>
1427
                                        <option value="homebranch">Item returns home</option>
1402
- 

Return to bug 34440