Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-12-08 10:16:29 +00:00 committed by Kyle M Hall
parent 2dc81eb9a1
commit 613c6508f0
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,15 @@
$DBversion = 'XXX';
if( CheckVersion( $DBversion ) ) {
if( !column_exists( 'letter', 'lang' ) ) {
$dbh->do( "ALTER TABLE letter ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER message_transport_type" );
}
if( !column_exists( 'borrowers', 'lang' ) ) {
$dbh->do( "ALTER TABLE borrowers ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER lastseen" );
$dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER lastseen" );
}
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug XXXXX - Add columns letter.lang and borrowers.lang to allow translation of notices)\n";
}

View file

@ -634,6 +634,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower
`checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'.
`updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others)
`lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface)
`lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
`overdrive_auth_token` text default NULL, -- persist OverDrive auth token
KEY borrowernumber (borrowernumber),
KEY `cardnumber` (`cardnumber`),
@ -1668,6 +1669,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
`checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'.
`updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others)
`lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface)
`lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
`overdrive_auth_token` text default NULL, -- persist OverDrive auth token
UNIQUE KEY `cardnumber` (`cardnumber`),
PRIMARY KEY `borrowernumber` (`borrowernumber`),
@ -2543,6 +2545,7 @@ CREATE TABLE `letter` ( -- table for all notice templates in Koha
`title` varchar(200) NOT NULL default '', -- subject line of the notice
`content` text, -- body text for the notice or slip
`message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice
`lang` varchar(25) NOT NULL DEFAULT 'default', -- lang of the notice
PRIMARY KEY (`module`,`code`, `branchcode`, `message_transport_type`),
CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`)
REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE