From 27fe7b11f5817702c3b47d0187bc9f0ba5328e2f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Sun, 16 May 2021 15:38:05 +0200 Subject: [PATCH] Reverts 01f650056 --- SL/DB/Helper/Mappings.pm | 1 - SL/DB/MetaSetup/AssemblyInventoryPart.pm | 37 --------------------- SL/WH.pm | 12 ------- sql/Pg-upgrade2/assembly_inventory_part.sql | 15 --------- 4 files changed, 65 deletions(-) delete mode 100644 SL/DB/MetaSetup/AssemblyInventoryPart.pm delete mode 100644 sql/Pg-upgrade2/assembly_inventory_part.sql diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 51350ebd0..94f7e4744 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -99,7 +99,6 @@ my %kivitendo_package_names = ( ar => 'invoice', ap => 'purchase_invoice', assembly => 'assembly', - assembly_inventory_part => 'assembly_inventory_part', assortment_items => 'assortment_item', background_jobs => 'background_job', background_job_histories => 'background_job_history', diff --git a/SL/DB/MetaSetup/AssemblyInventoryPart.pm b/SL/DB/MetaSetup/AssemblyInventoryPart.pm deleted file mode 100644 index d13a67155..000000000 --- a/SL/DB/MetaSetup/AssemblyInventoryPart.pm +++ /dev/null @@ -1,37 +0,0 @@ -# This file has been auto-generated. Do not modify it; it will be overwritten -# by rose_auto_create_model.pl automatically. -package SL::DB::AssemblyInventoryPart; - -use strict; - -use parent qw(SL::DB::Object); - -__PACKAGE__->meta->table('assembly_inventory_part'); - -__PACKAGE__->meta->columns( - inventory_assembly_id => { type => 'integer', not_null => 1 }, - inventory_part_id => { type => 'integer', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, -); - -__PACKAGE__->meta->primary_key_columns([ 'inventory_assembly_id', 'inventory_part_id' ]); - -__PACKAGE__->meta->unique_keys([ 'inventory_part_id', 'inventory_assembly_id' ]); - -__PACKAGE__->meta->allow_inline_column_values(1); - -__PACKAGE__->meta->foreign_keys( - inventory_assembly => { - class => 'SL::DB::Inventory', - key_columns => { inventory_assembly_id => 'id' }, - }, - - inventory_part => { - class => 'SL::DB::Inventory', - key_columns => { inventory_part_id => 'id' }, - }, -); - -1; -; diff --git a/SL/WH.pm b/SL/WH.pm index 6d7a61393..722916bf1 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -233,9 +233,6 @@ sub transfer_assembly { my $sth_part_qty_assembly = prepare_execute_query($form, $dbh, $query, $params{assembly_id}); my @trans_ids; - my $query_trans_id = qq|SELECT nextval('inventory_id_seq')|; - my $query_trans_ids = qq|INSERT INTO assembly_inventory_part (inventory_assembly_id, inventory_part_id) VALUES (?, ?)|; - my $sth_query_trans_ids = prepare_query($form, $dbh, $query_trans_ids); # Hier wird das prepared Statement für die Schleife über alle Lagerplätze vorbereitet my $transferPartSQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, bestbefore, comment, employee_id, qty, @@ -283,8 +280,6 @@ sub transfer_assembly { my $temppart_qty = $partsQTY * -1; ($trans_id) = selectrow_query($form, $dbh, qq|SELECT nextval('id')| ) unless $trans_id; - my ($trans_id) = selectrow_query($form, $dbh, $query_trans_id); - push @trans_ids, $trans_id; do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $currentPart_WH_ID, $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' . $self->get_part_description(parts_id => $params{assembly_id}), $params{login}, $temppart_qty, $trans_id); @@ -333,7 +328,6 @@ sub transfer_assembly { # wenn * -1 als berechnung in der parameter-übergabe angegeben wird. # Dieser Wert IST und BLEIBT positiv!! Hilfe. # Liegt das daran, dass dieser Wert aus einem SQL-Statement stammt? - my ($trans_id) = selectrow_query($form, $dbh, $query_trans_id); push @trans_ids, $trans_id; do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $currentPart_WH_ID, $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' . @@ -345,8 +339,6 @@ sub transfer_assembly { # auf jeden fall war der internal-server-error nach aktivierung von strict und warnings plus ein paar my-definitionen weg } else { # okay, wir haben weniger oder gleich Waren die wir wegbuchen müssen, wir können also aufhören $tmpPartsQTY *=-1; - my ($trans_id) = selectrow_query($form, $dbh, $query_trans_id); - push @trans_ids, $trans_id; do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $currentPart_WH_ID, $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' . $self->get_part_description(parts_id => $params{assembly_id}), $params{login}, $tmpPartsQTY, $trans_id); @@ -375,10 +367,6 @@ sub transfer_assembly { do_statement($form, $sthTransferAssemblySQL, $transferAssemblySQL, $params{assembly_id}, $params{dst_warehouse_id}, $params{dst_bin_id}, $params{chargenumber}, conv_date($params{bestbefore}), $params{comment}, $params{login}, $params{qty}, $trans_id); - # save inventory transactions for this assembly - for my $part_id (@trans_ids) { - do_statement($form, $sth_query_trans_ids, $query_trans_ids, $trans_id, $part_id); - } 1; }) or do { return $kannNichtFertigen }; diff --git a/sql/Pg-upgrade2/assembly_inventory_part.sql b/sql/Pg-upgrade2/assembly_inventory_part.sql deleted file mode 100644 index 130191189..000000000 --- a/sql/Pg-upgrade2/assembly_inventory_part.sql +++ /dev/null @@ -1,15 +0,0 @@ --- @tag: assembly_inventory_part --- @description: Tabelle für die wirklich verbauten Einzelteile eines Erzeugnis --- @depends: warehouse release_3_5_6_1 - - -CREATE TABLE assembly_inventory_part ( - inventory_part_id INTEGER REFERENCES inventory(id), - inventory_assembly_id INTEGER REFERENCES inventory(id), - itime TIMESTAMP DEFAULT now(), - mtime TIMESTAMP, - - PRIMARY KEY (inventory_assembly_id, inventory_part_id) -); - -CREATE TRIGGER mtime_assembly_inventory_part BEFORE UPDATE ON assembly_inventory_part FOR EACH ROW EXECUTE PROCEDURE set_mtime(); -- 2.20.1