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

(-)a/installer/data/mysql/atomicupdate/bug_36453.pl (-16 / +22 lines)
Lines 1-4 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
2
3
3
return {
4
return {
4
    bug_number  => "36453",
5
    bug_number  => "36453",
Lines 7-12 return { Link Here
7
        my ($args) = @_;
8
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
11
        # Update system preference setting to multiple instead of YesNo
12
        $dbh->do("UPDATE systempreferences SET type='multiple' WHERE variable='BlockExpiredPatronOpacActions'");
13
        say_success( $out, "BlockExpiredPatronOpacActions system preference type updated to multiple." );
14
10
        my ($BlockExpiredPatronOpacActions) = $dbh->selectrow_array(
15
        my ($BlockExpiredPatronOpacActions) = $dbh->selectrow_array(
11
            q{
16
            q{
12
            SELECT value FROM systempreferences WHERE variable = 'BlockExpiredPatronOpacActions';
17
            SELECT value FROM systempreferences WHERE variable = 'BlockExpiredPatronOpacActions';
Lines 19-59 return { Link Here
19
            $dbh->do(
24
            $dbh->do(
20
                "UPDATE systempreferences SET value='hold,renew' WHERE variable='BlockExpiredPatronOpacActions' and value=1"
25
                "UPDATE systempreferences SET value='hold,renew' WHERE variable='BlockExpiredPatronOpacActions' and value=1"
21
            );
26
            );
22
            say $out "BlockExpiredPatronOpacActions system preference value updated to 'hold,renew'.";
27
            say_info( $out, "BlockExpiredPatronOpacActions system preference value updated to 'hold,renew'." );
23
        } elsif ( $BlockExpiredPatronOpacActions eq 0 ) {
28
        } elsif ( $BlockExpiredPatronOpacActions eq 0 ) {
24
29
25
            # Update system preference settings if 0
30
            # Update system preference settings if 0
26
            $dbh->do(
31
            $dbh->do(
27
                "UPDATE systempreferences SET value='' WHERE variable='BlockExpiredPatronOpacActions' and value=0");
32
                "UPDATE systempreferences SET value='' WHERE variable='BlockExpiredPatronOpacActions' and value=0");
28
            say $out "BlockExpiredPatronOpacActions system preference value updated to empty string.";
33
            say_info( $out, "BlockExpiredPatronOpacActions system preference value updated to an empty string." );
29
        }
34
        }
30
35
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
        # Update categories database table BlockExpiredPatronOpacActions column settings
36
        $dbh->do(
37
        $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
            "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
        );
39
        say $out "categories column BlockExpiredPatronOpacActions updated.";
40
        say_success( $out, "Updated categories.BlockExpiredPatronOpacActions" );
40
41
41
        # Update patron categories using -1
42
        # Update patron categories using -1
42
        $dbh->do(
43
        $dbh->do(
43
            "UPDATE categories SET BlockExpiredPatronOpacActions = 'follow_syspref_BlockExpiredPatronOpacActions' WHERE BlockExpiredPatronOpacActions = '-1'"
44
            "UPDATE categories SET BlockExpiredPatronOpacActions = 'follow_syspref_BlockExpiredPatronOpacActions' WHERE BlockExpiredPatronOpacActions = '-1'"
44
        );
45
            ) >= 1
45
        say $out
46
            and say_info(
46
            "Patron categories BlockExpiredPatronOpacActions = -1 have been updated to follow the syspref BlockExpiredPatronOpacActions.";
47
            $out,
48
            "Patron categories BlockExpiredPatronOpacActions = -1 have been updated to follow the syspref BlockExpiredPatronOpacActions."
49
            );
47
50
48
        # Update patron categories using 0
51
        # Update patron categories using 0
49
        $dbh->do("UPDATE categories SET BlockExpiredPatronOpacActions = '' WHERE BlockExpiredPatronOpacActions = '0'");
52
        $dbh->do("UPDATE categories SET BlockExpiredPatronOpacActions = '' WHERE BlockExpiredPatronOpacActions = '0'")
50
        say $out "Patron categories BlockExpiredPatronOpacActions = 0 have been updated to an empty string ('').";
53
            >= 1
54
            and say_info(
55
            $out,
56
            "Patron categories BlockExpiredPatronOpacActions = 0 have been updated to an empty string ('')."
57
            );
51
58
52
        # Update patron categories using 1
59
        # Update patron categories using 1
53
        $dbh->do(
60
        $dbh->do(
54
            "UPDATE categories SET BlockExpiredPatronOpacActions = 'hold,renew' WHERE BlockExpiredPatronOpacActions = '1' "
61
            "UPDATE categories SET BlockExpiredPatronOpacActions = 'hold,renew' WHERE BlockExpiredPatronOpacActions = '1' "
55
        );
62
            ) >= 1
56
        say $out "Patron categories BlockExpiredPatronOpacActions = 1 have been updated to hold,renew'.";
63
            and
57
64
            say_info( $out, "Patron categories BlockExpiredPatronOpacActions = 1 have been updated to hold,renew'." );
58
    },
65
    },
59
};
66
};
60
- 

Return to bug 36453