From: Moritz Bunkus Date: Thu, 2 Jul 2009 14:44:11 +0000 (+0200) Subject: Ausweitung der benutzerdefinierten Variablen für Waren/Dienstleistungen/Erzeugnisse... X-Git-Tag: release-2.6.1beta1~369 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ef220490853ca3b41b4b67568af4bf6b6dc5cc30;p=kivitendo-erp.git Ausweitung der benutzerdefinierten Variablen für Waren/Dienstleistungen/Erzeugnisse auf Anzeige/Modifikation in Angeboten/Aufträgen. --- diff --git a/SL/CVar.pm b/SL/CVar.pm index 27febc5b6..6e99ae404 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -33,6 +33,8 @@ sub get_configs { $config->{precision} = $1 if ($config->{options} =~ m/precision=(\d+)/i); } + + $self->_unpack_flags($config); } $main::lxdebug->leave_sub(); @@ -57,11 +59,30 @@ sub get_config { my $config = selectfirst_hashref_query($form, $dbh, $query, conv_i($params{id})) || { }; + $self->_unpack_flags($config); + $main::lxdebug->leave_sub(); return $config; } +sub _unpack_flags { + $main::lxdebug->enter_sub(); + + my $self = shift; + my $config = shift; + + foreach my $flag (split m/:/, $config->{flags}) { + if ($flag =~ m/(.*?)=(.*)/) { + $config->{"flag_${1}"} = $2; + } else { + $config->{"flag_${flag}"} = 1; + } + } + + $main::lxdebug->leave_sub(); +} + sub save_config { $main::lxdebug->enter_sub(); @@ -177,6 +198,7 @@ sub get_custom_variables { qq|SELECT text_value, timestamp_value, timestamp_value::date AS date_value, number_value, bool_value FROM custom_variables WHERE (config_id = ?) AND (trans_id = ?)|; + $q_var .= qq| AND (sub_module = ?)| if $params{sub_module}; my $h_var = prepare_query($form, $dbh, $q_var); my $custom_variables = selectall_hashref_query($form, $dbh, $q_cfg, $params{module}); @@ -201,7 +223,10 @@ sub get_custom_variables { my $act_var; if ($params{trans_id}) { - do_statement($form, $h_var, $q_var, conv_i($cvar->{id}), conv_i($params{trans_id})); + my @values = (conv_i($cvar->{id}), conv_i($params{trans_id})); + push @values, $params{sub_module} if $params{sub_module}; + + do_statement($form, $h_var, $q_var, @values); $act_var = $h_var->fetchrow_hashref(); } @@ -263,7 +288,7 @@ sub save_custom_variables { my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); - my @configs = grep { $_->{module} eq $params{module} } @{ CVar->get_configs() }; + my @configs = $params{configs} ? @{ $params{configs} } : grep { $_->{module} eq $params{module} } @{ CVar->get_configs() }; my $query = qq|DELETE FROM custom_variables @@ -271,17 +296,24 @@ sub save_custom_variables { AND (config_id IN (SELECT DISTINCT id FROM custom_variable_configs WHERE module = ?))|; - do_query($form, $dbh, $query, conv_i($params{trans_id}), $params{module}); + my @values = (conv_i($params{trans_id}), $params{module}); + + if ($params{sub_module}) { + $query .= qq| AND (sub_module = ?)|; + push @values, $params{sub_module}; + } + + do_query($form, $dbh, $query, @values); $query = - qq|INSERT INTO custom_variables (config_id, trans_id, bool_value, timestamp_value, text_value, number_value) - VALUES (?, ?, ?, ?, ?, ?)|; + qq|INSERT INTO custom_variables (config_id, sub_module, trans_id, bool_value, timestamp_value, text_value, number_value) + VALUES (?, ?, ?, ?, ?, ?, ?)|; my $sth = prepare_query($form, $dbh, $query); foreach my $config (@configs) { - my @values = (conv_i($config->{id}), conv_i($params{trans_id})); + my @values = (conv_i($config->{id}), "$params{sub_module}", conv_i($params{trans_id})); - my $value = $params{variables}->{"cvar_$config->{name}"}; + my $value = $params{variables}->{"$params{name_prefix}cvar_$config->{name}$params{name_postfix}"}; if (($config->{type} eq 'text') || ($config->{type} eq 'textfield') || ($config->{type} eq 'select')) { push @values, undef, undef, $value, undef; @@ -317,8 +349,13 @@ sub render_inputs { my $myconfig = \%main::myconfig; my $form = $main::form; + my %options = ( name_prefix => "$params{name_prefix}", + name_postfix => "$params{name_postfix}", + hide_non_editable => $params{hide_non_editable}, + ); + foreach my $var (@{ $params{variables} }) { - $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var }); + $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var, %options }); } $main::lxdebug->leave_sub(); @@ -434,6 +471,9 @@ sub build_filter_query { } if (@sub_where) { + push @sub_where, qq|cvar.sub_module = ?|; + push @sub_values, "$params{sub_module}"; + push @where, qq|$not EXISTS( SELECT cvar.id @@ -481,11 +521,13 @@ sub add_custom_variables_to_report { my $query = qq|SELECT text_value, timestamp_value, timestamp_value::date AS date_value, number_value, bool_value, config_id FROM custom_variables - WHERE (config_id IN (| . join(', ', ('?') x scalar(@cfg_ids)) . qq|)) AND (trans_id = ?)|; + WHERE (config_id IN (| . join(', ', ('?') x scalar(@cfg_ids)) . qq|)) + AND (trans_id = ?) + AND (sub_module = ?)|; my $sth = prepare_query($form, $dbh, $query); foreach my $row (@{ $params{data} }) { - do_statement($form, $sth, $query, @cfg_ids, conv_i($row->{$params{trans_id_field}})); + do_statement($form, $sth, $query, @cfg_ids, conv_i($row->{$params{trans_id_field}}), "$params{sub_module}"); while (my $ref = $sth->fetchrow_hashref()) { my $cfg = $cfg_map{$ref->{config_id}}; diff --git a/SL/IS.pm b/SL/IS.pm index f1c95e957..12b8e3a88 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1908,6 +1908,19 @@ sub retrieve_item { } } $sth->finish; + + foreach my $item (@{ $form->{item_list} }) { + my $custom_variables = CVar->get_custom_variables(module => 'IC', + trans_id => $item->{id}, + dbh => $dbh, + ); + + $main::lxdebug->dump(0, "cvar", $custom_variables); + map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables }; + } + + $main::lxdebug->dump(0, "items", $form->{item_list}); + $dbh->disconnect; $main::lxdebug->leave_sub(); diff --git a/SL/OE.pm b/SL/OE.pm index 9adbee2eb..6f7f9fc2a 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -37,6 +37,7 @@ package OE; use List::Util qw(max first); use SL::AM; use SL::Common; +use SL::CVar; use SL::DBUtils; use SL::IC; @@ -248,6 +249,9 @@ sub save { my $all_units = AM->retrieve_units($myconfig, $form); $form->{all_units} = $all_units; + my $ic_cvar_configs = CVar->get_configs(module => 'IC', + dbh => $dbh); + $form->{employee_id} = (split /--/, $form->{employee})[1] if !$form->{employee_id}; unless ($form->{employee_id}) { $form->get_employee($dbh); @@ -256,6 +260,11 @@ sub save { my $ml = ($form->{type} eq 'sales_order') ? 1 : -1; if ($form->{id}) { + $query = qq|DELETE FROM custom_variables + WHERE (config_id IN (SELECT id FROM custom_variable_configs WHERE module = 'IC')) + AND (sub_module = 'orderitems') + AND (trans_id IN (SELECT id FROM orderitems WHERE trans_id = ?))|; + do_query($form, $dbh, $query, $form->{id}); $query = qq|DELETE FROM orderitems WHERE trans_id = ?|; do_query($form, $dbh, $query, $form->{id}); @@ -379,24 +388,19 @@ sub save { $pricegroup_id *= 1; # save detail record in orderitems table + my $orderitems_id = $form->{"orderitems_id_$i"}; + ($orderitems_id) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('orderitemsid')|) if (!$orderitems_id); + @values = (); - $query = qq|INSERT INTO orderitems (|; - if ($form->{"orderitems_id_$i"}) { - $query .= "id, "; - } - $query .= qq|trans_id, parts_id, description, longdescription, qty, base_qty, | . - qq|sellprice, discount, unit, reqdate, project_id, serialnumber, ship, | . - qq|pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, | . - qq|marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor) | . - qq|VALUES (|; - if($form->{"orderitems_id_$i"}) { - $query .= qq|?,|; - push(@values, $form->{"orderitems_id_$i"}); - } - $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, - (SELECT factor FROM price_factors WHERE id = ?), ?)|; + $query = qq|INSERT INTO orderitems ( + id, trans_id, parts_id, description, longdescription, qty, base_qty, + sellprice, discount, unit, reqdate, project_id, serialnumber, ship, + pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, + marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + (SELECT factor FROM price_factors WHERE id = ?), ?)|; push(@values, - conv_i($form->{id}), conv_i($form->{"id_$i"}), + conv_i($orderitems_id), conv_i($form->{id}), conv_i($form->{"id_$i"}), $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"}, $baseqty, $fxsellprice, $form->{"discount_$i"}, @@ -412,6 +416,15 @@ sub save { $form->{"sellprice_$i"} = $fxsellprice; $form->{"discount_$i"} *= 100; + + CVar->save_custom_variables(module => 'IC', + sub_module => 'orderitems', + trans_id => $orderitems_id, + configs => $ic_cvar_configs, + variables => $form, + name_prefix => 'ic_', + name_postfix => "_$i", + dbh => $dbh); } } @@ -637,6 +650,9 @@ sub retrieve { my ($query, $query_add, @values, @ids, $sth); + my $ic_cvar_configs = CVar->get_configs(module => 'IC', + dbh => $dbh); + # translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later map { push @ids, $form->{"trans_id_$_"} @@ -798,6 +814,16 @@ sub retrieve { $sth = prepare_execute_query($form, $dbh, $query, @values); while ($ref = $sth->fetchrow_hashref(NAME_lc)) { + # Retrieve custom variables. + my $cvars = CVar->get_custom_variables(dbh => $dbh, + module => 'IC', + sub_module => 'orderitems', + trans_id => $ref->{orderitems_id}, + ); + # $main::lxdebug->dump(0, "cv", $cvars); + map { $ref->{"ic_cvar_$_->{name}"} = $_->{value} } @{ $cvars }; + + # Handle accounts. if (!$ref->{"part_inventory_accno_id"}) { map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid)); } @@ -874,6 +900,7 @@ sub retrieve { } chop $ref->{taxaccounts}; + push @{ $form->{form_details} }, $ref; $stw->finish; } @@ -971,6 +998,8 @@ sub order_details { IC->prepare_parts_for_printing(); + my $ic_cvar_configs = CVar->get_configs(module => 'IC'); + my @arrays = qw(runningnumber number description longdescription qty ship unit bin partnotes serialnumber reqdate sellprice listprice netprice @@ -978,6 +1007,8 @@ sub order_details { linetotal nodiscount_linetotal tax_rate projectnumber price_factor price_factor_name partsgroup); + push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; + my @tax_arrays = qw(taxbase tax taxdescription taxrate taxnumber); $form->{TEMPLATE_ARRAYS} = { map { $_ => [] } (@arrays, @tax_arrays) }; @@ -1142,6 +1173,7 @@ sub order_details { $sth->finish; } + map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; } } diff --git a/bin/mozilla/amcvar.pl b/bin/mozilla/amcvar.pl index 47c821c96..795dd44b7 100644 --- a/bin/mozilla/amcvar.pl +++ b/bin/mozilla/amcvar.pl @@ -76,14 +76,6 @@ sub list_cvar_configs { foreach my $config (@configs) { $config->{type_tr} = $translations{$config->{type}}; - foreach my $flag (split m/:/, $config->{flags}) { - if ($flag =~ m/(.*?)=(.*)/) { - $config->{"flag_${1}"} = $2; - } else { - $config->{"flag_${flag}"} = 1; - } - } - if ($previous_config) { $previous_config->{next_id} = $config->{id}; $config->{previous_id} = $previous_config->{id}; diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 07a008917..9b2380078 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1796,6 +1796,9 @@ sub save { # don't trample on previous variables map { delete $form->{$_} } keys %newform; + my $ic_cvar_configs = CVar->get_configs(module => 'IC'); + my @ic_cvar_fields = map { "cvar_$_->{name}" } @{ $ic_cvar_configs }; + # now take it apart and restore original values foreach my $item (split /&/, $previousform) { my ($key, $value) = split m/=/, $item, 2; @@ -1819,6 +1822,7 @@ sub save { # change/add values for assembly item map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id); + map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields; # das ist __voll__ bekloppt, dass so auszurechnen jb 22.5.09 #$form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"}; @@ -1831,6 +1835,7 @@ sub save { $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"}); map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id); + map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields; $form->{"longdescription_$i"} = $newform{notes}; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index f890cee12..69e536c54 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -193,6 +193,7 @@ sub display_row { _update_part_information(); _update_ship() if ($is_s_p_order); + _update_custom_variables(); # rows for $i (1 .. $numrows) { @@ -356,6 +357,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 +445,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 +505,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 +567,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 +680,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 +693,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 +722,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 +1945,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(); +} diff --git a/locale/de/dn b/locale/de/dn index 242d052c6..c109b67d4 100644 --- a/locale/de/dn +++ b/locale/de/dn @@ -302,6 +302,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/do b/locale/de/do index 6f1fbfbb7..8e6d41d2d 100644 --- a/locale/de/do +++ b/locale/de/do @@ -326,6 +326,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/ic b/locale/de/ic index 1fb508d7d..2741fd2a3 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -351,6 +351,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/io b/locale/de/io index dfa12b60f..f10010567 100644 --- a/locale/de/io +++ b/locale/de/io @@ -268,6 +268,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'ap_transaction' => 'ap_transaction', diff --git a/locale/de/ir b/locale/de/ir index 33bf5ac40..7b37bc79f 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -340,6 +340,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/is b/locale/de/is index 09b576755..398c95b3a 100644 --- a/locale/de/is +++ b/locale/de/is @@ -365,6 +365,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/login b/locale/de/login index d6d105bc4..b51bda170 100644 --- a/locale/de/login +++ b/locale/de/login @@ -411,6 +411,8 @@ $self->{subs} = { 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', '_collect_links' => '_collect_links', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/oe b/locale/de/oe index 9ce9769e6..2f5b23ec2 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -378,6 +378,8 @@ $self->{subs} = { 'NTI' => 'NTI', 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/locale/de/todo b/locale/de/todo index 81a11572e..86131d812 100644 --- a/locale/de/todo +++ b/locale/de/todo @@ -404,6 +404,8 @@ $self->{subs} = { 'Q' => 'Q', '_check_io_auth' => '_check_io_auth', '_collect_links' => '_collect_links', + '_render_custom_variables_inputs' => '_render_custom_variables_inputs', + '_update_custom_variables' => '_update_custom_variables', '_update_part_information' => '_update_part_information', '_update_ship' => '_update_ship', 'add' => 'add', diff --git a/sql/Pg-upgrade2/custom_variables_parts_services_assemblies.sql b/sql/Pg-upgrade2/custom_variables_parts_services_assemblies.sql index c4457930c..5ca679284 100644 --- a/sql/Pg-upgrade2/custom_variables_parts_services_assemblies.sql +++ b/sql/Pg-upgrade2/custom_variables_parts_services_assemblies.sql @@ -2,3 +2,5 @@ -- @description: Benutzerdefinierte Variablen für Waren, Dienstleistungen, Erzeugnisse. -- @depends: release_2_6_0 ALTER TABLE custom_variable_configs ADD COLUMN flags text; +ALTER TABLE custom_variables ADD COLUMN sub_module text; +UPDATE custom_variables SET sub_module = ''; diff --git a/templates/webpages/amcvar/render_inputs_de.html b/templates/webpages/amcvar/render_inputs_de.html index 98d42ed68..ac2a1b8f8 100644 --- a/templates/webpages/amcvar/render_inputs_de.html +++ b/templates/webpages/amcvar/render_inputs_de.html @@ -1,35 +1,40 @@ [% USE HTML %] -[%- IF var.type == 'bool' %] - +[%- SET var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%] + +[%- IF hide_non_editable && !var.flag_editable %] + + +[%- ELSIF var.type == 'bool' %] + [%- ELSIF var.type == 'textfield' %] - + [%- ELSIF var.type == 'date' %] - - + + [%- ELSIF var.type == 'timestamp' %] - + [%- ELSIF var.type == 'select' %] - [%- FOREACH option = var.OPTIONS %] [% HTML.escape(option.value) %] [%- END %] [%- ELSE %] - + [%- END %] diff --git a/templates/webpages/amcvar/render_inputs_master.html b/templates/webpages/amcvar/render_inputs_master.html index 98d42ed68..ac2a1b8f8 100644 --- a/templates/webpages/amcvar/render_inputs_master.html +++ b/templates/webpages/amcvar/render_inputs_master.html @@ -1,35 +1,40 @@ [% USE HTML %] -[%- IF var.type == 'bool' %] - +[%- SET var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%] + +[%- IF hide_non_editable && !var.flag_editable %] + + +[%- ELSIF var.type == 'bool' %] + [%- ELSIF var.type == 'textfield' %] - + [%- ELSIF var.type == 'date' %] - - + + [%- ELSIF var.type == 'timestamp' %] - + [%- ELSIF var.type == 'select' %] - [%- FOREACH option = var.OPTIONS %] [% HTML.escape(option.value) %] [%- END %] [%- ELSE %] - + [%- END %] diff --git a/templates/webpages/oe/sales_order_de.html b/templates/webpages/oe/sales_order_de.html index 9c4f4e571..43ed5e6dc 100644 --- a/templates/webpages/oe/sales_order_de.html +++ b/templates/webpages/oe/sales_order_de.html @@ -18,6 +18,7 @@ [% END %] [% FOREACH row2 = row.ROW2 %] + [% IF row2.line_break %]
[% END %] [% row2.value %][% END %] [% END %] diff --git a/templates/webpages/oe/sales_order_master.html b/templates/webpages/oe/sales_order_master.html index fef5c4bb0..5dc7f1248 100644 --- a/templates/webpages/oe/sales_order_master.html +++ b/templates/webpages/oe/sales_order_master.html @@ -18,6 +18,7 @@ [% END %] [% FOREACH row2 = row.ROW2 %] + [% IF row2.line_break %]
[% END %] [% row2.value %][% END %] [% END %]