From 03145a70642b9d9f30d144f76dda45d5ca381bcb Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Mon, 17 Oct 2016 18:24:16 +0200 Subject: [PATCH] Bug 11897: DO NOT PUSH: Add stock rotation schema files. * Koha/Schema/Result/Branch.pm: New file. * Koha/Schema/Result/Item.pm: New file. * Koha/Schema/Result/Stockrotationitem.pm: New file. * Koha/Schema/Result/Stockrotationrota.pm: New file. * Koha/Schema/Result/Stockrotationstage.pm: New file. Signed-off-by: Kathleen Milne --- Koha/Schema/Result/Branch.pm | 19 +++- Koha/Schema/Result/Item.pm | 19 +++- Koha/Schema/Result/Stockrotationitem.pm | 113 +++++++++++++++++++ Koha/Schema/Result/Stockrotationrota.pm | 119 ++++++++++++++++++++ Koha/Schema/Result/Stockrotationstage.pm | 134 +++++++++++++++++++++++ 5 files changed, 400 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/Stockrotationitem.pm create mode 100644 Koha/Schema/Result/Stockrotationrota.pm create mode 100644 Koha/Schema/Result/Stockrotationstage.pm diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index bb571b18de..fceb86b672 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -578,6 +578,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 stockrotationstages + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "stockrotationstages", + "Koha::Schema::Result::Stockrotationstage", + { "foreign.branchcode_id" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 transport_cost_frombranches Type: has_many @@ -609,8 +624,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QOMUFz2EjvAVWCkIpNmvtg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-04-17 16:37:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0hfhEZW9VseBN7k05ByvpQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index cee25520cc..027075e9c4 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -686,9 +686,24 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 stockrotationitem -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-18 16:41:12 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CrNXvpDUvvcuPZK2Gfzs/Q +Type: might_have + +Related object: L + +=cut + +__PACKAGE__->might_have( + "stockrotationitem", + "Koha::Schema::Result::Stockrotationitem", + { "foreign.itemnumber_id" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-04-17 16:37:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aOcn/Am4XilK4NblfY5zXQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/Stockrotationitem.pm b/Koha/Schema/Result/Stockrotationitem.pm new file mode 100644 index 0000000000..7963601fa0 --- /dev/null +++ b/Koha/Schema/Result/Stockrotationitem.pm @@ -0,0 +1,113 @@ +use utf8; +package Koha::Schema::Result::Stockrotationitem; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Stockrotationitem + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("stockrotationitems"); + +=head1 ACCESSORS + +=head2 itemnumber_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 stage_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 indemand + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=head2 fresh + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "itemnumber_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "stage_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "indemand", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "fresh", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("itemnumber_id"); + +=head1 RELATIONS + +=head2 itemnumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "itemnumber", + "Koha::Schema::Result::Item", + { itemnumber => "itemnumber_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 stage + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "stage", + "Koha::Schema::Result::Stockrotationstage", + { stage_id => "stage_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-04-04 12:16:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5IDh4gVR3uzLEdUPBfsHTA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Stockrotationrota.pm b/Koha/Schema/Result/Stockrotationrota.pm new file mode 100644 index 0000000000..48f401df32 --- /dev/null +++ b/Koha/Schema/Result/Stockrotationrota.pm @@ -0,0 +1,119 @@ +use utf8; +package Koha::Schema::Result::Stockrotationrota; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Stockrotationrota + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("stockrotationrotas"); + +=head1 ACCESSORS + +=head2 rota_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 title + + data_type: 'varchar' + is_nullable: 0 + size: 100 + +=head2 description + + data_type: 'text' + is_nullable: 0 + +=head2 cyclical + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=head2 active + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "rota_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "title", + { data_type => "varchar", is_nullable => 0, size => 100 }, + "description", + { data_type => "text", is_nullable => 0 }, + "cyclical", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "active", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("rota_id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("stockrotationrotas_title", ["title"]); + +=head1 RELATIONS + +=head2 stockrotationstages + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "stockrotationstages", + "Koha::Schema::Result::Stockrotationstage", + { "foreign.rota_id" => "self.rota_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-04-17 16:37:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KOv8PNKzQd3gLTskL1GiHw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Stockrotationstage.pm b/Koha/Schema/Result/Stockrotationstage.pm new file mode 100644 index 0000000000..5ae86d6bf0 --- /dev/null +++ b/Koha/Schema/Result/Stockrotationstage.pm @@ -0,0 +1,134 @@ +use utf8; +package Koha::Schema::Result::Stockrotationstage; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Stockrotationstage + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("stockrotationstages"); + +=head1 ACCESSORS + +=head2 stage_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 position + + data_type: 'integer' + is_nullable: 0 + +=head2 rota_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 branchcode_id + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 duration + + data_type: 'integer' + default_value: 4 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "stage_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "position", + { data_type => "integer", is_nullable => 0 }, + "rota_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "branchcode_id", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "duration", + { data_type => "integer", default_value => 4, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("stage_id"); + +=head1 RELATIONS + +=head2 branchcode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branchcode", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 rota + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "rota", + "Koha::Schema::Result::Stockrotationrota", + { rota_id => "rota_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 stockrotationitems + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "stockrotationitems", + "Koha::Schema::Result::Stockrotationitem", + { "foreign.stage_id" => "self.stage_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-11-07 11:33:00 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zxUwd0UdMRN03yuSlf3RmA + +1; -- 2.18.0