X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fwh.pl;h=eb12fcb45aa1275f16195ab57930eb5a903061b2;hb=4b211b2b087d445984df5220437400bced1dd1dd;hp=26f22cef61e60857398fe5c065ddca062bb627b4;hpb=b2945bf61775161f9ce9be9bdbd106ad44247a14;p=kivitendo-erp.git diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 26f22cef6..eb12fcb45 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -44,6 +44,8 @@ use SL::WH; use SL::OE; use SL::ReportGenerator; +use SL::DB::Part; + use Data::Dumper; require "bin/mozilla/common.pl"; @@ -85,7 +87,16 @@ sub transfer_warehouse_selection { show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} }); my $units = AM->retrieve_units(\%myconfig, $form); - $form->{UNITS} = AM->unit_select_data($units, $form->{unit}, 0, $form->{partunit}); + + 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->{unit}, 0, $part ? $part->unit : 0); if (scalar @{ $form->{WAREHOUSES} }) { $form->{warehouse_id} ||= $form->{WAREHOUSES}->[0]->{id}; @@ -175,7 +186,9 @@ sub transfer_or_removal_prepare_contents { "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); @@ -310,7 +323,7 @@ sub transfer_stock_update_part { } 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); @@ -435,7 +448,7 @@ sub create_assembly { $form->error($locale->text('The warehouse or the bin is missing.')); } - if (!$main::show_best_before) { + if (!$::instance_conf->get_show_bestbefore) { $form->{bestbefore} = ''; } @@ -635,7 +648,9 @@ sub journal { my $form = $main::form; my %myconfig = %main::myconfig; + my $locale = $main::locale; + $form->{title} = $locale->text('Report about warehouse transactions'); $form->get_lists('warehouses' => { 'key' => 'WAREHOUSES', 'bins' => 'BINS', }); @@ -692,7 +707,7 @@ sub generate_journal { 'bin_from' => { 'text' => $locale->text('Bin From'), }, 'bin_to' => { 'text' => $locale->text('Bin To'), }, 'partnumber' => { 'text' => $locale->text('Part Number'), }, - 'partdescription' => { 'text' => $locale->text('Description'), }, + 'partdescription' => { 'text' => $locale->text('Part Description'), }, 'chargenumber' => { 'text' => $locale->text('Charge Number'), }, 'bestbefore' => { 'text' => $locale->text('Best Before'), }, 'qty' => { 'text' => $locale->text('Qty'), }, @@ -719,6 +734,7 @@ sub generate_journal { '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); @@ -788,9 +804,7 @@ sub report { $form->{jsscript} = 1; -# $form->{fokus} = "partnumber"; -# $form->{onload} .= "focus();"; - $form->{title} = $locale->text("Report about wareouse contents"); + $form->{title} = $locale->text("Report about warehouse contents"); $form->header(); print $form->parse_html_template("wh/report_filter", @@ -810,7 +824,7 @@ sub generate_report { my %myconfig = %main::myconfig; my $locale = $main::locale; - $form->{title} = $locale->text("Report about wareouse contents"); + $form->{title} = $locale->text("Report about warehouse contents"); $form->{sort} ||= 'partnumber'; my $sort_col = $form->{sort}; @@ -818,7 +832,7 @@ sub generate_report { 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); $filter{qty_op} = WH->convert_qty_op($form->{qty_op}); if ($filter{qty_op}) { @@ -836,13 +850,13 @@ 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); + push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses date); my %column_defs = ( 'warehousedescription' => { 'text' => $locale->text('Warehouse'), }, 'bindescription' => { 'text' => $locale->text('Bin'), }, 'partnumber' => { 'text' => $locale->text('Part Number'), }, - 'partdescription' => { 'text' => $locale->text('Description'), }, + 'partdescription' => { 'text' => $locale->text('Part Description'), }, 'chargenumber' => { 'text' => $locale->text('Charge Number'), }, 'bestbefore' => { 'text' => $locale->text('Best Before'), }, 'qty' => { 'text' => $locale->text('Qty'), }, @@ -867,6 +881,7 @@ sub generate_report { '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); @@ -889,7 +904,7 @@ sub generate_report { 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}))) { @@ -909,7 +924,7 @@ sub generate_report { $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 };