From a7dba215bc846015eddaa255f8a9ae8270591ced Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 23 Oct 2019 14:51:28 +0100 Subject: [PATCH] Bug 23049: Add DBIC Classes Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- Koha/Schema/Result/AccountDebitType.pm | 139 ++++++++++++++++++ Koha/Schema/Result/AccountDebitTypesBranch.pm | 97 ++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 Koha/Schema/Result/AccountDebitType.pm create mode 100644 Koha/Schema/Result/AccountDebitTypesBranch.pm diff --git a/Koha/Schema/Result/AccountDebitType.pm b/Koha/Schema/Result/AccountDebitType.pm new file mode 100644 index 0000000000..146e97199b --- /dev/null +++ b/Koha/Schema/Result/AccountDebitType.pm @@ -0,0 +1,139 @@ +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: 80 + +=head2 description + + data_type: 'varchar' + is_nullable: 1 + size: 200 + +=head2 can_be_added_manually + + data_type: 'tinyint' + default_value: 1 + is_nullable: 0 + +=head2 default_amount + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + +=head2 is_system + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=head2 archived + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "code", + { data_type => "varchar", is_nullable => 0, size => 80 }, + "description", + { data_type => "varchar", is_nullable => 1, size => 200 }, + "can_be_added_manually", + { data_type => "tinyint", default_value => 1, is_nullable => 0 }, + "default_amount", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "is_system", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "archived", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("code"); + +=head1 RELATIONS + +=head2 account_debit_types_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "account_debit_types_branches", + "Koha::Schema::Result::AccountDebitTypesBranch", + { "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_code" => "self.code" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-23 13:48:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uDKsz1QUF6zY+haOVVQZNw + +__PACKAGE__->add_columns( + '+is_system' => { is_boolean => 1 } +); + +sub koha_objects_class { + 'Koha::Account::DebitTypes'; +} +sub koha_object_class { + 'Koha::Account::DebitType'; +} + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/AccountDebitTypesBranch.pm b/Koha/Schema/Result/AccountDebitTypesBranch.pm new file mode 100644 index 0000000000..c4eac18423 --- /dev/null +++ b/Koha/Schema/Result/AccountDebitTypesBranch.pm @@ -0,0 +1,97 @@ +use utf8; +package Koha::Schema::Result::AccountDebitTypesBranch; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AccountDebitTypesBranch + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("account_debit_types_branches"); + +=head1 ACCESSORS + +=head2 debit_type_code + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 80 + +=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 => 80 }, + "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-10-23 13:48:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3ur56KFASvuQ31JGV6OA2Q + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.20.1