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

(-)a/installer/data/mysql/atomicupdate/bug_36453.pl (+59 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "36453",
5
    description => "BlockExpiredPatronOpacActions should allow multiple actions options",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        my ($BlockExpiredPatronOpacActions) = $dbh->selectrow_array(
11
            q{
12
            SELECT value FROM systempreferences WHERE variable = 'BlockExpiredPatronOpacActions';
13
        }
14
        );
15
16
        if ( $BlockExpiredPatronOpacActions eq 1 ) {
17
18
            # Update system preference settings if 1
19
            $dbh->do(
20
                "UPDATE systempreferences SET value='hold,renew' WHERE variable='BlockExpiredPatronOpacActions' and value=1"
21
            );
22
            say $out "BlockExpiredPatronOpacActions system preference value updated to 'hold,renew'.";
23
        } elsif ( $BlockExpiredPatronOpacActions eq 0 ) {
24
25
            # Update system preference settings if 0
26
            $dbh->do(
27
                "UPDATE systempreferences SET value='' WHERE variable='BlockExpiredPatronOpacActions' and value=0");
28
            say $out "BlockExpiredPatronOpacActions system preference value updated to empty string.";
29
        }
30
31
        # Update system preference setting to multiple instead of YesNo
32
        $dbh->do("UPDATE systempreferences SET type='multiple' WHERE variable='BlockExpiredPatronOpacActions'");
33
        say $out "BlockExpiredPatronOpacActions system preference value updated to multiple.";
34
35
        # Update categories database table BlockExpiredPatronOpacActions column settings
36
        $dbh->do(
37
            "ALTER TABLE categories MODIFY BlockExpiredPatronOpacActions mediumtext NOT NULL DEFAULT 'follow_syspref_BlockExpiredPatronOpacActions' COMMENT 'specific actions expired patrons of this category are blocked from performing or if the BlockExpiredPatronOpacActions system preference is to be followed'"
38
        );
39
        say $out "categories column BlockExpiredPatronOpacActions updated.";
40
41
        # Update patron categories using -1
42
        $dbh->do(
43
            "UPDATE categories SET BlockExpiredPatronOpacActions = 'follow_syspref_BlockExpiredPatronOpacActions' WHERE BlockExpiredPatronOpacActions = '-1'"
44
        );
45
        say $out
46
            "Patron categories BlockExpiredPatronOpacActions = -1 have been updated to follow the syspref BlockExpiredPatronOpacActions.";
47
48
        # Update patron categories using 0
49
        $dbh->do("UPDATE categories SET BlockExpiredPatronOpacActions = '' WHERE BlockExpiredPatronOpacActions = '0'");
50
        say $out "Patron categories BlockExpiredPatronOpacActions = 0 have been updated to an empty string ('').";
51
52
        # Update patron categories using 1
53
        $dbh->do(
54
            "UPDATE categories SET BlockExpiredPatronOpacActions = 'hold,renew' WHERE BlockExpiredPatronOpacActions = '1' "
55
        );
56
        say $out "Patron categories BlockExpiredPatronOpacActions = 1 have been updated to hold,renew'.";
57
58
    },
59
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1796-1802 CREATE TABLE `categories` ( Link Here
1796
  `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1796
  `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1797
  `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1797
  `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1798
  `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1798
  `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1799
  `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT 'wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions',
1799
  `BlockExpiredPatronOpacActions` mediumtext NOT NULL DEFAULT 'follow_syspref_BlockExpiredPatronOpacActions' COMMENT 'specific actions expired patrons of this category are blocked from performing or if the BlockExpiredPatronOpacActions system preference is to be followed',
1800
  `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1800
  `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1801
  `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.',
1801
  `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.',
1802
  `can_place_ill_in_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests',
1802
  `can_place_ill_in_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests',
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-2 / +1 lines)
Lines 117-123 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
117
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
117
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
118
('BiblioItemtypeInfo','0','0','Control which itemtype info displays for biblio level itemtypes','YesNo'),
118
('BiblioItemtypeInfo','0','0','Control which itemtype info displays for biblio level itemtypes','YesNo'),
119
('BibtexExportAdditionalFields',  '', NULL ,  'Define additional BibTex tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.',  'textarea'),
119
('BibtexExportAdditionalFields',  '', NULL ,  'Define additional BibTex tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.',  'textarea'),
120
('BlockExpiredPatronOpacActions','1',NULL,'Set whether an expired patron can perform opac actions such as placing holds or renew books, can be overridden on a per patron-type basis','YesNo'),
120
('BlockExpiredPatronOpacActions','','hold,renew','Specific actions expired patrons of this category are blocked from performing or if the BlockExpiredPatronOpacActions system preference is to be followed','multiple'),
121
('BlockReturnOfLostItems','0','0','If enabled, items that are marked as lost cannot be returned.','YesNo'),
121
('BlockReturnOfLostItems','0','0','If enabled, items that are marked as lost cannot be returned.','YesNo'),
122
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
122
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
123
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
123
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
124
- 

Return to bug 36453