From 574cc2f787d0456ddd035dc5911be9192b09f758 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 19 Jul 2018 17:33:55 +0000 Subject: [PATCH] Bug 19166: DBRev 18.06.00.009 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- Koha/Schema/Result/AqinvoiceAdjustment.pm | 155 ++++++++++++++++++ .../Result/MarcModificationTemplateAction.pm | 7 +- .../data/mysql/atomicupdate/bug_19166.perl | 21 --- installer/data/mysql/updatedatabase.pl | 22 +++ 5 files changed, 182 insertions(+), 25 deletions(-) create mode 100644 Koha/Schema/Result/AqinvoiceAdjustment.pm delete mode 100644 installer/data/mysql/atomicupdate/bug_19166.perl diff --git a/Koha.pm b/Koha.pm index 25e5f9f518..4b2d1abf69 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "18.06.00.008"; +$VERSION = "18.06.00.009"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/AqinvoiceAdjustment.pm b/Koha/Schema/Result/AqinvoiceAdjustment.pm new file mode 100644 index 0000000000..cbdbb2ef10 --- /dev/null +++ b/Koha/Schema/Result/AqinvoiceAdjustment.pm @@ -0,0 +1,155 @@ +use utf8; +package Koha::Schema::Result::AqinvoiceAdjustment; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AqinvoiceAdjustment + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("aqinvoice_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 @ 2018-07-19 17:32:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jl0qxkZWVs2D1pi3kaRjpg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/MarcModificationTemplateAction.pm b/Koha/Schema/Result/MarcModificationTemplateAction.pm index a69b459a79..6523850ee5 100644 --- a/Koha/Schema/Result/MarcModificationTemplateAction.pm +++ b/Koha/Schema/Result/MarcModificationTemplateAction.pm @@ -43,7 +43,7 @@ __PACKAGE__->table("marc_modification_template_actions"); =head2 action data_type: 'enum' - extra: {list => ["delete_field","update_field","move_field","copy_field","copy_and_replace_field"]} + extra: {list => ["delete_field","add_field","update_field","move_field","copy_field","copy_and_replace_field"]} is_nullable: 0 =head2 field_number @@ -154,6 +154,7 @@ __PACKAGE__->add_columns( extra => { list => [ "delete_field", + "add_field", "update_field", "move_field", "copy_field", @@ -234,8 +235,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uRkJ8yckBiNtsYgUt8BpEw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-07-19 17:32:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dAUr9aGlNZleldYbjJHdmw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_19166.perl b/installer/data/mysql/atomicupdate/bug_19166.perl deleted file mode 100644 index 5a3794ebe3..0000000000 --- a/installer/data/mysql/atomicupdate/bug_19166.perl +++ /dev/null @@ -1,21 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( " - CREATE TABLE IF NOT EXISTS aqinvoice_adjustments ( - adjustment_id int(11) NOT NULL AUTO_INCREMENT, - invoiceid int(11) NOT NULL, - adjustment decimal(28,6), - reason varchar(80) default NULL, - note mediumtext default NULL, - budget_id int(11) default NULL, - encumber_open smallint(1) NOT NULL default 1, - timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - PRIMARY KEY (adjustment_id), - CONSTRAINT aqinvoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT aqinvoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci - " ); - $dbh->do("INSERT IGNORE INTO authorised_value_categories (category_name) VALUES ('ADJ_REASON')"); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 19166 - Add the ability to add adjustments to an invoice)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d92191c8de..59ce0640d8 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -16162,6 +16162,28 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 13560 - need an add option in marc modification templates)\n"; } +$DBversion = '18.06.00.009'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( " + CREATE TABLE IF NOT EXISTS aqinvoice_adjustments ( + adjustment_id int(11) NOT NULL AUTO_INCREMENT, + invoiceid int(11) NOT NULL, + adjustment decimal(28,6), + reason varchar(80) default NULL, + note mediumtext default NULL, + budget_id int(11) default NULL, + encumber_open smallint(1) NOT NULL default 1, + timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (adjustment_id), + CONSTRAINT aqinvoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT aqinvoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci + " ); + $dbh->do("INSERT IGNORE INTO authorised_value_categories (category_name) VALUES ('ADJ_REASON')"); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 19166 - Add the ability to add adjustments to an invoice)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5