From 25ddd241f259655a775debc2b1d00594198949e2 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 26 Sep 2019 15:06:44 +0100 Subject: [PATCH] Bug 23049: Update DBIC Classes for branch limitations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Séverine QUEUNE --- Koha/Schema/Result/AcDebitTypesBranch.pm | 97 ++++++++++++++++++++++++++ Koha/Schema/Result/AccountDebitType.pm | 113 +++++++++++++++++++++++++++++++ Koha/Schema/Result/Accountline.pm | 33 ++++++++- Koha/Schema/Result/Branch.pm | 19 +++++- 4 files changed, 258 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/AcDebitTypesBranch.pm create mode 100644 Koha/Schema/Result/AccountDebitType.pm diff --git a/Koha/Schema/Result/AcDebitTypesBranch.pm b/Koha/Schema/Result/AcDebitTypesBranch.pm new file mode 100644 index 0000000..314b248 --- /dev/null +++ b/Koha/Schema/Result/AcDebitTypesBranch.pm @@ -0,0 +1,97 @@ +use utf8; +package Koha::Schema::Result::AcDebitTypesBranch; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AcDebitTypesBranch + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("ac_debit_types_branches"); + +=head1 ACCESSORS + +=head2 debit_type_code + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 16 + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +=cut + +__PACKAGE__->add_columns( + "debit_type_code", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 16 }, + "branchcode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, +); + +=head1 RELATIONS + +=head2 branchcode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branchcode", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "RESTRICT", + }, +); + +=head2 debit_type_code + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "debit_type_code", + "Koha::Schema::Result::AccountDebitType", + { code => "debit_type_code" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "RESTRICT", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-26 15:59:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:y7zhbS7uj5zRCOskakhzLA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/AccountDebitType.pm b/Koha/Schema/Result/AccountDebitType.pm new file mode 100644 index 0000000..808c76a --- /dev/null +++ b/Koha/Schema/Result/AccountDebitType.pm @@ -0,0 +1,113 @@ +use utf8; +package Koha::Schema::Result::AccountDebitType; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AccountDebitType + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("account_debit_types"); + +=head1 ACCESSORS + +=head2 code + + data_type: 'varchar' + is_nullable: 0 + size: 16 + +=head2 default_amount + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + +=head2 description + + data_type: 'varchar' + is_nullable: 1 + size: 200 + +=head2 can_be_added_manually + + data_type: 'tinyint' + default_value: 1 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "code", + { data_type => "varchar", is_nullable => 0, size => 16 }, + "default_amount", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "description", + { data_type => "varchar", is_nullable => 1, size => 200 }, + "can_be_added_manually", + { data_type => "tinyint", default_value => 1, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("code"); + +=head1 RELATIONS + +=head2 ac_debit_types_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ac_debit_types_branches", + "Koha::Schema::Result::AcDebitTypesBranch", + { "foreign.debit_type_code" => "self.code" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 accountlines + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "accountlines", + "Koha::Schema::Result::Accountline", + { "foreign.debit_type" => "self.code" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-26 15:59:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jMTwuzzf39606BEjXzPGng + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index c2ae858..3a9072f 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -69,6 +69,13 @@ __PACKAGE__->table("accountlines"); is_nullable: 1 size: 80 +=head2 debit_type + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 16 + =head2 status data_type: 'varchar' @@ -143,6 +150,8 @@ __PACKAGE__->add_columns( { data_type => "longtext", is_nullable => 1 }, "accounttype", { data_type => "varchar", is_nullable => 1, size => 80 }, + "debit_type", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 16 }, "status", { data_type => "varchar", is_nullable => 1, size => 16 }, "payment_type", @@ -252,6 +261,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 debit_type + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "debit_type", + "Koha::Schema::Result::AccountDebitType", + { code => "debit_type" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -313,8 +342,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-23 10:45:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L+QlTTT+MdGoA3shpyaBgQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-26 15:59:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d0RP5LSuBHb3UF0Fcof11g sub koha_objects_class { 'Koha::Account::Lines'; diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 6191b31..fa9679e 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -211,6 +211,21 @@ __PACKAGE__->set_primary_key("branchcode"); =head1 RELATIONS +=head2 ac_debit_types_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ac_debit_types_branches", + "Koha::Schema::Result::AcDebitTypesBranch", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 accountlines Type: has_many @@ -677,8 +692,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-23 10:45:22 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KDg4i49bpMxXQ1LP6OZFWQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-26 15:59:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IiEBfDpMBAi9cv7OqevVRQ __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 } -- 2.7.4