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

(-)a/installer/data/mysql/atomicupdate/bug_26355-patron_self_renewal.pl (+78 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "26355",
6
    description => "Patron self-renewal",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        unless ( column_exists( 'categories', 'self_renewal_enabled' ) ) {
12
            $dbh->do(
13
                q{
14
                ALTER TABLE categories ADD COLUMN `self_renewal_enabled` tinyint(1) NOT NULL DEFAULT 0
15
                COMMENT 'allow self renewal for this category'
16
                AFTER `enforce_expiry_notice`
17
                }
18
            );
19
20
            say_success( $out, "Added column 'self_renewal_enabled' to categories" );
21
        }
22
        unless ( column_exists( 'categories', 'self_renewal_availability_start' ) ) {
23
            $dbh->do(
24
                q{
25
                ALTER TABLE categories ADD COLUMN `self_renewal_availability_start` smallint(6) DEFAULT NULL
26
                COMMENT 'how long before the patron expiry date self-renewal should be made available (overrides system default of NotifyBorrowerDeparture)'
27
                AFTER `self_renewal_enabled`
28
                }
29
            );
30
31
            say_success( $out, "Added column 'self_renewal_availability_start' to categories" );
32
        }
33
        unless ( column_exists( 'categories', 'self_renewal_fines_block' ) ) {
34
            $dbh->do(
35
                q{
36
                ALTER TABLE categories ADD COLUMN `self_renewal_fines_block` int(11) DEFAULT NULL
37
                COMMENT 'the amount owed in fines before self renewal is blocked (overrides system default of noissuescharge)'
38
                AFTER `self_renewal_availability_start`
39
                }
40
            );
41
42
            say_success( $out, "Added column 'self_renewal_fines_block' to categories" );
43
        }
44
        unless ( column_exists( 'categories', 'self_renewal_if_expired' ) ) {
45
            $dbh->do(
46
                q{
47
                ALTER TABLE categories ADD COLUMN `self_renewal_if_expired` smallint(6) DEFAULT 0
48
                COMMENT 'how long after expiry a patron can self renew their account'
49
                AFTER `self_renewal_fines_block`
50
                }
51
            );
52
53
            say_success( $out, "Added column 'self_renewal_if_expired' to categories" );
54
        }
55
        unless ( column_exists( 'categories', 'self_renewal_failure_message' ) ) {
56
            $dbh->do(
57
                q{
58
                ALTER TABLE categories ADD COLUMN `self_renewal_failure_message` mediumtext DEFAULT NULL
59
                COMMENT 'the message to display if self renewal is not successful'
60
                AFTER `self_renewal_fines_block`
61
                }
62
            );
63
64
            say_success( $out, "Added column 'self_renewal_failure_message' to categories" );
65
        }
66
        unless ( column_exists( 'borrower_attribute_types', 'self_renewal_verification_check' ) ) {
67
            $dbh->do(
68
                q{
69
                ALTER TABLE borrower_attribute_types ADD COLUMN `self_renewal_verification_check` tinyint(1) NOT NULL DEFAULT 0
70
                COMMENT 'use this attribute as a verification step for patron self-renewal'
71
                AFTER `opac_mandatory`
72
                }
73
            );
74
75
            say_success( $out, "Added column 'self_renewal_verification_check' to borrower_attribute_types" );
76
        }
77
    },
78
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +6 lines)
Lines 1267-1272 CREATE TABLE `borrower_attribute_types` ( Link Here
1267
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1267
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1268
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the staff interface',
1268
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the staff interface',
1269
  `opac_mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the OPAC',
1269
  `opac_mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the OPAC',
1270
  `self_renewal_verification_check` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'use this attribute as a verification step for patron self-renewal',
1270
  PRIMARY KEY (`code`),
1271
  PRIMARY KEY (`code`),
1271
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1272
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1272
  KEY `category_code` (`category_code`),
1273
  KEY `category_code` (`category_code`),
Lines 1828-1833 CREATE TABLE `categories` ( Link Here
1828
  `noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantees of a patron in this category can have outstanding before checkouts are blocked',
1829
  `noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantees of a patron in this category can have outstanding before checkouts are blocked',
1829
  `noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantors with guarantees of a patron in this category can have outstanding before checkouts are blocked',
1830
  `noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantors with guarantees of a patron in this category can have outstanding before checkouts are blocked',
1830
  `enforce_expiry_notice` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'enforce the patron expiry notice for this category',
1831
  `enforce_expiry_notice` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'enforce the patron expiry notice for this category',
1832
  `self_renewal_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'allow self renewal for this category',
1833
  `self_renewal_availability_start` smallint(6) DEFAULT NULL COMMENT 'how long before the patron expiry date self-renewal should be made available (overrides system default of NotifyBorrowerDeparture)',
1834
  `self_renewal_fines_block` int(11) DEFAULT NULL COMMENT 'the amount owed in fines before self renewal is blocked (overrides system default of noissuescharge)',
1835
  `self_renewal_if_expired` smallint(6) DEFAULT 0 COMMENT 'how long after expiry a patron can self renew their account',
1836
  `self_renewal_failure_message` mediumtext DEFAULT NULL COMMENT 'the message to display if self renewal is not successful',
1831
  PRIMARY KEY (`categorycode`),
1837
  PRIMARY KEY (`categorycode`),
1832
  UNIQUE KEY `categorycode` (`categorycode`)
1838
  UNIQUE KEY `categorycode` (`categorycode`)
1833
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1839
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1834
- 

Return to bug 26355