From: Moritz Bunkus Date: Tue, 26 Aug 2014 11:19:41 +0000 (+0200) Subject: Einkaufs-/Verkaufsbelege: Spalte taxzone_id bereits beim INSERT befüllen X-Git-Tag: release-3.2.0beta~339 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ea14cfa54fc510f47a4ec9a85939deacf780adde;p=kivitendo-erp.git Einkaufs-/Verkaufsbelege: Spalte taxzone_id bereits beim INSERT befüllen Ansonsten gibt es wegen der neuen NOT NULL-Restriktion einen Fehler. --- 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;