Auftrags-Controller: Einheiten per Select ändern können und sellprice anpassen.
[kivitendo-erp.git] / bin / mozilla / wh.pl
index 92cfcb6..fbc645e 100644 (file)
@@ -105,8 +105,6 @@ sub transfer_warehouse_selection {
 
   my $content;
 
-  $form->{jsscript} = 1;
-
   if ($form->{trans_type} eq 'removal') {
     $form->{nextsub} = "removal_parts_selection";
     $form->{title}   = $locale->text('Removal from Warehouse');
@@ -282,6 +280,7 @@ sub transfer_parts {
     }
 
     $transfer->{comment} = $form->{comment};
+    $transfer->{change_default_bin} = $form->{change_default_bin};
 
     push @transfers, $transfer;
 
@@ -331,7 +330,7 @@ sub transfer_stock_update_part {
     if (!scalar @{ $parts }) {
       new_item(action => "transfer_stock_update_part");
     } elsif (scalar @{ $parts } == 1) {
-      @{$form}{qw(parts_id partnumber description ean)} = @{$parts->[0]}{qw(id partnumber description ean)};
+      @{$form}{qw(parts_id partnumber description ean warehouse_id bin_id)} = @{$parts->[0]}{qw(id partnumber description ean warehouse_id bin_id)};
       transfer_stock_get_partunit();
       transfer_warehouse_selection();
 
@@ -398,7 +397,7 @@ sub transfer_stock_part_selected {
 
   my $form     = $main::form;
 
-  @{$form}{qw(parts_id partnumber description ean)} = @{$part}{qw(id partnumber description ean)};
+  @{$form}{qw(parts_id partnumber description ean warehouse_id bin_id)} = @{$part}{qw(id partnumber description ean warehouse_id bin_id)};
 
   transfer_stock_get_partunit();
   transfer_warehouse_selection();
@@ -456,7 +455,7 @@ sub create_assembly {
   # Anm. jb 18.3. vielleicht auch nur meine unwissenheit in perl-datenstrukturen
   my %TRANSFER = (
     'transfer_type'    => 'assembly',
-    'login'            => $form->{login},
+    'login'            => $::myconfig{login},
     'dst_warehouse_id' => $form->{warehouse_id},
     'dst_bin_id'       => $form->{bin_id},
     'chargenumber'     => $form->{chargenumber},
@@ -656,8 +655,6 @@ sub journal {
 
   show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
 
-  $form->{jsscript} = 1;
-
   $form->header();
   print $form->parse_html_template("wh/journal_filter", { "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
 
@@ -802,8 +799,6 @@ sub report {
 
   show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
 
-  $form->{jsscript} = 1;
-
   $form->{title}   = $locale->text("Report about warehouse contents");
 
   $form->header();
@@ -834,6 +829,26 @@ sub generate_report {
   # filter stuff
   map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber bestbefore date include_invalid_warehouses);
 
+  # show filter stuff also in report
+  my @options;
+  # dispatch all options
+  my $dispatch_options = {
+   warehouse_id   => sub { push @options, $locale->text('Warehouse') . " : " .
+                                            SL::DB::Manager::Warehouse->find_by(id => $form->{warehouse_id})->description},
+   bin_id         => sub { push @options, $locale->text('Bin') . " : " .
+                                            SL::DB::Manager::Bin->find_by(id => $form->{bin_id})->description},
+   partnumber     => sub { push @options, $locale->text('Partnumber')     . " : $form->{partnumber}"},
+   description    => sub { push @options, $locale->text('Description')    . " : $form->{description}"},
+   chargenumber   => sub { push @options, $locale->text('Charge Number')  . " : $form->{chargenumber}"},
+   bestbefore     => sub { push @options, $locale->text('Best Before')    . " : $form->{bestbefore}"},
+   date           => sub { push @options, $locale->text('Date')           . " : $form->{date}"},
+   include_invalid_warehouses    => sub { push @options, $locale->text('Include invalid warehouses ')},
+  };
+  foreach (keys %filter) {
+   $dispatch_options->{$_}->() if $dispatch_options->{$_};
+  }
+  # / end show filter stuff also in report
+
   $filter{qty_op} = WH->convert_qty_op($form->{qty_op});
   if ($filter{qty_op}) {
     $form->isblank("qty",      $locale->text('Quantity missing.'));
@@ -850,7 +865,7 @@ sub generate_report {
 
   my @hidden_variables = map { "l_${_}" } @columns;
   push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit l_warehousedescription l_bindescription);
-  push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses);
+  push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses date);
 
   my %column_defs = (
     'warehousedescription' => { 'text' => $locale->text('Warehouse'), },
@@ -877,7 +892,8 @@ sub generate_report {
 
   $report->set_sort_indicator($sort_col, $form->{order});
 
-  $report->set_options('output_format'        => 'HTML',
+  $report->set_options('top_info_text'        => join("\n", @options),
+                       'output_format'        => 'HTML',
                        'title'                => $form->{title},
                        'attachment_basename'  => strftime($locale->text('warehouse_report_list') . '_%Y%m%d', localtime time));
   $report->set_options_from_form();
@@ -956,7 +972,7 @@ sub show_no_warehouses_error {
 
   my $msg = $locale->text('No warehouse has been created yet or the quantity of the bins is not configured yet.') . ' ';
 
-  if ($main::auth->check_right($form->{login}, 'config')) {
+  if ($main::auth->check_right($::myconfig{login}, 'config')) {
     $msg .= $locale->text('You can create warehouses and bins via the menu "System -> Warehouses".');
   } else {
     $msg .= $locale->text('Please ask your administrator to create warehouses and bins.');