Bug 42447: SIP template fields in the database are too small
The SIP fields in the database are too small for the templates of some configurations, and are truncated during upgrade resulting in invalid templates. It's likely we need more than 255 characters for some templates. We should convert all sip template fields to TEXT fields.
Test Plan:
1) For each template field on a sip account attempt to save a template like:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY
2) Note error preventing you from doing so
3) Apply this patch
4) Run updatedatabase.pl
5) Repeat step 1
6) Note you can now do so without error!
Signed-off-by: Charlie Arthur <carthur@slolibrary.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7693360a0f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
parent
d265afefb5
commit
5cce1eba34
|
|
@ -0,0 +1,37 @@
|
|||
use Modern::Perl;
|
||||
use Koha::Installer::Output qw(say_warning say_success say_info);
|
||||
|
||||
return {
|
||||
bug_number => "42447",
|
||||
description => "Convert SIP template fields to TEXT",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
$dbh->do(
|
||||
q{
|
||||
ALTER TABLE `sip_accounts`
|
||||
MODIFY COLUMN `ae_field_template` TEXT DEFAULT NULL,
|
||||
MODIFY COLUMN `av_field_template` TEXT DEFAULT NULL,
|
||||
MODIFY COLUMN `da_field_template` TEXT DEFAULT NULL
|
||||
}
|
||||
);
|
||||
say_success( $out, "Converted sip_accounts template columns to TEXT" );
|
||||
|
||||
$dbh->do(
|
||||
q{
|
||||
ALTER TABLE `sip_account_custom_item_fields`
|
||||
MODIFY COLUMN `template` TEXT NOT NULL COMMENT 'Template toolkit template'
|
||||
}
|
||||
);
|
||||
say_success( $out, "Converted sip_account_custom_item_fields.template to TEXT" );
|
||||
|
||||
$dbh->do(
|
||||
q{
|
||||
ALTER TABLE `sip_account_custom_patron_fields`
|
||||
MODIFY COLUMN `template` TEXT NOT NULL COMMENT 'Template toolkit template'
|
||||
}
|
||||
);
|
||||
say_success( $out, "Converted sip_account_custom_patron_fields.template to TEXT" );
|
||||
},
|
||||
};
|
||||
|
|
@ -6061,7 +6061,7 @@ CREATE TABLE `sip_account_custom_item_fields` (
|
|||
`sip_account_custom_item_field_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`sip_account_id` int(11) NOT NULL COMMENT 'Foreign key to sip_accounts.sip_account_id',
|
||||
`field` varchar(80) NOT NULL COMMENT 'SIP field name e.g. XY',
|
||||
`template` varchar(255) NOT NULL COMMENT 'Template toolkit template name',
|
||||
`template` text NOT NULL COMMENT 'Template toolkit template',
|
||||
PRIMARY KEY (`sip_account_custom_item_field_id`),
|
||||
UNIQUE KEY `sip_account` (`sip_account_custom_item_field_id`,`sip_account_id`),
|
||||
KEY `sip_account_custom_item_fields_ibfk_1` (`sip_account_id`),
|
||||
|
|
@ -6080,7 +6080,7 @@ CREATE TABLE `sip_account_custom_patron_fields` (
|
|||
`sip_account_custom_patron_field_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`sip_account_id` int(11) NOT NULL COMMENT 'Foreign key to sip_accounts.sip_account_id',
|
||||
`field` varchar(80) NOT NULL COMMENT 'SIP field name e.g. XY',
|
||||
`template` varchar(80) NOT NULL COMMENT 'Template toolkit template',
|
||||
`template` text NOT NULL COMMENT 'Template toolkit template',
|
||||
PRIMARY KEY (`sip_account_custom_patron_field_id`),
|
||||
UNIQUE KEY `sip_account` (`sip_account_custom_patron_field_id`,`sip_account_id`),
|
||||
KEY `sip_account_custom_patron_fields_ibfk_1` (`sip_account_id`),
|
||||
|
|
@ -6192,11 +6192,11 @@ DROP TABLE IF EXISTS `sip_accounts`;
|
|||
CREATE TABLE `sip_accounts` (
|
||||
`sip_account_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`sip_institution_id` int(11) NOT NULL COMMENT 'Foreign key to sip_institutions.sip_institution_id',
|
||||
`ae_field_template` varchar(255) DEFAULT NULL,
|
||||
`ae_field_template` text DEFAULT NULL,
|
||||
`allow_additional_materials_checkout` tinyint(1) DEFAULT NULL,
|
||||
`allow_empty_passwords` tinyint(1) DEFAULT NULL,
|
||||
`allow_fields` varchar(255) DEFAULT NULL,
|
||||
`av_field_template` varchar(255) DEFAULT NULL,
|
||||
`av_field_template` text DEFAULT NULL,
|
||||
`blocked_item_types` varchar(255) DEFAULT NULL,
|
||||
`checked_in_ok` tinyint(1) DEFAULT NULL,
|
||||
`convert_nonprinting_characters` varchar(10) DEFAULT NULL,
|
||||
|
|
@ -6204,7 +6204,7 @@ CREATE TABLE `sip_accounts` (
|
|||
`ct_always_send` tinyint(1) DEFAULT NULL,
|
||||
`cv_send_00_on_success` tinyint(1) DEFAULT NULL,
|
||||
`cv_triggers_alert` tinyint(1) DEFAULT NULL,
|
||||
`da_field_template` varchar(255) DEFAULT NULL,
|
||||
`da_field_template` text DEFAULT NULL,
|
||||
`delimiter` varchar(10) DEFAULT '|',
|
||||
`disallow_overpayment` tinyint(1) DEFAULT NULL,
|
||||
`encoding` varchar(10) DEFAULT NULL,
|
||||
|
|
|
|||
Loading…
Reference in New Issue