From f9b5aa52cc2563a7137d7648b78982d50882a9be Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Tue, 7 Feb 2017 19:02:57 +0200 Subject: [PATCH] Bug 7534: Add new column "pickup_location" to branches This patch adds a new column "pickup_location" for each library. This value defines whether a library can be used as a pickup location or not. For extended configurability, this flag could perhaps be considered as a part of issuing rules, but as of now, this patch only offers a simple flag into each library. This method also allows easy way for REST API to determine valid pickup locations by querying the /libraries endpoint. To test: 1. perl installer/data/mysql/updatedatabase.pl 2. Observe DEV atomic update: bug_7534.perl Upgrade to XXX done (Bug 7534 - Let libraries have configuration for pickup locations) https://bugs.koha-community.org/show_bug.cgi?id=7354 Signed-off-by: Koha Team AMU --- Koha/Schema/Result/Branch.pm | 12 ++++++++++-- installer/data/mysql/atomicupdate/bug_7534.perl | 7 +++++++ installer/data/mysql/kohastructure.sql | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_7534.perl diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index ec44cde..0098069 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -128,6 +128,12 @@ __PACKAGE__->table("branches"); data_type: 'text' is_nullable: 1 +=head2 pickup_location + + data_type: 'tinyint' + default_value: 1 + is_nullable: 0 + =cut __PACKAGE__->add_columns( @@ -171,6 +177,8 @@ __PACKAGE__->add_columns( { data_type => "mediumtext", is_nullable => 1 }, "opac_info", { data_type => "text", is_nullable => 1 }, + "pickup_location", + { data_type => "tinyint", default_value => 1, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -543,8 +551,8 @@ Composing rels: L -> categorycode __PACKAGE__->many_to_many("categorycodes", "branchrelations", "categorycode"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-24 13:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/9YwsU+GXK+fzc6IX2Tj5g +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2017-02-07 19:53:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p0gmtxzcyjb8JetqS+RsDg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_7534.perl b/installer/data/mysql/atomicupdate/bug_7534.perl new file mode 100644 index 0000000..0cf94c8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_7534.perl @@ -0,0 +1,7 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "ALTER TABLE branches ADD COLUMN pickup_location TINYINT(1) not null default 1" ); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 7534 - Let libraries have configuration for pickup locations)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 91e6119..ce7913c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -277,6 +277,7 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st `branchprinter` varchar(100) default NULL, -- unused in Koha `branchnotes` mediumtext, -- notes related to your library or branch opac_info text, -- HTML that displays in OPAC + `pickup_location` tinyint(1) NOT NULL default 1, -- the ability to act as a pickup location PRIMARY KEY (`branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- 2.7.4