From f64b6c395200f52f27b86665ab442a33cef19efe Mon Sep 17 00:00:00 2001 From: Jake Deery Date: Tue, 2 Dec 2025 09:12:42 +0000 Subject: [PATCH] DBIC - DO NOT PUSH --- Koha/Schema/Result/Biblio.pm | 19 +- Koha/Schema/Result/Branch.pm | 34 +++- Koha/Schema/Result/Display.pm | 274 +++++++++++++++++++++++++++++ Koha/Schema/Result/DisplayItem.pm | 182 +++++++++++++++++++ Koha/Schema/Result/Item.pm | 27 ++- Koha/Schema/Result/Itemtype.pm | 19 +- Koha/Schema/Result/LibraryGroup.pm | 14 +- 7 files changed, 559 insertions(+), 10 deletions(-) create mode 100644 Koha/Schema/Result/Display.pm create mode 100644 Koha/Schema/Result/DisplayItem.pm diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 7d2ce13fa0e..56e42c50ead 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -325,6 +325,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 display_items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "display_items", + "Koha::Schema::Result::DisplayItem", + { "foreign.biblionumber" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 erm_eholdings_titles Type: has_many @@ -641,8 +656,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-12-18 12:10:28 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QXaEHXqH2ApC+F22zo7gXA +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-15 08:07:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:W2YtMTEXGHxwDI0ra1D/mw __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 787c0772195..604e8ae1aff 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -680,6 +680,36 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 displays + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "displays", + "Koha::Schema::Result::Display", + { "foreign.display_branch" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 displays_display_holding_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "displays_display_holding_branches", + "Koha::Schema::Result::Display", + { "foreign.display_holding_branch" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 edifact_eans Type: has_many @@ -996,8 +1026,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-05-03 13:13:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HiH1QNlDqKcq9GeM85Pu0A +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-23 14:05:29 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:g7lwQkToOnQvOJjSsn90AA __PACKAGE__->has_many( "additional_field_values", diff --git a/Koha/Schema/Result/Display.pm b/Koha/Schema/Result/Display.pm new file mode 100644 index 00000000000..8cc0a1bc4f2 --- /dev/null +++ b/Koha/Schema/Result/Display.pm @@ -0,0 +1,274 @@ +use utf8; +package Koha::Schema::Result::Display; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Display + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("displays"); + +=head1 ACCESSORS + +=head2 display_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +unique id for the display + +=head2 display_name + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +the name of the display + +=head2 start_date + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +the start date of the display (optional) + +=head2 end_date + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +the end date of the display (optional) + +=head2 enabled + + data_type: 'tinyint' + default_value: 1 + is_nullable: 0 + +determines whether the display is active + +=head2 display_location + + data_type: 'varchar' + is_nullable: 1 + size: 80 + +the shelving location for the display (optional) + +=head2 display_code + + data_type: 'varchar' + is_nullable: 1 + size: 80 + +the collection code for the display (optional) + +=head2 display_branch + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +a new home branch for the item to have while on display (optional) + +=head2 display_holding_branch + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +a new holding branch for the item to have while on display (optional) + +=head2 display_itype + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +a new itype for the item to have while on display (optional) + +=head2 staff_note + + data_type: 'mediumtext' + is_nullable: 1 + +staff note for the display + +=head2 public_note + + data_type: 'mediumtext' + is_nullable: 1 + +public note for the display + +=head2 display_days + + data_type: 'integer' + is_nullable: 1 + +default number of days items will remain on display + +=head2 display_return_over + + data_type: 'enum' + default_value: 'no' + extra: {list => ["yes - any library","yes - except at home library","no"]} + is_nullable: 0 + +should the item be removed from the display when it is returned + +=cut + +__PACKAGE__->add_columns( + "display_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "display_name", + { data_type => "varchar", is_nullable => 1, size => 255 }, + "start_date", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "end_date", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "enabled", + { data_type => "tinyint", default_value => 1, is_nullable => 0 }, + "display_location", + { data_type => "varchar", is_nullable => 1, size => 80 }, + "display_code", + { data_type => "varchar", is_nullable => 1, size => 80 }, + "display_branch", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + "display_holding_branch", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + "display_itype", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + "staff_note", + { data_type => "mediumtext", is_nullable => 1 }, + "public_note", + { data_type => "mediumtext", is_nullable => 1 }, + "display_days", + { data_type => "integer", is_nullable => 1 }, + "display_return_over", + { + data_type => "enum", + default_value => "no", + extra => { + list => ["yes - any library", "yes - except at home library", "no"], + }, + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("display_id"); + +=head1 RELATIONS + +=head2 display_branch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "display_branch", + "Koha::Schema::Result::Branch", + { branchcode => "display_branch" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 display_holding_branch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "display_holding_branch", + "Koha::Schema::Result::Branch", + { branchcode => "display_holding_branch" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 display_items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "display_items", + "Koha::Schema::Result::DisplayItem", + { "foreign.display_id" => "self.display_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 display_itype + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "display_itype", + "Koha::Schema::Result::Itemtype", + { itemtype => "display_itype" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-29 13:35:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mzpC+5bt7kie1FjMxakfoQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/DisplayItem.pm b/Koha/Schema/Result/DisplayItem.pm new file mode 100644 index 00000000000..b79542a077e --- /dev/null +++ b/Koha/Schema/Result/DisplayItem.pm @@ -0,0 +1,182 @@ +use utf8; +package Koha::Schema::Result::DisplayItem; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::DisplayItem + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("display_items"); + +=head1 ACCESSORS + +=head2 display_item_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key + +=head2 display_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +foreign key to link to displays.display_id + +=head2 itemnumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +items.itemnumber for the item on display + +=head2 biblionumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +biblio.biblionumber for the bibliographic record on display + +=head2 date_added + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +the date the item was added to the display + +=head2 date_remove + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +the date the item should be removed from the display + +=cut + +__PACKAGE__->add_columns( + "display_item_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "display_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "itemnumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "biblionumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "date_added", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "date_remove", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("display_item_id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("display_items_uniq", ["display_id", "itemnumber"]); + +=head1 RELATIONS + +=head2 biblionumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblionumber", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblionumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 display + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "display", + "Koha::Schema::Result::Display", + { display_id => "display_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 itemnumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "itemnumber", + "Koha::Schema::Result::Item", + { itemnumber => "itemnumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-15 08:07:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uKlpm8iZfGnGRJPmQKUO2w + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 83b361a1400..b74d0004b1c 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -710,6 +710,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 display_items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "display_items", + "Koha::Schema::Result::DisplayItem", + { "foreign.itemnumber" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 hold_fill_target Type: might_have @@ -991,8 +1006,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-04-28 16:41:47 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hGbnnGBWKaKzsVipsyN7ww +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-15 08:07:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VketnoTyGAI2v9LPYgpwpQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); @@ -1068,6 +1083,14 @@ __PACKAGE__->has_many( # Relationship with bundled items __PACKAGE__->many_to_many( bundle_items => 'item_bundles_hosts', 'item' ); +# Relationship with display items +__PACKAGE__->has_many( + "display_items", + "Koha::Schema::Result::DisplayItem", + { "foreign.itemnumber" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + __PACKAGE__->might_have( "last_returned_by", "Koha::Schema::Result::ItemsLastBorrower", diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index 3d3c97ccb47..b54886bfaa6 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -279,6 +279,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 displays + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "displays", + "Koha::Schema::Result::Display", + { "foreign.display_itype" => "self.itemtype" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 itemtypes Type: has_many @@ -360,8 +375,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-20 19:06:37 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T/3QdCb353e+qBkN4as7Bg +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-23 15:28:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VPPDv7J9Bx/ldgiKsAhAew __PACKAGE__->add_columns( '+automatic_checkin' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/LibraryGroup.pm b/Koha/Schema/Result/LibraryGroup.pm index c1c25568095..dd68a41e524 100644 --- a/Koha/Schema/Result/LibraryGroup.pm +++ b/Koha/Schema/Result/LibraryGroup.pm @@ -111,6 +111,14 @@ Use this group to identify libraries as pick up location for holds Use this group to identify libraries as part of float group +=head2 ft_display_group + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +Use this group to identify libraries that can share display items + =head2 created_on data_type: 'timestamp' @@ -153,6 +161,8 @@ __PACKAGE__->add_columns( { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "ft_local_float_group", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "ft_display_group", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "created_on", { data_type => "timestamp", @@ -266,8 +276,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-04-28 16:41:47 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CkZe+3Qm2ZlmoSmXBGChag +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-15 08:07:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vJU7IJYCgYXrghYG+VtGxg =head2 koha_object_class -- 2.50.1 (Apple Git-155)