From e9498a815287fcb25f5796438c6af45272b96f67 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sat, 18 Mar 2023 00:08:28 +0000 Subject: [PATCH] Bug 32610: Add borrower_attribute_types.is_date to the database * Change to kohastructure.sql for new installations * Atomic database update to add the column for updating installations Signed-off-by: Philip Orr --- Koha/Schema/Result/BorrowerAttributeType.pm | 4 ++++ .../bug_32610_patron_attr_type_date.pl | 15 +++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 3 files changed, 20 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_32610_patron_attr_type_date.pl diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm index 9a4b7125ce..bd1bbba124 100644 --- a/Koha/Schema/Result/BorrowerAttributeType.pm +++ b/Koha/Schema/Result/BorrowerAttributeType.pm @@ -251,6 +251,10 @@ __PACKAGE__->add_columns( '+mandatory' => { is_boolean => 1 }, ); +__PACKAGE__->add_columns( + '+is_date' => { is_boolean => 1 }, +); + sub koha_object_class { 'Koha::Patron::Attribute::Type'; } diff --git a/installer/data/mysql/atomicupdate/bug_32610_patron_attr_type_date.pl b/installer/data/mysql/atomicupdate/bug_32610_patron_attr_type_date.pl new file mode 100755 index 0000000000..f6d8002ead --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_32610_patron_attr_type_date.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "32610", + description => "Add option for additional patron attributes of type date", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + unless ( column_exists( 'borrower_attribute_types', 'is_date' ) ) { + $dbh->do(q{ALTER TABLE borrower_attribute_types + ADD COLUMN `is_date` tinyint(1) NOT NULL default 0 AFTER `unique_id`}); + say $out "Added column 'borrower_attribute_types.is_date'"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index a3faa37d79..106c0d7e3f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1127,6 +1127,7 @@ CREATE TABLE `borrower_attribute_types` ( `description` varchar(255) NOT NULL COMMENT 'description for each custom field', `repeatable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines whether one patron/borrower can have multiple values for this custom field (1 for yes, 0 for no)', `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)', + `is_date` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is displayed as a date', `opac_display` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is visible to patrons on their account in the OPAC (1 for yes, 0 for no)', `opac_editable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is editable by patrons on their account in the OPAC (1 for yes, 0 for no)', `staff_searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is searchable via the patron search in the staff interface (1 for yes, 0 for no)', -- 2.30.2