Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 7 Nov 2012 15:32:50 +0000 (16:32 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 7 Nov 2012 15:32:50 +0000 (16:32 +0100)
bin/mozilla/arap.pl
bin/mozilla/io.pl
locale/de/all

index 27b0e3b..fe5fa2d 100644 (file)
@@ -78,6 +78,7 @@ sub check_name {
 
       $form->{"${name}_id"} = $new_id;
 
+      _reset_salesman_id();
       IS->get_customer(\%myconfig, \%$form) if ($name eq 'customer');
       IR->get_vendor(\%myconfig, \%$form) if ($name eq 'vendor');
 
@@ -119,6 +120,7 @@ sub check_name {
         $form->{$name}        = $form->{name_list}[0]->{name};
         $form->{"old$name"}   = qq|$form->{$name}--$form->{"${name}_id"}|;
 
+        _reset_salesman_id();
         IS->get_customer(\%myconfig, \%$form) if ($name eq 'customer');
         IR->get_vendor(\%myconfig, \%$form) if ($name eq 'vendor');
 
@@ -266,6 +268,8 @@ sub name_selected {
   # index for new item
   my $i = $form->{ndx};
 
+  _reset_salesman_id();
+
   $form->{ $form->{vc} }    = $form->{"new_name_$i"};
   $form->{"$form->{vc}_id"} = $form->{"new_id_$i"};
   $form->{"old$form->{vc}"} =
@@ -286,6 +290,14 @@ sub name_selected {
   $main::lxdebug->leave_sub();
 }
 
+# Reset the $::form field 'salesman_id' to the ID of the currently
+# logged in user. Useful when changing to a customer/vendor that has
+# no salesman listed in their master data.
+sub _reset_salesman_id {
+  my $current_employee   = SL::DB::Manager::Employee->current;
+  $::form->{salesman_id} = $current_employee->id if $current_employee && exists $::form->{salesman_id};
+}
+
 sub check_project {
   $main::lxdebug->enter_sub();
 
index 698758e..37df554 100644 (file)
@@ -49,6 +49,7 @@ use SL::IO;
 
 use SL::DB::Language;
 use SL::DB::Printer;
+use SL::Helper::Flash;
 
 require "bin/mozilla/common.pl";
 
@@ -802,6 +803,7 @@ sub validate_items {
 
   # check if items are valid
   if ($form->{rowcount} == 1) {
+    flash('warning', $::locale->text('The action you\'ve chosen has not been executed because the document does not contain any item yet.'));
     &update;
     ::end_of_request();
   }
index 47b805c..e567fdb 100644 (file)
@@ -1874,6 +1874,7 @@ $self->{texts} = {
   'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.',
   'The account 3804 already exists, the update will be skipped.' => 'Das Konto 3804 existiert schon, das Update wird übersprungen.',
   'The account 3804 will not be added automatically.' => 'Das Konto 3804 wird nicht automatisch hinzugefügt.',
+  'The action you\'ve chosen has not been executed because the document does not contain any item yet.' => 'Die von Ihnen ausgewählte Aktion wurde nicht ausgeführt, weil der Beleg noch keine Positionen enthält.',
   'The application "#1" was not found on the system.' => 'Die Anwendung "#1" wurde auf dem System nicht gefunden.',
   'The assembly has been created.' => 'Das Erzeugnis wurde hergestellt.',
   'The assistant could not find anything wrong with #1. Maybe the problem has been solved in the meantime.' => 'Der Korrekturassistent konnte kein Problem bei #1 feststellen. Eventuell wurde das Problem in der Zwischenzeit bereits behoben.',