Bugzilla – Attachment 160053 Details for
Bug 28530
Allow configuration of floating limits by item type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28530: Update database, add new schema file
Bug-28530-Update-database-add-new-schema-file.patch (text/plain), 9.43 KB, created by
Kyle M Hall (khall)
on 2023-12-19 17:28:53 UTC
(
hide
)
Description:
Bug 28530: Update database, add new schema file
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-12-19 17:28:53 UTC
Size:
9.43 KB
patch
obsolete
>From 68f5a4de8a8c5e96e674520e7222e2062bd14a16 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 18 Dec 2023 14:19:02 -0500 >Subject: [PATCH] Bug 28530: Update database, add new schema file > >--- > Koha/Schema/Result/LibraryFloatLimit.pm | 123 ++++++++++++++++++ > .../data/mysql/atomicupdate/bug_28530.pl | 40 ++++++ > installer/data/mysql/kohastructure.sql | 15 ++- > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 6 + > 5 files changed, 184 insertions(+), 1 deletion(-) > create mode 100644 Koha/Schema/Result/LibraryFloatLimit.pm > create mode 100755 installer/data/mysql/atomicupdate/bug_28530.pl > >diff --git a/Koha/Schema/Result/LibraryFloatLimit.pm b/Koha/Schema/Result/LibraryFloatLimit.pm >new file mode 100644 >index 00000000000..1a0065023f0 >--- /dev/null >+++ b/Koha/Schema/Result/LibraryFloatLimit.pm >@@ -0,0 +1,123 @@ >+use utf8; >+package Koha::Schema::Result::LibraryFloatLimit; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::LibraryFloatLimit >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<library_float_limits> >+ >+=cut >+ >+__PACKAGE__->table("library_float_limits"); >+ >+=head1 ACCESSORS >+ >+=head2 branchcode >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=head2 itemtype >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=head2 limit >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "branchcode", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, >+ "itemtype", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, >+ "limit", >+ { data_type => "integer", is_nullable => 1 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</branchcode> >+ >+=item * L</itemtype> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("branchcode", "itemtype"); >+ >+=head1 RELATIONS >+ >+=head2 branchcode >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Branch> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "branchcode", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "branchcode" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+=head2 itemtype >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Itemtype> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "itemtype", >+ "Koha::Schema::Result::Itemtype", >+ { itemtype => "itemtype" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-12-18 13:53:43 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XAvuO942Z7k3O/FrkZRXzw >+ >+=head2 koha_object_class >+ >+=cut >+ >+sub koha_object_class { >+ 'Koha::Library::FloatLimit'; >+} >+ >+=head2 koha_objects_class >+ >+=cut >+ >+sub koha_objects_class { >+ 'Koha::Library::FloatLimits'; >+} >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/installer/data/mysql/atomicupdate/bug_28530.pl b/installer/data/mysql/atomicupdate/bug_28530.pl >new file mode 100755 >index 00000000000..aaed5ca0a94 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_28530.pl >@@ -0,0 +1,40 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "28530", >+ description => "Add library float limits", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE branchtransfers MODIFY COLUMN `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation', 'LibraryFloatLimit') DEFAULT NULL COMMENT 'what triggered the transfer' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('UseLibraryFloatLimits', '0', '', 'Enables library float limits', 'YesNo'); >+ } >+ ); >+ say $out "Added new system preference 'UseLibraryFloatLimits'"; >+ >+ unless ( TableExists('search_filters') ) { >+ $dbh->do( >+ q{ >+ CREATE TABLE `library_float_limits` ( >+ `branchcode` varchar(10) NOT NULL, >+ `itemtype` varchar(10) NOT NULL, >+ `limit` int(11) NULL DEFAULT NULL, >+ PRIMARY KEY (`branchcode`,`itemtype`), >+ CONSTRAINT `library_float_limits_ibfk_bc` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `library_float_limits_ibfk_it` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ } >+ ); >+ } >+ say $out "Added new table 'library_float_limits'"; >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 0b59ad8d85c..bc6d5a44398 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1692,7 +1692,7 @@ CREATE TABLE `branchtransfers` ( > `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled', > `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to', > `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer', >- `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer', >+ `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation','LibraryFloatLimit') DEFAULT NULL COMMENT 'what triggered the transfer', > `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation', > PRIMARY KEY (`branchtransfer_id`), > KEY `frombranch` (`frombranch`), >@@ -6357,6 +6357,19 @@ CREATE TABLE `transport_cost` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > /*!40101 SET character_set_client = @saved_cs_client */; > >+DROP TABLE IF EXISTS `library_float_limits`; >+/*!40101 SET @saved_cs_client = @@character_set_client */; >+/*!40101 SET character_set_client = utf8 */; >+CREATE TABLE `library_float_limits` ( >+ `branchcode` varchar(10) NOT NULL, >+ `itemtype` varchar(10) NOT NULL, >+ `limit` int(11) NULL DEFAULT NULL, >+ PRIMARY KEY (`branchcode`,`itemtype`), >+ CONSTRAINT `library_float_limits_ibfk_bc` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `library_float_limits_ibfk_it` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+/*!40101 SET character_set_client = @saved_cs_client */; >+ > -- > -- Table structure for table `uploaded_files` > -- >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index b58114d802e..ca7897a383f 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -803,6 +803,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'), > ('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'), > ('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'), >+('UseLibraryFloatLimits', '0', '', 'Enables library float limits', 'YesNo'), > ('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'), > ('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'), > ('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 40f2d65a81e..9c8ea06478d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -261,6 +261,12 @@ Circulation: > 1: Use > 0: "Don't use" > - the transport cost matrix for calculating optimal holds filling between libraries. >+ - >+ - pref: UseLibraryFloatLimits >+ choices: >+ 1: Use >+ 0: "Don't use" >+ - library float limits to determine if an item should be transferred to another library. > - > - Use the calendar and circulation rules of > - pref: CircControl >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28530
:
160038
|
160039
|
160040
|
160041
|
160042
|
160043
|
160044
|
160045
|
160046
|
160047
|
160048
|
160049
|
160050
|
160053
|
160054
|
160055
|
160056
|
160057
|
160058
|
160061
|
160062
|
160063
|
160064
|
160065
|
160066
|
160067
|
160068
|
160071
|
160072
|
160073
|
160074
|
160075
|
160076
|
160077
|
160078
|
160079
|
160080
|
160081
|
160082
|
160083
|
160084
|
163919
|
168343
|
168344
|
168345
|
168346
|
168347
|
168348
|
168349
|
168350