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

(-)a/installer/data/mysql/kohastructure.sql (-1 / +20 lines)
Lines 1321-1327 CREATE TABLE `letter` ( -- table for all notice templates in Koha Link Here
1321
  `is_html` tinyint(1) default 0, -- does this notice or slip use HTML (1 for yes, 0 for no)
1321
  `is_html` tinyint(1) default 0, -- does this notice or slip use HTML (1 for yes, 0 for no)
1322
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1322
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1323
  `content` text, -- body text for the notice or slip
1323
  `content` text, -- body text for the notice or slip
1324
  PRIMARY KEY  (`module`,`code`, `branchcode`)
1324
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice
1325
  PRIMARY KEY  (`module`,`code`, `branchcode`, `message_transport_type`),
1326
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`)
1327
  REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
1325
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1328
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1326
1329
1327
--
1330
--
Lines 2486-2491 CREATE TABLE `message_transport_types` ( Link Here
2486
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2489
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2487
2490
2488
--
2491
--
2492
-- Table structure for table `overduerules_transport_types`
2493
--
2494
2495
DROP TABLE IF EXISTS `overduerules_transport_types`;
2496
CREATE TABLE overduerules_transport_types(
2497
    `id` INT(11) NOT NULL AUTO_INCREMENT,
2498
    `branchcode` varchar(10) NOT NULL DEFAULT '',
2499
    `categorycode` VARCHAR(10) NOT NULL DEFAULT '',
2500
    `letternumber` INT(1) NOT NULL DEFAULT 1,
2501
    `message_transport_type` VARCHAR(20) NOT NULL DEFAULT 'email',
2502
    PRIMARY KEY (id),
2503
    CONSTRAINT overduerules_fk FOREIGN KEY (branchcode, categorycode) REFERENCES overduerules (branchcode, categorycode) ON DELETE CASCADE ON UPDATE CASCADE,
2504
    CONSTRAINT mtt_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types (message_transport_type) ON DELETE CASCADE ON UPDATE CASCADE
2505
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2506
2507
--
2489
-- Table structure for table `message_attributes`
2508
-- Table structure for table `message_attributes`
2490
--
2509
--
2491
2510
(-)a/installer/data/mysql/updatedatabase.pl (-2 / +60 lines)
Lines 6396-6402 if ( CheckVersion($DBversion) ) { Link Here
6396
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');");
6396
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');");
6397
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');");
6397
    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');");
6398
    print "Upgrade to $DBversion done (Add IDreamBooks enhanced content)\n";
6398
    print "Upgrade to $DBversion done (Add IDreamBooks enhanced content)\n";
6399
    SetVersion($DBversion);
6399
   SetVersion ($DBversion);
6400
}
6400
}
6401
6401
6402
$DBversion = "3.11.00.018";
6402
$DBversion = "3.11.00.018";
Lines 7067-7072 if ( CheckVersion($DBversion) ) { Link Here
7067
    SetVersion($DBversion);
7067
    SetVersion($DBversion);
7068
}
7068
}
7069
7069
7070
7071
7072
7073
7074
7075
7076
7077
$DBversion = "3.13.00.XXX";
7078
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7079
7080
    $dbh->do( q{
7081
        ALTER TABLE letter ADD COLUMN message_transport_type VARCHAR(20) NOT NULL DEFAULT 'email' AFTER content
7082
    } );
7083
7084
    $dbh->do( q{
7085
        ALTER TABLE letter ADD CONSTRAINT message_transport_type_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types(message_transport_type);
7086
    } );
7087
7088
    $dbh->do( q{
7089
        ALTER TABLE letter DROP PRIMARY KEY, ADD PRIMARY KEY (`module`,`code`,`branchcode`, message_transport_type);
7090
    } );
7091
7092
    $dbh->do( q{
7093
        CREATE TABLE overduerules_transport_types(
7094
            id INT(11) NOT NULL AUTO_INCREMENT,
7095
            branchcode varchar(10) NOT NULL DEFAULT '',
7096
            categorycode VARCHAR(10) NOT NULL DEFAULT '',
7097
            letternumber INT(1) NOT NULL DEFAULT 1,
7098
            message_transport_type VARCHAR(20) NOT NULL DEFAULT 'email',
7099
            PRIMARY KEY (id),
7100
            CONSTRAINT overduerules_fk FOREIGN KEY (branchcode, categorycode) REFERENCES overduerules (branchcode, categorycode) ON DELETE CASCADE ON UPDATE CASCADE,
7101
            CONSTRAINT mtt_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types (message_transport_type) ON DELETE CASCADE ON UPDATE CASCADE
7102
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
7103
    } );
7104
7105
    my $sth = $dbh->prepare( q{
7106
        SELECT * FROM overduerules;
7107
    } );
7108
7109
    $sth->execute;
7110
    my $sth_insert_mtt = $dbh->prepare( q{
7111
        INSERT INTO overduerules_transport_types (branchcode, categorycode, letternumber, message_transport_type) VALUES ( ?, ?, ?, ? )
7112
    } );
7113
    while ( my $row = $sth->fetchrow_hashref ) {
7114
        my $branchcode = $row->{branchcode};
7115
        my $categorycode = $row->{categorycode};
7116
        for my $letternumber ( 1 .. 3 ) {
7117
            next unless $row->{"letter$letternumber"};
7118
            $sth_insert_mtt->execute(
7119
                $branchcode, $categorycode, $letternumber, 'email'
7120
            );
7121
        }
7122
    }
7123
7124
    print "Upgrade done (Bug 9016: Adds the association table overduerules_transport_types)\n";
7125
    SetVersion($DBversion);
7126
}
7127
7128
7070
=head1 FUNCTIONS
7129
=head1 FUNCTIONS
7071
7130
7072
=head2 TableExists($table)
7131
=head2 TableExists($table)
7073
- 

Return to bug 9016