Bug 24476: Rename autorenewal to autorenew_checkouts
[koha.git] / installer / data / mysql / atomicupdate / bug_24476_opt_out_of_auto_renewal.perl
1 $DBversion = 'XXX';
2 if( CheckVersion( $DBversion ) ) {
3     unless( column_exists('borrowers','autorenew_checkouts') ){
4         $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
5     }
6     unless( column_exists('deletedborrowers','autorenew_checkouts') ){
7         $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
8     }
9     unless( column_exists('borrower_modifications','autorenew_checkouts') ){
10         $dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
11     }
12     $dbh->do(q{
13         UPDATE systempreferences
14         SET value  = CONCAT(value,'|autorenew_checkouts')
15         WHERE variable IN
16         ('PatronSelfModificationBorrowerUnwantedField','PatronSelfRegistrationBorrowerUnwantedField')
17         AND value NOT LIKE '%autorenew_checkouts%'
18     });
19     SetVersion( $DBversion );
20     print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n";
21 }