X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=7d24943241a9ef4661fd2359360effa23951aa6c;hb=f3086ca05027abfa6affcc8ffa0fe9f8d096b24a;hp=f890cee12f8a02f1a130f91d467d7054fc8eca84;hpb=710ebb28d9a0f0125dd7e7d1f0662d3127ac1328;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index f890cee12..7d2494324 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -193,9 +193,11 @@ sub display_row { _update_part_information(); _update_ship() if ($is_s_p_order); + _update_custom_variables(); # rows for $i (1 .. $numrows) { + my %column_data = (); # undo formatting map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty discount sellprice price_new price_old) unless ($form->{simple_save}); @@ -356,6 +358,9 @@ sub display_row { $form->{invsubtotal} += $linetotal; + # Benutzerdefinierte Variablen für Waren/Dienstleistungen/Erzeugnisse + _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i); + push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, }; } @@ -441,6 +446,13 @@ sub select_item { print qq||; + my @new_fields = + qw(bin listprice inventory_accno income_accno expense_accno unit weight + assembly taxaccounts partsgroup formel longdescription not_discountable + part_payment_id partnotes id lastcost price_factor_id price_factor); + push @new_fields, "lizenzen" if ($lizenzen); + push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] }; + my $i = 0; foreach $ref (@{ $form->{item_list} }) { $checked = ($i++) ? "" : "checked"; @@ -494,12 +506,6 @@ sub select_item { print("\n"); - my @new_fields = - qw(bin listprice inventory_accno income_accno expense_accno unit weight - assembly taxaccounts partsgroup formel longdescription not_discountable - part_payment_id partnotes id lastcost price_factor_id price_factor); - push(@new_fields, "lizenzen") if ($lizenzen); - print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields; print "\n"; } @@ -562,6 +568,9 @@ sub item_selected { partsgroup formel longdescription not_discountable partnotes lastcost price_factor_id price_factor); + my $ic_cvar_configs = CVar->get_configs(module => 'IC'); + push @new_fields, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; + map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new_fields; $form->{"marge_price_factor_$i"} = $form->{"new_price_factor_$j"}; @@ -672,16 +681,6 @@ sub check_form { my @a = (); my $count = 0; - my @flds = qw(id partnumber description qty ship sellprice unit - discount inventory_accno income_accno expense_accno listprice - taxaccounts bin assembly weight projectnumber project_id - oldprojectnumber runningnumber serialnumber partsgroup payment_id - not_discountable shop ve gv buchungsgruppen_id language_values - sellprice_pg pricegroup_old price_old price_new unit_old ordnumber - transdate longdescription basefactor marge_total marge_percent - marge_price_factor lastcost price_factor_id partnotes - stock_out stock_in); - # remove any makes or model rows if ($form->{item} eq 'part') { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } @@ -695,8 +694,7 @@ sub check_form { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice rop stock); - @flds = - qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost); + my @flds = qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost); for my $i (1 .. ($form->{assembly_rows} - 1)) { if ($form->{"qty_$i"}) { @@ -725,6 +723,18 @@ sub check_form { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost); } else { + my @flds = qw(id partnumber description qty ship sellprice unit + discount inventory_accno income_accno expense_accno listprice + taxaccounts bin assembly weight projectnumber project_id + oldprojectnumber runningnumber serialnumber partsgroup payment_id + not_discountable shop ve gv buchungsgruppen_id language_values + sellprice_pg pricegroup_old price_old price_new unit_old ordnumber + transdate longdescription basefactor marge_total marge_percent + marge_price_factor lastcost price_factor_id partnotes + stock_out stock_in); + + my $ic_cvar_configs = CVar->get_configs(module => 'IC'); + push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; # this section applies to invoices and orders # remove any empty numbers @@ -1936,3 +1946,47 @@ sub _update_ship { $lxdebug->leave_sub(); } + +sub _update_custom_variables { + $lxdebug->enter_sub(); + + $form->{CVAR_CONFIGS} ||= { }; + $form->{CVAR_CONFIGS}->{IC} = CVar->get_configs(module => 'IC'); + + $lxdebug->leave_sub(); +} + +sub _render_custom_variables_inputs { + $lxdebug->enter_sub(); + + my %params = @_; + + if (!$form->{CVAR_CONFIGS}->{IC}) { + $lxdebug->leave_sub(); + return; + } + + foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { + $cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"}; + } + + CVar->render_inputs(hide_non_editable => 1, + variables => $form->{CVAR_CONFIGS}->{IC}, + name_prefix => 'ic_', + name_postfix => "_$params{row}"); + + my $num_visible_cvars = 0; + foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { + my $description = ''; + if ($cvar->{flag_editable}) { + $num_visible_cvars++; + $description = $cvar->{description} . ' '; + } + + push @{ $params{ROW2} }, { line_break => $num_visible_cvars == 1, + value => $description . $cvar->{HTML_CODE}, + }; + } + + $lxdebug->leave_sub(); +}