From d5d2b81e708cbdafa064da0a0298d6f07cf61ea6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 4 Oct 2017 13:24:48 +0000 Subject: [PATCH] Bug 19166: DO NOT PUSH - Schema updates Included to ease testing :-) --- Koha/Schema/Result/Aqbudget.pm | 15 ++++ Koha/Schema/Result/Aqinvoice.pm | 15 ++++ Koha/Schema/Result/InvoiceAdjustment.pm | 155 ++++++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 Koha/Schema/Result/InvoiceAdjustment.pm diff --git a/Koha/Schema/Result/Aqbudget.pm b/Koha/Schema/Result/Aqbudget.pm index 68a93af..1cc3783 100644 --- a/Koha/Schema/Result/Aqbudget.pm +++ b/Koha/Schema/Result/Aqbudget.pm @@ -242,6 +242,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 invoice_adjustments + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "invoice_adjustments", + "Koha::Schema::Result::InvoiceAdjustment", + { "foreign.budget_id" => "self.budget_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 suggestions Type: has_many diff --git a/Koha/Schema/Result/Aqinvoice.pm b/Koha/Schema/Result/Aqinvoice.pm index 3ec1475..6082405 100644 --- a/Koha/Schema/Result/Aqinvoice.pm +++ b/Koha/Schema/Result/Aqinvoice.pm @@ -143,6 +143,21 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +=head2 invoice_adjustments + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "invoice_adjustments", + "Koha::Schema::Result::InvoiceAdjustment", + { "foreign.invoiceid" => "self.invoiceid" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 message Type: belongs_to diff --git a/Koha/Schema/Result/InvoiceAdjustment.pm b/Koha/Schema/Result/InvoiceAdjustment.pm new file mode 100644 index 0000000..4112022 --- /dev/null +++ b/Koha/Schema/Result/InvoiceAdjustment.pm @@ -0,0 +1,155 @@ +use utf8; +package Koha::Schema::Result::InvoiceAdjustment; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::InvoiceAdjustment + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("invoice_adjustments"); + +=head1 ACCESSORS + +=head2 adjustment_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 invoiceid + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 adjustment + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + +=head2 reason + + data_type: 'varchar' + is_nullable: 1 + size: 80 + +=head2 note + + data_type: 'mediumtext' + is_nullable: 1 + +=head2 budget_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 encumber_open + + data_type: 'smallint' + default_value: 1 + is_nullable: 0 + +=head2 timestamp + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "adjustment_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "invoiceid", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "adjustment", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "reason", + { data_type => "varchar", is_nullable => 1, size => 80 }, + "note", + { data_type => "mediumtext", is_nullable => 1 }, + "budget_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "encumber_open", + { data_type => "smallint", default_value => 1, is_nullable => 0 }, + "timestamp", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("adjustment_id"); + +=head1 RELATIONS + +=head2 budget + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "budget", + "Koha::Schema::Result::Aqbudget", + { budget_id => "budget_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + +=head2 invoiceid + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "invoiceid", + "Koha::Schema::Result::Aqinvoice", + { invoiceid => "invoiceid" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-09-26 14:15:50 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4hILsU7xo1mRBV13R2LXEg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.1.4