Ansprechpersonen-Drop-Downs in mehreren Masken sortiert anzeigen
[kivitendo-erp.git] / bin / mozilla / do.pl
index b0b9f62..a804dee 100644 (file)
@@ -271,12 +271,12 @@ sub form_header {
                    "business_types" => "ALL_BUSINESS_TYPES",
     );
 
-  $::form->{ALL_EMPLOYEES}         = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id},  deleted => 0 ] ]);
-  $::form->{ALL_SALESMEN}          = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id},  deleted => 0 ] ]);
+  $::form->{ALL_EMPLOYEES}         = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id},  deleted => 0 ] ]);
+  $::form->{ALL_SALESMEN}          = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id},  deleted => 0 ] ]);
   $::form->{ALL_SHIPTO}            = SL::DB::Manager::Shipto->get_all(query => [
     or => [ trans_id  => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ]
   ]);
-  $::form->{ALL_CONTACTS}          = SL::DB::Manager::Contact->get_all(query => [
+  $::form->{ALL_CONTACTS}          = SL::DB::Manager::Contact->get_all_sorted(query => [
     or => [
       cp_cv_id => $::form->{"$::form->{vc}_id"} * 1,
       and      => [
@@ -302,7 +302,7 @@ sub form_header {
     # emulate click for resubmitting actions
     $dispatch_to_popup  = "document.do.${_}.click(); " for grep { /^action_/ } keys %$form;
   }
-  $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup})");
+  $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});");
 
 
   my $follow_up_vc                =  $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
@@ -310,6 +310,8 @@ sub form_header {
 
   $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')';
 
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
+
   $form->header();
   # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID'
   # und Erweiterung für Bug 1760:
@@ -464,7 +466,7 @@ sub search {
                                        "all" => 1 },
                    "departments"  => "ALL_DEPARTMENTS",
                    "$form->{vc}s" => "ALL_VC");
-  $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
+  $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
 
   $form->{SHOW_VC_DROP_DOWN} =  $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
   $form->{title}             = $locale->text('Delivery Orders');
@@ -1327,6 +1329,8 @@ sub transfer_in {
         $request->{parts_id}  = $form->{"id_$i"};
         $row_sum_base_qty    += $request->{qty} * $units->{$request->{unit}}->{factor} / $base_unit_factor;
 
+        $request->{project_id} = $form->{"project_id_$i"} || $form->{globalproject_id};
+
         push @all_requests, $request;
       }