From 4d8228c8fe15a479d81708df0c82eb163e163785 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- Koha/Schema/Result/BorrowerAttributeType.pm | 4 ++++ .../bug_32610_patron_attr_type_date.pl | 17 +++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 3 files changed, 22 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 ad609f0a78..acafda8c0e 100644 --- a/Koha/Schema/Result/BorrowerAttributeType.pm +++ b/Koha/Schema/Result/BorrowerAttributeType.pm @@ -260,6 +260,10 @@ __PACKAGE__->add_columns( '+staff_searchable' => { 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..2bc0be5590 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_32610_patron_attr_type_date.pl @@ -0,0 +1,17 @@ +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 32514adcef..8daa3be5de 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1248,6 +1248,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.20.1