Einkaufs- & Verkaufsbelege: Bearbeiter*in & Verkäufer*in mit aktueller Benutzer*in...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 22 May 2017 10:59:31 +0000 (12:59 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 22 May 2017 10:59:31 +0000 (12:59 +0200)
Dies ist nur ein Fallback, wenn bis zur Ausgabe des Form-Headers noch
nichts für die beiden Felder festgelegt wurde. Damit wird also
weiterhin eine Verkäufer*in aus den Kunden-/Lieferantenstammdaten
genommen, sofern dort eine hinterlegt ist.

Behebt #258.

bin/mozilla/do.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl

index 7340e66..adaeb27 100644 (file)
@@ -401,8 +401,11 @@ sub form_header {
   my $class       = "SL::DB::" . ($form->{vc} eq 'customer' ? 'Customer' : 'Vendor');
   $form->{VC_OBJ} = $class->load_cached($form->{ $form->{vc} . '_id' });
 
-  $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
-  $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
+  my $current_employee   = SL::DB::Manager::Employee->current;
+  $form->{employee_id}   = $form->{old_employee_id} if $form->{old_employee_id};
+  $form->{salesman_id}   = $form->{old_salesman_id} if $form->{old_salesman_id};
+  $form->{employee_id} ||= $current_employee->id;
+  $form->{salesman_id} ||= $current_employee->id;
 
   my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
   $form->get_lists("price_factors"  => "ALL_PRICE_FACTORS",
index 2d196cc..1fe448f 100644 (file)
@@ -391,8 +391,11 @@ sub form_header {
   $TMPL_VAR{customer_obj} = SL::DB::Customer->load_cached($form->{customer_id}) if $form->{customer_id};
   $TMPL_VAR{invoice_obj}  = SL::DB::Invoice->load_cached($form->{id})           if $form->{id};
 
-  $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
-  $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
+  my $current_employee   = SL::DB::Manager::Employee->current;
+  $form->{employee_id}   = $form->{old_employee_id} if $form->{old_employee_id};
+  $form->{salesman_id}   = $form->{old_salesman_id} if $form->{old_salesman_id};
+  $form->{employee_id} ||= $current_employee->id;
+  $form->{salesman_id} ||= $current_employee->id;
 
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
index 1a4f5ca..8f4f28a 100644 (file)
@@ -486,8 +486,11 @@ sub form_header {
 
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
-  $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
-  $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
+  my $current_employee   = SL::DB::Manager::Employee->current;
+  $form->{employee_id}   = $form->{old_employee_id} if $form->{old_employee_id};
+  $form->{salesman_id}   = $form->{old_salesman_id} if $form->{old_salesman_id};
+  $form->{employee_id} ||= $current_employee->id;
+  $form->{salesman_id} ||= $current_employee->id;
 
   # openclosed checkboxes
   my @tmp;