From ea14cfa54fc510f47a4ec9a85939deacf780adde Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 26 Aug 2014 13:19:41 +0200 Subject: [PATCH] =?utf8?q?Einkaufs-/Verkaufsbelege:=20Spalte=20taxzone=5Fi?= =?utf8?q?d=20bereits=20beim=20INSERT=20bef=C3=BCllen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ansonsten gibt es wegen der neuen NOT NULL-Restriktion einen Fehler. --- SL/AP.pm | 6 +++--- SL/AR.pm | 4 ++-- SL/DO.pm | 4 ++-- SL/IR.pm | 2 +- SL/IS.pm | 4 ++-- SL/OE.pm | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/SL/AP.pm b/SL/AP.pm index cc7e06f94..4d651e412 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -167,10 +167,10 @@ sub post_transaction { ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|); $query = - qq|INSERT INTO ap (id, invnumber, employee_id,currency_id) | . + qq|INSERT INTO ap (id, invnumber, employee_id,currency_id, taxzone_id) | . qq|VALUES (?, ?, (SELECT e.id FROM employee e WHERE e.login = ?), - (SELECT id FROM currencies WHERE name = ?) )|; - do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $form->{login}, $form->{currency}); + (SELECT id FROM currencies WHERE name = ?), (SELECT taxzone_id FROM vendor WHERE id = ?) )|; + do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $form->{login}, $form->{currency}, $form->{vendor_id}); } diff --git a/SL/AR.pm b/SL/AR.pm index a842b9da5..95aba2680 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -135,8 +135,8 @@ sub post_transaction { } else { $query = qq|SELECT nextval('glid')|; ($form->{id}) = selectrow_query($form, $dbh, $query); - $query = qq|INSERT INTO ar (id, invnumber, employee_id, currency_id) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE name=?))|; - do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency}); + $query = qq|INSERT INTO ar (id, invnumber, employee_id, currency_id, taxzone_id) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE name=?), (SELECT taxzone_id FROM customer WHERE id = ?))|; + do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency}, $form->{customer_id}); if (!$form->{invnumber}) { my $trans_number = SL::TransNumber->new(type => 'invoice', dbh => $dbh, number => $form->{partnumber}, id => $form->{id}); $form->{invnumber} = $trans_number->create_unique; diff --git a/SL/DO.pm b/SL/DO.pm index 0960ad71f..f91f7ae3d 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -250,8 +250,8 @@ sub save { $query = qq|SELECT nextval('id')|; ($form->{id}) = selectrow_query($form, $dbh, $query); - $query = qq|INSERT INTO delivery_orders (id, donumber, employee_id, currency_id) VALUES (?, '', ?, (SELECT currency_id FROM defaults LIMIT 1))|; - do_query($form, $dbh, $query, $form->{id}, conv_i($form->{employee_id})); + $query = qq|INSERT INTO delivery_orders (id, donumber, employee_id, currency_id, taxzone_id) VALUES (?, '', ?, (SELECT currency_id FROM defaults LIMIT 1), ?)|; + do_query($form, $dbh, $query, $form->{id}, conv_i($form->{employee_id}), $form->{taxzone_id}); } my $project_id; diff --git a/SL/IR.pm b/SL/IR.pm index f880f862e..b36e6065a 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -81,7 +81,7 @@ sub post_invoice { &reverse_invoice($dbh, $form); } else { ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|); - do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber, currency_id) VALUES (?, '', (SELECT id FROM currencies WHERE name=?))|, $form->{id}, $form->{currency}); + do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber, currency_id, taxzone_id) VALUES (?, '', (SELECT id FROM currencies WHERE name=?), ?)|, $form->{id}, $form->{currency}, $form->{taxzone_id}); } } diff --git a/SL/IS.pm b/SL/IS.pm index 51f3c1bec..f429034e8 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -583,8 +583,8 @@ sub post_invoice { $query = qq|SELECT nextval('glid')|; ($form->{"id"}) = selectrow_query($form, $dbh, $query); - $query = qq|INSERT INTO ar (id, invnumber, currency_id) VALUES (?, ?, (SELECT id FROM currencies WHERE name=?))|; - do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}, $form->{currency}); + $query = qq|INSERT INTO ar (id, invnumber, currency_id, taxzone_id) VALUES (?, ?, (SELECT id FROM currencies WHERE name=?), ?)|; + do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}, $form->{currency}, $form->{taxzone_id}); if (!$form->{invnumber}) { my $trans_number = SL::TransNumber->new(type => $form->{type}, dbh => $dbh, number => $form->{invnumber}, id => $form->{id}); diff --git a/SL/OE.pm b/SL/OE.pm index e2663c513..279b08cce 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -393,8 +393,8 @@ sub save { $query = qq|SELECT nextval('id')|; ($form->{id}) = selectrow_query($form, $dbh, $query); - $query = qq|INSERT INTO oe (id, ordnumber, employee_id, currency_id) VALUES (?, '', ?, (SELECT currency_id FROM defaults))|; - do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}); + $query = qq|INSERT INTO oe (id, ordnumber, employee_id, currency_id, taxzone_id) VALUES (?, '', ?, (SELECT currency_id FROM defaults), ?)|; + do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{taxzone_id}); } my $amount = 0; -- 2.20.1