qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | .
qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| .
- qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| .
- qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| .
+ qq|LEFT JOIN tax_zones tz ON (tz.id = a.taxzone_id)| .
+ qq|LEFT JOIN payment_terms pt ON (pt.id = a.payment_id)| .
qq|LEFT JOIN business b ON (b.id = c.business_id)| .
qq|LEFT JOIN department d ON (d.id = a.department_id)|;
my $chart = $item->part->get_chart(type => $data->{is_sales} ? 'income' : 'expense', taxzone => $self->taxzone_id);
$data->{amounts}->{ $chart->id } ||= { taxkey => $taxkey->taxkey_id, tax_id => $taxkey->tax_id, amount => 0 };
$data->{amounts}->{ $chart->id }->{amount} += $linetotal;
+ $data->{amounts}->{ $chart->id }->{amount} -= $tax_amount if $self->taxincluded;
push @{ $data->{assembly_items} }, [];
if ($item->part->is_assembly) {
use Carp;
use List::Util qw(first);
+use List::MoreUtils qw(pairwise);
use SL::DB::MetaSetup::Invoice;
use SL::DB::Manager::Invoice;
use SL::DB::Helper::PriceTaxCalculator;
use SL::DB::Helper::PriceUpdater;
use SL::DB::Helper::TransNumberGenerator;
+use SL::DB::CustomVariable;
__PACKAGE__->meta->add_relationship(
invoiceitems => {
fxsellprice => $source_item->sellprice,);
} @{ $source->items_sorted };
+ my $i = 0;
+ foreach my $item (@items) {
+ my $source_cvars = $source->items_sorted->[$i]->cvars_by_config;
+ my $target_cvars = $item->cvars_by_config;
+ pairwise { $a->value($b->value) } @{ $target_cvars }, @{ $source_cvars };
+ $i++;
+ }
+
$invoice->invoiceitems(\@items);
return $invoice;
} else {
$i = $form->{assembly_rows};
}
- $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
+ $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"} > 0);
$form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"};
$form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
# set values for last invoice/order item
$i = $form->{rowcount};
- $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
+ $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"} > 0);
map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id);
map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields;
- Punkt in Belegnummer korrekt für WebDAV File Feature escapt (Bug 2394)
- Stornierte Rechnungen (sowohl die Stornorechnung als auch das Storno nicht
Buchen oder Löschen, egal was in der Mandantenkonfiguration steht)
+ - Wiederkehrende Rechnung mit Steuer inklusive buchen Erlöse falsch (Bug 2314)
2012-12-10 - Release 3.0.0
-- @tag: delete_close_follow_ups_when_order_is_deleted_closed
-- @description: Wiedervorlagen löschen/schließen, wenn dazugehörige Belege gelöscht/geschlossen werden
--- @depends: release_3_0_0
+-- @depends: delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion
-ALTER TABLE follow_up_links DROP CONSTRAINT follow_up_links_follow_up_id_fkey;
-ALTER TABLE follow_up_links ADD FOREIGN KEY (follow_up_id) REFERENCES follow_ups (id) ON DELETE CASCADE;
+ALTER TABLE follow_up_links ADD CONSTRAINT follow_up_links_follow_up_id_fkey FOREIGN KEY (follow_up_id) REFERENCES follow_ups (id) ON DELETE CASCADE;
CREATE OR REPLACE FUNCTION follow_up_delete_notes_trigger()
RETURNS TRIGGER AS $$
--- /dev/null
+# @tag: delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion
+# @description: Wiedervorlagen löschen/schließen, wenn dazugehörige Belege gelöscht/geschlossen werden Teil 1: Fremdschlüssel löschen
+# @depends: release_3_0_0
+package SL::DBUpgrade2::delete_close_follow_ups_when_order_is_deleted_closed_fkey_deletion;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+sub run {
+ my ($self) = @_;
+
+ $self->drop_constraints(table => "follow_up_links");
+
+ return 1;
+}
+
+1;