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 1585-1590 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1585
  `login_attempts` int(4) default 0, -- number of failed login attemps
1586
  `login_attempts` int(4) default 0, -- number of failed login attemps
1586
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1587
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1587
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1588
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1589
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1588
  UNIQUE KEY `cardnumber` (`cardnumber`),
1590
  UNIQUE KEY `cardnumber` (`cardnumber`),
1589
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1591
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1590
  KEY `categorycode` (`categorycode`),
1592
  KEY `categorycode` (`categorycode`),
Lines 3470-3475 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3470
  `privacy` int(11) DEFAULT NULL,
3472
  `privacy` int(11) DEFAULT NULL,
3471
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3473
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3472
  `gdpr_proc_consent` datetime, -- data processing consent
3474
  `gdpr_proc_consent` datetime, -- data processing consent
3475
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
3473
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3476
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3474
  KEY `verification_token` (`verification_token` (191)),
3477
  KEY `verification_token` (`verification_token` (191)),
3475
  KEY `borrowernumber` (`borrowernumber`)
3478
  KEY `borrowernumber` (`borrowernumber`)
3476
- 

Return to bug 24476