From 5fb88e20b1af1606bbb6d20db7e1e48fc5a0d970 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 27 Jul 2023 20:42:36 +0000 Subject: [PATCH] Bug 34438: Add lang to borrower_modification table To test: 1. Install a language pack ( sudo koha-translate -i es-ES ) 2. Turn on the system preference TranslateNotices 3. The lang field now appears when registering a patron from the staff interface but not on the OPAC self registration form. 4. Apply patch, updatedatabase, restart_all 5. Go to the OPAC self reg form and notice the Preferred language for notices: 6. Use the PatronSelfRegistrationBorrowerUnwantedField and PatronSelfRegistrationBorrowerMandatoryField to make sure you can make the field requied/hidden. 7. Login to the OPAC and go to patron details, make sure you can modify the Preferred language for notices field successfully. --- Koha/Schema/Result/BorrowerModification.pm | 8 ++++++++ installer/data/mysql/atomicupdate/bug_34438.pl | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_34438.pl diff --git a/Koha/Schema/Result/BorrowerModification.pm b/Koha/Schema/Result/BorrowerModification.pm index 4e58afdbd8..090f9ecbdc 100644 --- a/Koha/Schema/Result/BorrowerModification.pm +++ b/Koha/Schema/Result/BorrowerModification.pm @@ -441,6 +441,12 @@ data processing consent is_nullable: 1 size: 45 +=head2 lang + + data_type: 'varchar' + is_nullable: 1 + size: 25 + useful for reporting purposes =cut @@ -621,6 +627,8 @@ __PACKAGE__->add_columns( }, "primary_contact_method", { data_type => "varchar", is_nullable => 1, size => 45 }, + "lang", + { data_type => "varchar", is_nullable => 1, size => 25 }, ); =head1 PRIMARY KEY diff --git a/installer/data/mysql/atomicupdate/bug_34438.pl b/installer/data/mysql/atomicupdate/bug_34438.pl new file mode 100755 index 0000000000..af9012eb23 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_34438.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "34438", + description => "Add lang to to the borrower_modifications table", + up => sub { + my ($args) = @_; + my $dbh = $args->{dbh}; + + if( !column_exists( 'borrower_modifications', 'lang' ) ) { + $dbh->do( "ALTER TABLE `borrower_modifications` ADD COLUMN `lang` VARCHAR(25) DEFAULT NULL AFTER `primary_contact_method`" ); + } + }, +} -- 2.30.2