From b8f51430d3047a81e094e2d43131b27db9f80cb8 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 6 Mar 2023 13:45:51 -0300 Subject: [PATCH] Bug 25655: DBIC schema Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/Aqorder.pm | 45 ++++++++++++++++++++++++++++++++-- Koha/Schema/Result/Currency.pm | 19 ++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/Koha/Schema/Result/Aqorder.pm b/Koha/Schema/Result/Aqorder.pm index 71c8753817..d11d6d12fe 100644 --- a/Koha/Schema/Result/Aqorder.pm +++ b/Koha/Schema/Result/Aqorder.pm @@ -414,6 +414,23 @@ reports received from suppliers Estimated delivery date +=head2 invoice_unitprice + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + +the unit price in foreign currency + +=head2 invoice_currency + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +the currency of the invoice_unitprice + =cut __PACKAGE__->add_columns( @@ -527,6 +544,10 @@ __PACKAGE__->add_columns( { data_type => "mediumtext", is_nullable => 1 }, "estimated_delivery_date", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "invoice_unitprice", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "invoice_currency", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, ); =head1 PRIMARY KEY @@ -713,6 +734,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 invoice_currency + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "invoice_currency", + "Koha::Schema::Result::Currency", + { currency => "invoice_currency" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "SET NULL", + }, +); + =head2 invoiceid Type: belongs_to @@ -764,8 +805,8 @@ Composing rels: L -> borrowernumber __PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-16 13:56:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:M8HvWBKYFNGspSTakU6Qdg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-06 16:45:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7vMNLDNO0/Bpng9sBFyyBg __PACKAGE__->belongs_to( "basket", diff --git a/Koha/Schema/Result/Currency.pm b/Koha/Schema/Result/Currency.pm index 720fa5ac59..13a04ca326 100644 --- a/Koha/Schema/Result/Currency.pm +++ b/Koha/Schema/Result/Currency.pm @@ -157,9 +157,24 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 aqorders_invoice_currencies -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-01 14:23:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PnJEcCgrM1Edf99phWFdyQ +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "aqorders_invoice_currencies", + "Koha::Schema::Result::Aqorder", + { "foreign.invoice_currency" => "self.currency" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-06 16:45:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FmTABTXRmT/kwlkKkO/0pw sub koha_object_class { -- 2.39.5