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

(-)a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl (+21 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    unless( column_exists('borrowers','autorenewal') ){
4
        $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
5
    }
6
    unless( column_exists('deletedborrowers','autorenewal') ){
7
        $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
8
    }
9
    unless( column_exists('borrower_modifications','autorenewal') ){
10
        $dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
11
    }
12
    $dbh->do(q{
13
        UPDATE systempreferences
14
        SET value  = CONCAT(value,'|autorenewal')
15
        WHERE variable IN
16
        ('PatronSelfModificationBorrowerUnwantedField','PatronSelfRegistrationBorrowerUnwantedField')
17
        AND value NOT LIKE '%autorenewal%'
18
    });
19
    SetVersion( $DBversion );
20
    print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n";
21
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 590-595 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
590
  `login_attempts` int(4) default 0, -- number of failed login attemps
590
  `login_attempts` int(4) default 0, -- number of failed login attemps
591
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
591
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
592
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
592
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
593
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
593
  KEY borrowernumber (borrowernumber),
594
  KEY borrowernumber (borrowernumber),
594
  KEY `cardnumber` (`cardnumber`),
595
  KEY `cardnumber` (`cardnumber`),
595
  KEY `sms_provider_id` (`sms_provider_id`)
596
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1544-1549 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1544
  `login_attempts` int(4) default 0, -- number of failed login attemps
1545
  `login_attempts` int(4) default 0, -- number of failed login attemps
1545
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1546
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1546
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1547
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1548
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1547
  UNIQUE KEY `cardnumber` (`cardnumber`),
1549
  UNIQUE KEY `cardnumber` (`cardnumber`),
1548
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1550
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1549
  KEY `categorycode` (`categorycode`),
1551
  KEY `categorycode` (`categorycode`),
Lines 3432-3437 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3432
  `privacy` int(11) DEFAULT NULL,
3434
  `privacy` int(11) DEFAULT NULL,
3433
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3435
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3434
  `gdpr_proc_consent` datetime, -- data processing consent
3436
  `gdpr_proc_consent` datetime, -- data processing consent
3437
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
3435
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3438
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3436
  KEY `verification_token` (`verification_token` (191)),
3439
  KEY `verification_token` (`verification_token` (191)),
3437
  KEY `borrowernumber` (`borrowernumber`)
3440
  KEY `borrowernumber` (`borrowernumber`)
3438
- 

Return to bug 24476