From a3944dd01481900f2125db7cffce2f426f249f1b 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. --- Koha/Schema/Result/Branch.pm | 15 ++++ Koha/Schema/Result/Item.pm | 20 ++++- Koha/Schema/Result/Stockrotationitem.pm | 113 ++++++++++++++++++++++++++ Koha/Schema/Result/Stockrotationrota.pm | 105 ++++++++++++++++++++++++ Koha/Schema/Result/Stockrotationstage.pm | 134 +++++++++++++++++++++++++++++++ 5 files changed, 385 insertions(+), 2 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 b4960ef852..a6d66de5ea 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -555,6 +555,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 diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index ce85bd7b72..54ffd8c9fd 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -674,9 +674,24 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 stockrotationitem -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-24 13:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vf1sBZrpUo0Cvi896fjNuA +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.07042 @ 2016-12-12 17:02:24 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oo/Eubwpc1tcaGAO9Oja1A __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); @@ -701,4 +716,5 @@ sub effective_itemtype { } } +# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; 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..46661c635f --- /dev/null +++ b/Koha/Schema/Result/Stockrotationrota.pm @@ -0,0 +1,105 @@ +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 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.07042 @ 2016-10-17 16:18:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gglRP/Dh1RIu9eH834lStA + + +# 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.11.0