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

(-)a/installer/data/mysql/atomicupdate/bug_25560-amend_UpdateNotForLoanStatusOnCheckin_syspref.pl (+46 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "25560",
5
    description =>
6
      "Migrating existing UpdateNotForLoanStatusOnCheckin rules to new format",
7
    up => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        my ($UpdateNotForLoanStatusOnCheckin) = $dbh->selectrow_array(
12
            q|
13
           SELECT value FROM systempreferences WHERE variable='UpdateNotForLoanStatusOnCheckin' 
14
       |
15
        );
16
17
        my ($sth) = $dbh->prepare(
18
            q|
19
           SELECT itemtype FROM itemtypes
20
       |
21
        );
22
        $sth->execute();
23
24
        my ( $new_rules, $fixed_rules );
25
        if ( $UpdateNotForLoanStatusOnCheckin && $UpdateNotForLoanStatusOnCheckin !~ /[0-9a-zA-Z]:\r/ ) {
26
27
            # Split and re-format the existing rules under each item type
28
            my @rules = split /\r/, $UpdateNotForLoanStatusOnCheckin;
29
            foreach my $rule (@rules) {
30
                $rule =~ s/^\s+|\s+$|\r|\n//g;
31
                $new_rules .= ' ' . $rule . "\r";
32
            }
33
            while ( my $itype = $sth->fetchrow_hashref ) {
34
                $fixed_rules .= "$itype->{itemtype}:\r$new_rules\r";
35
            }
36
            $dbh->do(
37
                qq{
38
               UPDATE systempreferences 
39
               SET value = '$fixed_rules', explanation = "This is a list of item types and value pairs.\nExamples:\nBK:\n -1: 0\n\nCR:\n 1: 0\n\nWhen an item is checked in, if its item type matches BK then when the not for loan value on the left ('Ordered') matches the items not for loan value it will be updated to the right-hand value (available for loan).\nA similar process happens if the returned items' item type matches CR. Except this time when the not for loan value on the left ('Not for loan') matches the items not for loan value then it will be updated to the right-hand value (available for loan).\nIf the item returned does not match BK or CR then the item will not be updated, irrespective of the current items not for loan value.\nThe item type needs to be defined on a separate line on the left side of the colon (:).\nEach pair of values, for that item type, should be listed on separate lines below the item type, each indented by a leading space."
40
               WHERE variable = 'UpdateNotForLoanStatusOnCheckin'
41
           }
42
            );
43
        }
44
    },
45
};
46
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-2 / +1 lines)
Lines 720-726 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
720
('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'),
720
('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'),
721
('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
721
('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
722
('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'),
722
('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'),
723
('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'),
723
('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of item types and value pairs.\nExamples:\nBK:\n -1: 0\n\nCR:\n 1: 0\n\nWhen an item is checked in, if its item type matches BK then when the not for loan value on the left (''Ordered'') matches the items not for loan value it will be updated to the right-hand value (available for loan).\nA similar process happens if the returned items'' item type matches CR. Except this time when the not for loan value on the left (''Not for loan'') matches the items not for loan value then it will be updated to the right-hand value (available for loan).\nIf the item returned does not match BK or CR then the item will not be updated, irrespective of the current items not for loan value.\nThe item type needs to be defined on a separate line on the left side of the colon (:).\nEach pair of values, for that item type, should be listed on separate lines below the item type, each indented by a leading space.', 'Free'),
724
('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'),
724
('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'),
725
('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'),
725
('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'),
726
('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'),
726
('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'),
727
- 

Return to bug 25560