X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=5af1b88174fec51c9f09db328f246d58788ae446;hb=273b5e046f1dab732ece657a756ada58d7669b9d;hp=1cfc0ca57e1cfe8ca389f506872002700f4fb8c7;hpb=3b32e1ddebd2304859df8f2322f8fc27ad94136f;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 1cfc0ca57..5af1b8817 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -47,9 +47,11 @@ use SL::CT; use SL::IC; use SL::IO; +use SL::DB::Customer; use SL::DB::Default; use SL::DB::Language; use SL::DB::Printer; +use SL::DB::Vendor; use SL::Helper::CreatePDF; use SL::Helper::Flash; @@ -275,7 +277,12 @@ sub display_row { my $linetotal = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * (100 - $form->{"discount_$i"}) / 100 / $price_factor, 2); my $rows = $form->numtextrows($form->{"description_$i"}, 30, 6); - $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -id => "runningnumber_$i", -size => 5, -value => $i); # HuT + # quick delete single row + $column_data{runningnumber} .= q|| . + q|| . $locale->text('Remove') . q| |; + $column_data{runningnumber} .= $cgi->textfield(-name => "runningnumber_$i", -id => "runningnumber_$i", -size => 5, -value => $i); # HuT + + $column_data{partnumber} = $cgi->textfield(-name => "partnumber_$i", -id => "partnumber_$i", -size => 12, -value => $form->{"partnumber_$i"}); $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead ? $cgi->textarea( -name => "description_$i", -id => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30) @@ -869,8 +876,6 @@ sub order { } $form->{script} = 'oe.pl'; - $form->{shipto} = 1; - $form->{rowcount}--; $form->{cp_id} *= 1; @@ -935,8 +940,6 @@ sub quotation { $form->{script} = 'oe.pl'; - $form->{shipto} = 1; - $form->{rowcount}--; require "bin/mozilla/$form->{script}"; @@ -997,6 +1000,10 @@ sub edit_e_mail { $form->{oldmedia} = $form->{media}; $form->{media} = "email"; + my $global_bcc = AM->get_defaults()->{global_bcc}; + + $form->{bcc} = join ', ', grep $_, $form->{bcc}, $global_bcc; + my $attachment_filename = $form->generate_attachment_filename(); my $subject = $form->{subject} || $form->generate_email_subject(); @@ -1232,7 +1239,7 @@ sub print_form { $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; $form->{templates} = $defaults->templates; - my ($old_form) = @_; + my ($old_form, %params) = @_; my $inv = "inv"; my $due = "due"; @@ -1417,28 +1424,6 @@ sub print_form { $form->get_shipto(\%myconfig); } - my @a = qw(name department_1 department_2 street zipcode city country contact phone fax email); - - my $shipto = 1; - - # if there is no shipto fill it in from billto - foreach my $item (@a) { - if ($form->{"shipto$item"}) { - $shipto = 0; - last; - } - } - - if ($shipto) { - if ( $form->{formname} eq 'purchase_order' - || $form->{formname} eq 'request_quotation') { - $form->{shiptoname} = $defaults->company; - $form->{shiptostreet} = $defaults->address; - } else { - map { $form->{"shipto$_"} = $form->{$_} } @a; - } - } - $form->{notes} =~ s/^\s+//g; delete $form->{printer_command}; @@ -1662,7 +1647,10 @@ sub print_form { ($form->{media} eq 'printer') ? $locale->text('sent to printer') : $locale->text('emailed to') . " $form->{email}"; - $form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|); + + if (!$params{no_redirect}) { + $form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|); + } } if ($form->{printing}) { call_sub($display_form); @@ -1736,8 +1724,11 @@ sub ship_to { $::form->{title} = $::locale->text('Ship to'); $::form->header; + my $vc_obj = ($::form->{vc} eq 'customer' ? "SL::DB::Customer" : "SL::DB::Vendor")->new(id => $::form->{$::form->{vc} . "_id"})->load; + print $::form->parse_html_template('io/ship_to', { previousform => $previous_form, nextsub => $::form->{display_form} || 'display_form', + vc_obj => $vc_obj, }); $main::lxdebug->leave_sub(); @@ -1879,29 +1870,48 @@ sub _render_custom_variables_inputs { my $valid = CVar->custom_variables_validity_by_trans_id(trans_id => $params{part_id}); + # get partsgroup_id from part + my $partsgroup_id; + if ($params{part_id}) { + $partsgroup_id = SL::DB::Part->new(id => $params{part_id})->load->partsgroup_id; + } + my $num_visible_cvars = 0; foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { $cvar->{valid} = $params{part_id} && $valid->($cvar->{id}); + # set partsgroup filter + my $partsgroup_filtered = 0; + if ($cvar->{flag_partsgroup_filter}) { + if (!$partsgroup_id || (!grep {$partsgroup_id == $_} @{ $cvar->{partsgroups} })) { + $partsgroup_filtered = 1; + } + } + + my $hide_non_editable = 1; + + my $show = 0; my $description = ''; - if ($cvar->{flag_editable} && $cvar->{valid}) { + if (( ($cvar->{flag_editable} || !$hide_non_editable) && $cvar->{valid}) && !$partsgroup_filtered) { $num_visible_cvars++; $description = $cvar->{description} . ' '; + $show = 1; } my $form_key = "ic_cvar_" . $cvar->{name} . "_$params{row}"; push @{ $params{ROW2} }, { - line_break => $num_visible_cvars == 1, + line_break => $show && !(($num_visible_cvars - 1) % ($::myconfig{form_cvars_nr_cols}*1 || 3)), description => $description, cvar => 1, render_options => { - hide_non_editable => 1, + hide_non_editable => $hide_non_editable, var => $cvar, name_prefix => 'ic_', name_postfix => "_$params{row}", valid => $cvar->{valid}, value => CVar->parse($::form->{$form_key}, $cvar), + partsgroup_filtered => $partsgroup_filtered, } }; }