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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 1738-1744 sub AddIssue { Link Here
1738
            $patron->update_lastseen('check_out');
1738
            $patron->update_lastseen('check_out');
1739
            if ( $item_object->location && $item_object->location eq 'CART'
1739
            if ( $item_object->location && $item_object->location eq 'CART'
1740
                && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) {
1740
                && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) {
1741
            ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart.
1741
            ## Item was moved to cart via automatic item modification on checkin, anything issued should be taken off the cart.
1742
                CartToShelf( $item_object->itemnumber );
1742
                CartToShelf( $item_object->itemnumber );
1743
            }
1743
            }
1744
1744
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-2 lines)
Lines 818-825 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
818
('UniqueItemFields','barcode','','Pipe-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table','Free'),
818
('UniqueItemFields','barcode','','Pipe-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table','Free'),
819
('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'),
819
('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'),
820
('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
820
('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
821
('UpdateItemLocationOnCheckin', '', 'NULL', 'This is a list of value pairs.\n Examples:\n\nPROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check in.\nFIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.\n_BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check in.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check in.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\n\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\n\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.\nThe special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free'),
822
('UpdateItemLocationOnCheckout', '', 'NULL', 'This is a list of value pairs.\n Examples:\n\nPROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check out.\nFIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check out.\n_BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check out.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check out.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check out.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\n\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\n\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.\nThe special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free'),
823
('UpdateItemLostStatusWhenPaid', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when paid for', 'Integer'),
821
('UpdateItemLostStatusWhenPaid', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when paid for', 'Integer'),
824
('UpdateItemLostStatusWhenWriteoff', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when written off', 'Integer'),
822
('UpdateItemLostStatusWhenWriteoff', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when written off', 'Integer'),
825
('UpdateItemWhenLostFromHoldList','',NULL,'This is a list of values to update an item when it is marked as lost from the holds to pull screen','Free'),
823
('UpdateItemWhenLostFromHoldList','',NULL,'This is a list of values to update an item when it is marked as lost from the holds to pull screen','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-35 lines)
Lines 524-546 Circulation: Link Here
524
            - "<br />itype: [NEWBK,\"\"]"
524
            - "<br />itype: [NEWBK,\"\"]"
525
            - "<br /><strong>NOTE:</strong> The word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field."
525
            - "<br /><strong>NOTE:</strong> The word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field."
526
            - "<br /><strong>Configuration:</strong> <a href='/cgi-bin/koha/admin/authorised_values.pl?searchfield=CCODE'>Collections (CCODE)</a> | <a href='/cgi-bin/koha/admin/itemtypes.pl'>Item types</a>"
526
            - "<br /><strong>Configuration:</strong> <a href='/cgi-bin/koha/admin/authorised_values.pl?searchfield=CCODE'>Collections (CCODE)</a> | <a href='/cgi-bin/koha/admin/itemtypes.pl'>Item types</a>"
527
        -
528
            - pref: UpdateItemLocationOnCheckout
529
              type: textarea
530
              syntax: text/x-yaml
531
              class: code
532
            - "This is a list of value pairs. The first value is followed immediately by colon space then the second value.<br/><br/>"
533
            - "Examples:<br/>"
534
            - "PROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check out.<br/>"
535
            - "FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check out.<br/>"
536
            - "_BLANK_: FIC - causes an item that has no location to be updated into the Fiction location on check out.<br/>"
537
            - "FIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check out.<br/>"
538
            - "_ALL_: FIC - causes all items to be updated into the Fiction location on check out.<br/>"
539
            - "PROC: _PERM_ - causes an item that is in the Processing Center to be updated to it's permanent location.<br/><br/>"
540
            - "General rule: if the location value on the left of the colon (:) matches the item's current location, it will be updated to match the location value on the right of the colon (:).<br/>"
541
            - "Note: PROC and CART are special values, for these locations the location and permanent_location can differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.<br/>"
542
            - "The special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.<br/>"
543
            - "The special term _ALL_ is used on the left side of the colon (:) to affect all items, <strong>and overrides all other rules.</strong>"
544
        -
527
        -
545
            - pref: UpdateNotForLoanStatusOnCheckout
528
            - pref: UpdateNotForLoanStatusOnCheckout
546
              type: textarea
529
              type: textarea
Lines 692-715 Circulation: Link Here
692
                  1: Do
675
                  1: Do
693
                  0: "Don't"
676
                  0: "Don't"
694
            - calculate and update overdue charges when an item is returned with a backdated return date.
677
            - calculate and update overdue charges when an item is returned with a backdated return date.
695
        -
696
            - pref: UpdateItemLocationOnCheckin
697
              type: textarea
698
              syntax: text/x-yaml
699
              class: code
700
            - "This is a list of value pairs. The first value is followed immediately by colon space then the second value."
701
            - "Valid values are <a href='/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOC'>LOC</a> authorised values, _BLANK_, _PERM_, and _ALL_.<br><br>"
702
            - "Examples:<br/>"
703
            - "PROC: FIC - causes an item in the Processing center location to be updated into the Fiction location on check in.<br/>"
704
            - "FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.<br/>"
705
            - "_BLANK_: FIC - causes an item that has no location to be updated into the Fiction location on check in.<br/>"
706
            - "FIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.<br/>"
707
            - "_ALL_: FIC - causes all items to be updated into the Fiction location on check in.<br/>"
708
            - "PROC: _PERM_ - causes an item that is in the Processing center to be updated to it's permanent location.<br/><br/>"
709
            - "General rule: if the location value on the left of the colon (:) matches the item's current location, it will be updated to match the location value on the right of the colon (:).<br/>"
710
            - "Note: PROC and CART are special values, for these locations the location and permanent_location can differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.<br/>"
711
            - "The special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.<br/>"
712
            - "The special term _ALL_ is used on the left side of the colon (:) to affect all items, <strong>and overrides all other rules.</strong>"
713
        -
678
        -
714
            - pref: UpdateNotForLoanStatusOnCheckin
679
            - pref: UpdateNotForLoanStatusOnCheckin
715
              type: textarea
680
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-27 lines)
Lines 319-351 if (search_jumped) { Link Here
319
    document.location.hash = "jumped";
319
    document.location.hash = "jumped";
320
}
320
}
321
321
322
$(
323
    "#pref_UpdateItemLocationOnCheckin, #pref_UpdateItemLocationOnCheckout"
324
).change(function () {
325
    var the_text = $(this).val();
326
    var alert_text = "";
327
    if (the_text.indexOf("_ALL_:") != -1)
328
        alert_text =
329
            __("Note: _ALL_ value will override all other values") + "\n";
330
    var split_text = the_text.split("\n");
331
    var alert_issues = "";
332
    var issue_count = 0;
333
    var reg_check = /.*:\s.*/;
334
    for (var i = 0; i < split_text.length; i++) {
335
        if (!split_text[i].match(reg_check) && split_text[i].length) {
336
            alert_issues += split_text[i] + "\n";
337
            issue_count++;
338
        }
339
    }
340
    if (issue_count)
341
        alert_text +=
342
            "\n" +
343
            __("The following values are not formatted correctly:") +
344
            "\n" +
345
            alert_issues;
346
    if (alert_text.length) alert(alert_text);
347
});
348
349
$(".prefs-tab form").each(function () {
322
$(".prefs-tab form").each(function () {
350
    $(this).validate({
323
    $(this).validate({
351
        rules: {},
324
        rules: {},
(-)a/t/db_dependent/Circulation/issue.t (-194 / +1 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 67;
20
use Test::More tests => 39;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 490-578 is( Link Here
490
    q{UpdateNotForLoanStatusOnCheckin does not update notforloan value for specific itemtype from 1 with setting "1: ONLYMESSAGE"}
490
    q{UpdateNotForLoanStatusOnCheckin does not update notforloan value for specific itemtype from 1 with setting "1: ONLYMESSAGE"}
491
);
491
);
492
492
493
my $itemnumber2 = Koha::Item->new(
494
    {
495
        biblionumber   => $biblionumber,
496
        barcode        => 'barcode_4',
497
        itemcallnumber => 'callnumber4',
498
        homebranch     => $branchcode_1,
499
        holdingbranch  => $branchcode_1,
500
        location       => 'FIC',
501
        itype          => $itemtype
502
    }
503
)->store->itemnumber;
504
505
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} );
506
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin',  q{} );
507
508
AddReturn( 'barcode_4', $branchcode_1 );
509
my $item2 = Koha::Items->find( $itemnumber2 );
510
ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
511
512
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
513
$log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
514
AddReturn( 'barcode_4', $branchcode_1 );
515
$item2 = Koha::Items->find( $itemnumber2 );
516
is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
517
is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
518
$log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
519
is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckin is not logged");
520
AddReturn( 'barcode_4', $branchcode_1 );
521
$item2 = Koha::Items->find( $itemnumber2 );
522
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
523
524
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
525
AddReturn( 'barcode_4', $branchcode_1 );
526
$item2 = Koha::Items->find( $itemnumber2 );
527
ok( $item2->location eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} );
528
Koha::Item::Transfer->new({
529
    itemnumber => $itemnumber2,
530
    frombranch => $branchcode_2,
531
    tobranch => $branchcode_1,
532
    datesent => '2020-01-01'
533
})->store;
534
AddReturn( 'barcode_4', $branchcode_1 );
535
$item2 = Koha::Items->find( $itemnumber2 );
536
ok( $item2->location eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART" when transfer filled} );
537
538
ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} );
539
AddIssue( $patron_1, 'barcode_4', $daysago10,0, $today, '' );
540
$item2 = Koha::Items->find( $itemnumber2 );
541
ok( $item2->location eq 'GEN', q{Location updates from 'CART' to permanent location on issue} );
542
543
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
544
AddReturn( 'barcode_4', $branchcode_1 );
545
$item2 = Koha::Items->find( $itemnumber2 );
546
ok( $item2->location eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} );
547
AddReturn( 'barcode_4', $branchcode_1 );
548
$item2 = Koha::Items->find( $itemnumber2 );
549
ok( $item2->location eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
550
ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
551
AddReturn( 'barcode_4', $branchcode_1 );
552
$item2 = Koha::Items->find( $itemnumber2 );
553
ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
554
ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
555
556
# Bug 28472
557
my $itemnumber3 = Koha::Item->new(
558
    {
559
        biblionumber   => $biblionumber,
560
        barcode        => 'barcode_5',
561
        itemcallnumber => 'callnumber5',
562
        homebranch     => $branchcode_1,
563
        holdingbranch  => $branchcode_1,
564
        location       => undef,
565
        itype          => $itemtype
566
    }
567
)->store->itemnumber;
568
569
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
570
AddReturn( 'barcode_5', $branchcode_1 );
571
my $item3 = Koha::Items->find( $itemnumber3 );
572
is( $item3->location, 'CART', q{UpdateItemLocationOnCheckin updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} );
573
574
575
576
# Bug 14640 - Cancel the hold on checking out if asked
493
# Bug 14640 - Cancel the hold on checking out if asked
577
Koha::Items->find({ barcode => $barcode_1 })->notforloan('0')->store;
494
Koha::Items->find({ barcode => $barcode_1 })->notforloan('0')->store;
578
my $reserve_id = AddReserve(
495
my $reserve_id = AddReserve(
Lines 665-778 AddReturn( 'barcode_6', $branchcode_1 ); Link Here
665
$item = Koha::Items->find( $itemnumber4 );
582
$item = Koha::Items->find( $itemnumber4 );
666
ok( $item->notforloan eq 0, q{UpdateNotForLoanStatusOnCheckout does not update notforloan value from 0 with setting "-1: 0"} );
583
ok( $item->notforloan eq 0, q{UpdateNotForLoanStatusOnCheckout does not update notforloan value from 0 with setting "-1: 0"} );
667
584
668
# Bug 21159 - Update item shelving location on checkout
669
my $itemnumber5 = Koha::Item->new(
670
    {
671
        biblionumber   => $biblionumber,
672
        barcode        => 'barcode_7',
673
        itemcallnumber => 'callnumber3',
674
        homebranch     => $branchcode_1,
675
        holdingbranch  => $branchcode_1,
676
        location       => 'FIC',
677
        itype          => $itemtype
678
    },
679
)->store->itemnumber;
680
681
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} );
682
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin',  q{} );
683
AddIssue( $patron_1, 'barcode_7' );
684
my $item5 = Koha::Items->find($itemnumber5);
685
ok( $item5->location eq 'FIC', 'UpdateItemLocationOnCheckout does not modify value when not enabled' );
686
687
#---
688
AddReturn( 'barcode_7', $branchcode_1 );
689
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', 'FIC: GEN' );
690
$log_count_before = $schema->resultset('ActionLog')->search( { module => 'CATALOGUING' } )->count();
691
AddIssue( $patron_1, 'barcode_7' );
692
$item5 = Koha::Items->find($itemnumber5);
693
is(
694
    $item5->location, 'GEN',
695
    q{UpdateItemLocationOnCheckout updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"}
696
);
697
is(
698
    $item5->permanent_location, 'GEN',
699
    q{UpdateItemLocationOnCheckout updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"}
700
);
701
$log_count_after = $schema->resultset('ActionLog')->search( { module => 'CATALOGUING' } )->count();
702
is( $log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckout is not logged" );
703
AddReturn( 'barcode_7', $branchcode_1 );
704
AddIssue( $patron_1, 'barcode_7' );
705
$item5 = Koha::Items->find($itemnumber5);
706
ok(
707
    $item5->location eq 'GEN',
708
    q{UpdateItemLocationOnCheckout does not update location value from 'GEN' with setting "FIC: GEN"}
709
);
710
711
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' );
712
AddReturn( 'barcode_7', $branchcode_1 );
713
AddIssue( $patron_1, 'barcode_7' );
714
$item5 = Koha::Items->find($itemnumber5);
715
ok(
716
    $item5->location eq 'CART',
717
    q{UpdateItemLocationOnCheckout updates location value from 'GEN' with setting "_ALL_: CART"}
718
);
719
ok(
720
    $item5->permanent_location eq 'GEN',
721
    q{UpdateItemLocationOnCheckout does not update permanent_location value from 'GEN' with setting "_ALL_: CART"}
722
);
723
724
$item5->location('GEN')->store;
725
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
726
AddReturn( 'barcode_7', $branchcode_1 );
727
AddIssue( $patron_1, 'barcode_7' );
728
$item5 = Koha::Items->find($itemnumber5);
729
ok(
730
    $item5->location eq '',
731
    q{UpdateItemLocationOnCheckout updates location value from 'GEN' to '' with setting "GEN: _BLANK_"}
732
);
733
AddReturn( 'barcode_7', $branchcode_1 );
734
AddIssue( $patron_1, 'barcode_7' );
735
$item5 = Koha::Items->find($itemnumber5);
736
ok(
737
    $item5->location eq 'PROC',
738
    q{UpdateItemLocationOnCheckout updates location value from '' to 'PROC' with setting "_BLANK_: PROC"}
739
);
740
ok(
741
    $item5->permanent_location eq '',
742
    q{UpdateItemLocationOnCheckout does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"}
743
);
744
AddReturn( 'barcode_7', $branchcode_1 );
745
AddIssue( $patron_1, 'barcode_7' );
746
$item5 = Koha::Items->find($itemnumber5);
747
ok(
748
    $item5->location eq '',
749
    q{UpdateItemLocationOnCheckout updates location value from 'PROC' to '' with setting "PROC: _PERM_" }
750
);
751
ok(
752
    $item5->permanent_location eq '',
753
    q{UpdateItemLocationOnCheckout does not update permanent_location from '' with setting "PROC: _PERM_" }
754
);
755
756
# Bug 28472
757
my $itemnumber6 = Koha::Item->new(
758
    {
759
        biblionumber   => $biblionumber,
760
        barcode        => 'barcode_8',
761
        itemcallnumber => 'callnumber5',
762
        homebranch     => $branchcode_1,
763
        holdingbranch  => $branchcode_1,
764
        location       => undef,
765
        itype          => $itemtype
766
    }
767
)->store->itemnumber;
768
769
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' );
770
AddIssue( $patron_1, 'barcode_8' );
771
my $item6 = Koha::Items->find($itemnumber6);
772
is(
773
    $item6->location, 'CART',
774
    q{UpdateItemLocationOnCheckout updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"}
775
);
776
777
#End transaction
585
#End transaction
778
$schema->storage->txn_rollback;
586
$schema->storage->txn_rollback;
779
- 

Return to bug 38387