From: Bernd Bleßmann Date: Mon, 20 Sep 2021 09:22:25 +0000 (+0200) Subject: S/D/Order: new_from/new_from_multi: Bearbeiter ist immer der aktuelle Benutzer X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~344 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5c8a0b36440e012cd0a54e6b68eb3d1411243b1a;p=kivitendo-erp.git S/D/Order: new_from/new_from_multi: Bearbeiter ist immer der aktuelle Benutzer Bei Workflows zu neuen Belegen ist der Bearbeiter des neuen Belegs immer der aktuelle Benutzer, egal, was im vorherigen Beleg steht. --- diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index fe0b32153..f1cfba7f1 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -328,7 +328,7 @@ sub new_from { } my %args = ( map({ ( $_ => $source->$_ ) } qw(amount cp_id currency_id cusordnumber customer_id delivery_customer_id delivery_term_id delivery_vendor_id - department_id employee_id exchangerate globalproject_id intnotes marge_percent marge_total language_id netamount notes + department_id exchangerate globalproject_id intnotes marge_percent marge_total language_id netamount notes ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded tax_point taxzone_id transaction_description vendor_id )), @@ -336,13 +336,13 @@ sub new_from { closed => 0, delivered => 0, transdate => DateTime->today_local, + employee => SL::DB::Manager::Employee->current, ); if ( $is_abbr_any->(qw(sopo poso)) ) { $args{ordnumber} = undef; $args{quonumber} = undef; $args{reqdate} = DateTime->today_local->next_workday(); - $args{employee} = SL::DB::Manager::Employee->current; } if ( $is_abbr_any->(qw(sopo)) ) { $args{customer_id} = undef; @@ -448,7 +448,7 @@ sub new_from_multi { order_probability expected_billing_date)) { $attributes{$attr} = undef if any { ($sources->[0]->$attr//'') ne ($_->$attr//'') } @$sources; } - foreach my $attr (qw(cp_id currency_id employee_id salesman_id department_id + foreach my $attr (qw(cp_id currency_id salesman_id department_id delivery_customer_id delivery_vendor_id shipto_id globalproject_id exchangerate)) { $attributes{$attr} = undef if any { ($sources->[0]->$attr||0) != ($_->$attr||0) } @$sources; @@ -463,6 +463,9 @@ sub new_from_multi { # no periodic invoice config for new order $attributes{periodic_invoices_config} = undef; + # set emplyee to the current one + $attributes{employee} = SL::DB::Manager::Employee->current; + # copy global ordnumber, transdate, cusordnumber into item scope # unless already present there foreach my $attr (qw(ordnumber transdate cusordnumber)) {