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

(-)a/C4/Circulation.pm (+19 lines)
Lines 1741-1746 sub AddIssue { Link Here
1741
                }
1741
                }
1742
            }
1742
            }
1743
1743
1744
            my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckout');
1745
            if ($yaml) {
1746
                $yaml = "$yaml\n\n";
1747
1748
                my $rules;
1749
                eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); };
1750
                if ($@) {
1751
                    warn "Unable to parse UpdateNotForLoanStatusOnCheckout syspref : $@";
1752
                }
1753
                else {
1754
                    foreach my $key ( keys %$rules ) {
1755
                        if ( $item_object->notforloan eq $key ) {
1756
                            $item_object->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1 });
1757
                            last;
1758
                        }
1759
                    }
1760
                }
1761
            }
1762
1744
            # Record the fact that this book was issued.
1763
            # Record the fact that this book was issued.
1745
            C4::Stats::UpdateStats(
1764
            C4::Stats::UpdateStats(
1746
                {
1765
                {
(-)a/installer/data/mysql/atomicupdate/bug_30403.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30403",
5
    description => "A single line description",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free')});
11
        # Print useful stuff here
12
        say $out "Update is going well so far";
13
    },
14
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 748-753 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
748
('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
748
('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
749
('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'),
749
('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'),
750
('UpdateNotForLoanStatusOnCheckin', '', 'NULL', "This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan. Can be used for showing only the not for loan description. E.g. '-1: ONLYMESSAGE'. Each pair of values should be on a separate line.", 'Free'),
750
('UpdateNotForLoanStatusOnCheckin', '', 'NULL', "This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan. Can be used for showing only the not for loan description. E.g. '-1: ONLYMESSAGE'. Each pair of values should be on a separate line.", 'Free'),
751
('UpdateNotForLoanStatusOnCheckout', '', 'NULL', 'This is a list of value pairs. When an item is checked out, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free'),
751
('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'),
752
('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'),
752
('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'),
753
('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'),
753
('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'),
754
('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 561-566 Circulation: Link Here
561
            - "<br />ccode: [NEWFIC,NULL,DVD]"
561
            - "<br />ccode: [NEWFIC,NULL,DVD]"
562
            - "<br />itype: [NEWBK,\"\"]"
562
            - "<br />itype: [NEWBK,\"\"]"
563
            - "<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."
563
            - "<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."
564
        -
565
            - pref: UpdateNotForLoanStatusOnCheckout
566
              type: textarea
567
              syntax: text/x-yaml
568
              class: code
569
            - This is a list of value pairs. When an item is checked out, if the not for loan value on the left matches the items not for loan value
570
            - "it will be updated to the right-hand value. For example, '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan."
571
            - Each pair of values should be on a separate line.
564
    Checkin policy:
572
    Checkin policy:
565
        -
573
        -
566
            - pref: TrapHoldsOnOrder
574
            - pref: TrapHoldsOnOrder
(-)a/t/db_dependent/Circulation/issue.t (-2 / +30 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 49;
20
use Test::More tests => 52;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 543-547 AddRenewal( $unseen_patron->borrowernumber, $unseen_item->itemnumber, $branchcod Link Here
543
my ( $unseen_reset ) = ( C4::Circulation::GetRenewCount( $unseen_patron->borrowernumber, $unseen_item->itemnumber ) )[3];
543
my ( $unseen_reset ) = ( C4::Circulation::GetRenewCount( $unseen_patron->borrowernumber, $unseen_item->itemnumber ) )[3];
544
is( $unseen_reset, 0, 'seen renewal resets the unseen count' );
544
is( $unseen_reset, 0, 'seen renewal resets the unseen count' );
545
545
546
my $itemnumber4 = Koha::Item->new(
547
    {
548
        biblionumber   => $biblionumber,
549
        barcode        => 'barcode_6',
550
        itemcallnumber => 'callnumber6',
551
        homebranch     => $branchcode_1,
552
        holdingbranch  => $branchcode_1,
553
        notforloan     => -1,
554
        itype          => $itemtype,
555
        location       => 'loc1'
556
    },
557
)->store->itemnumber;
558
559
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckout', q{} );
560
AddIssue( $borrower_2, 'barcode_6', dt_from_string );
561
my $item = Koha::Items->find( $itemnumber4 );
562
ok( $item->notforloan eq -1, 'UpdateNotForLoanStatusOnCheckout does not modify value when not enabled' );
563
564
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckout', '-1: 0' );
565
AddReturn( 'barcode_6', $branchcode_1 );
566
my $test = AddIssue( $borrower_2, 'barcode_6', dt_from_string );
567
$item = Koha::Items->find( $itemnumber4 );
568
ok( $item->notforloan eq 0, q{UpdateNotForLoanStatusOnCheckout updates notforloan value from -1 to 0 with setting "-1: 0"} );
569
570
AddIssue( $borrower_2, 'barcode_6', dt_from_string );
571
AddReturn( 'barcode_6', $branchcode_1 );
572
$item = Koha::Items->find( $itemnumber4 );
573
ok( $item->notforloan eq 0, q{UpdateNotForLoanStatusOnCheckout does not update notforloan value from 0 with setting "-1: 0"} );
574
546
#End transaction
575
#End transaction
547
$schema->storage->txn_rollback;
576
$schema->storage->txn_rollback;
548
- 

Return to bug 30403