use SL::OE;
use SL::ReportGenerator;
+use SL::DB::Part;
+
use Data::Dumper;
require "bin/mozilla/common.pl";
show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
my $units = AM->retrieve_units(\%myconfig, $form);
+
+ my $part = 0;
+ if ( $form->{parts_id} ) {
+ $part = SL::DB::Part->new();
+ $part->id($form->{parts_id});
+ $part->load();
+ }
+
# der zweite Parameter von unit_select_data gibt den default-Namen (selected) vor
- $form->{UNITS} = AM->unit_select_data($units, $form->{partunit}, 0, $form->{partunit});
+ $form->{UNITS} = AM->unit_select_data($units, $form->{unit}, 0, $part ? $part->unit : 0);
if (scalar @{ $form->{WAREHOUSES} }) {
$form->{warehouse_id} ||= $form->{WAREHOUSES}->[0]->{id};
my $content;
- $form->{jsscript} = 1;
-
if ($form->{trans_type} eq 'removal') {
$form->{nextsub} = "removal_parts_selection";
$form->{title} = $locale->text('Removal from Warehouse');
"ean" => $form->{ean},
"description" => $form->{description});
- $form->show_generic_error($locale->text("The selected warehouse is empty.")) if (0 == scalar(@contents));
+ if (0 == scalar(@contents)) {
+ $form->show_generic_error($locale->text("The selected warehouse is empty, or no stocked items where found that match the filter settings."));
+ }
my $all_units = AM->retrieve_units(\%myconfig, $form);
}
$transfer->{comment} = $form->{comment};
+ $transfer->{change_default_bin} = $form->{change_default_bin};
push @transfers, $transfer;
} elsif (($form->{partnumber} && ($form->{partnumber} ne $form->{old_partnumber})) || $form->{description} || $form->{ean}) {
- $form->{no_services} = 1;
+# $form->{no_services} = 1; # services may now be transfered. fix for Bug 1383.
$form->{no_assemblies} = 0; # assemblies duerfen eingelagert werden (z.B. bei retouren)
my $parts = Common->retrieve_parts(\%myconfig, $form, 'description', 1);
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();
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();
$form->error($locale->text('The warehouse or the bin is missing.'));
}
- if (!$main::show_best_before) {
+ if (!$::instance_conf->get_show_bestbefore) {
$form->{bestbefore} = '';
}
# 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},
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)) });
'title' => $form->{title},
'attachment_basename' => strftime($locale->text('warehouse_journal_list') . '_%Y%m%d', localtime time));
$report->set_options_from_form();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
my $all_units = AM->retrieve_units(\%myconfig, $form);
my @contents = WH->get_warehouse_journal(%filter);
show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
- $form->{jsscript} = 1;
-
-# $form->{fokus} = "partnumber";
-# $form->{onload} .= "focus();";
$form->{title} = $locale->text("Report about warehouse contents");
$form->header();
my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber bestbefore qty stock_value);
# filter stuff
- map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber bestbefore);
+ 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}) {
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);
+ push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses date);
my %column_defs = (
'warehousedescription' => { 'text' => $locale->text('Warehouse'), },
$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();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
my $all_units = AM->retrieve_units(\%myconfig, $form);
my @contents = WH->get_warehouse_report(%filter);
my $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
- if (($form->{subtotal} eq 'Y')
+ if ( ($form->{subtotal} eq 'Y' && !$form->{report_generator_csv_options_for_import} )
&& (($idx == (scalar @contents - 1))
|| ($entry->{$sort_col} ne $contents[$idx + 1]->{$sort_col}))) {
$idx++;
}
- if ($column_defs{stock_value}->{visible}) {
+ if ( $column_defs{stock_value}->{visible} && !$form->{report_generator_csv_options_for_import} ) {
$report->add_separator();
my $row = { map { $_ => { 'data' => '', 'class' => 'listsubtotal', } } @columns };
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.');