Revision ef220490
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
SL/CVar.pm | ||
---|---|---|
33 | 33 |
$config->{precision} = $1 if ($config->{options} =~ m/precision=(\d+)/i); |
34 | 34 |
|
35 | 35 |
} |
36 |
|
|
37 |
$self->_unpack_flags($config); |
|
36 | 38 |
} |
37 | 39 |
|
38 | 40 |
$main::lxdebug->leave_sub(); |
... | ... | |
57 | 59 |
|
58 | 60 |
my $config = selectfirst_hashref_query($form, $dbh, $query, conv_i($params{id})) || { }; |
59 | 61 |
|
62 |
$self->_unpack_flags($config); |
|
63 |
|
|
60 | 64 |
$main::lxdebug->leave_sub(); |
61 | 65 |
|
62 | 66 |
return $config; |
63 | 67 |
} |
64 | 68 |
|
69 |
sub _unpack_flags { |
|
70 |
$main::lxdebug->enter_sub(); |
|
71 |
|
|
72 |
my $self = shift; |
|
73 |
my $config = shift; |
|
74 |
|
|
75 |
foreach my $flag (split m/:/, $config->{flags}) { |
|
76 |
if ($flag =~ m/(.*?)=(.*)/) { |
|
77 |
$config->{"flag_${1}"} = $2; |
|
78 |
} else { |
|
79 |
$config->{"flag_${flag}"} = 1; |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
$main::lxdebug->leave_sub(); |
|
84 |
} |
|
85 |
|
|
65 | 86 |
sub save_config { |
66 | 87 |
$main::lxdebug->enter_sub(); |
67 | 88 |
|
... | ... | |
177 | 198 |
qq|SELECT text_value, timestamp_value, timestamp_value::date AS date_value, number_value, bool_value |
178 | 199 |
FROM custom_variables |
179 | 200 |
WHERE (config_id = ?) AND (trans_id = ?)|; |
201 |
$q_var .= qq| AND (sub_module = ?)| if $params{sub_module}; |
|
180 | 202 |
my $h_var = prepare_query($form, $dbh, $q_var); |
181 | 203 |
|
182 | 204 |
my $custom_variables = selectall_hashref_query($form, $dbh, $q_cfg, $params{module}); |
... | ... | |
201 | 223 |
|
202 | 224 |
my $act_var; |
203 | 225 |
if ($params{trans_id}) { |
204 |
do_statement($form, $h_var, $q_var, conv_i($cvar->{id}), conv_i($params{trans_id})); |
|
226 |
my @values = (conv_i($cvar->{id}), conv_i($params{trans_id})); |
|
227 |
push @values, $params{sub_module} if $params{sub_module}; |
|
228 |
|
|
229 |
do_statement($form, $h_var, $q_var, @values); |
|
205 | 230 |
$act_var = $h_var->fetchrow_hashref(); |
206 | 231 |
} |
207 | 232 |
|
... | ... | |
263 | 288 |
|
264 | 289 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
265 | 290 |
|
266 |
my @configs = grep { $_->{module} eq $params{module} } @{ CVar->get_configs() }; |
|
291 |
my @configs = $params{configs} ? @{ $params{configs} } : grep { $_->{module} eq $params{module} } @{ CVar->get_configs() };
|
|
267 | 292 |
|
268 | 293 |
my $query = |
269 | 294 |
qq|DELETE FROM custom_variables |
... | ... | |
271 | 296 |
AND (config_id IN (SELECT DISTINCT id |
272 | 297 |
FROM custom_variable_configs |
273 | 298 |
WHERE module = ?))|; |
274 |
do_query($form, $dbh, $query, conv_i($params{trans_id}), $params{module}); |
|
299 |
my @values = (conv_i($params{trans_id}), $params{module}); |
|
300 |
|
|
301 |
if ($params{sub_module}) { |
|
302 |
$query .= qq| AND (sub_module = ?)|; |
|
303 |
push @values, $params{sub_module}; |
|
304 |
} |
|
305 |
|
|
306 |
do_query($form, $dbh, $query, @values); |
|
275 | 307 |
|
276 | 308 |
$query = |
277 |
qq|INSERT INTO custom_variables (config_id, trans_id, bool_value, timestamp_value, text_value, number_value) |
|
278 |
VALUES (?, ?, ?, ?, ?, ?)|; |
|
309 |
qq|INSERT INTO custom_variables (config_id, sub_module, trans_id, bool_value, timestamp_value, text_value, number_value)
|
|
310 |
VALUES (?, ?, ?, ?, ?, ?, ?)|;
|
|
279 | 311 |
my $sth = prepare_query($form, $dbh, $query); |
280 | 312 |
|
281 | 313 |
foreach my $config (@configs) { |
282 |
my @values = (conv_i($config->{id}), conv_i($params{trans_id})); |
|
314 |
my @values = (conv_i($config->{id}), "$params{sub_module}", conv_i($params{trans_id}));
|
|
283 | 315 |
|
284 |
my $value = $params{variables}->{"cvar_$config->{name}"};
|
|
316 |
my $value = $params{variables}->{"$params{name_prefix}cvar_$config->{name}$params{name_postfix}"};
|
|
285 | 317 |
|
286 | 318 |
if (($config->{type} eq 'text') || ($config->{type} eq 'textfield') || ($config->{type} eq 'select')) { |
287 | 319 |
push @values, undef, undef, $value, undef; |
... | ... | |
317 | 349 |
my $myconfig = \%main::myconfig; |
318 | 350 |
my $form = $main::form; |
319 | 351 |
|
352 |
my %options = ( name_prefix => "$params{name_prefix}", |
|
353 |
name_postfix => "$params{name_postfix}", |
|
354 |
hide_non_editable => $params{hide_non_editable}, |
|
355 |
); |
|
356 |
|
|
320 | 357 |
foreach my $var (@{ $params{variables} }) { |
321 |
$var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var }); |
|
358 |
$var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var, %options });
|
|
322 | 359 |
} |
323 | 360 |
|
324 | 361 |
$main::lxdebug->leave_sub(); |
... | ... | |
434 | 471 |
} |
435 | 472 |
|
436 | 473 |
if (@sub_where) { |
474 |
push @sub_where, qq|cvar.sub_module = ?|; |
|
475 |
push @sub_values, "$params{sub_module}"; |
|
476 |
|
|
437 | 477 |
push @where, |
438 | 478 |
qq|$not EXISTS( |
439 | 479 |
SELECT cvar.id |
... | ... | |
481 | 521 |
my $query = |
482 | 522 |
qq|SELECT text_value, timestamp_value, timestamp_value::date AS date_value, number_value, bool_value, config_id |
483 | 523 |
FROM custom_variables |
484 |
WHERE (config_id IN (| . join(', ', ('?') x scalar(@cfg_ids)) . qq|)) AND (trans_id = ?)|; |
|
524 |
WHERE (config_id IN (| . join(', ', ('?') x scalar(@cfg_ids)) . qq|)) |
|
525 |
AND (trans_id = ?) |
|
526 |
AND (sub_module = ?)|; |
|
485 | 527 |
my $sth = prepare_query($form, $dbh, $query); |
486 | 528 |
|
487 | 529 |
foreach my $row (@{ $params{data} }) { |
488 |
do_statement($form, $sth, $query, @cfg_ids, conv_i($row->{$params{trans_id_field}})); |
|
530 |
do_statement($form, $sth, $query, @cfg_ids, conv_i($row->{$params{trans_id_field}}), "$params{sub_module}");
|
|
489 | 531 |
|
490 | 532 |
while (my $ref = $sth->fetchrow_hashref()) { |
491 | 533 |
my $cfg = $cfg_map{$ref->{config_id}}; |
SL/IS.pm | ||
---|---|---|
1908 | 1908 |
} |
1909 | 1909 |
} |
1910 | 1910 |
$sth->finish; |
1911 |
|
|
1912 |
foreach my $item (@{ $form->{item_list} }) { |
|
1913 |
my $custom_variables = CVar->get_custom_variables(module => 'IC', |
|
1914 |
trans_id => $item->{id}, |
|
1915 |
dbh => $dbh, |
|
1916 |
); |
|
1917 |
|
|
1918 |
$main::lxdebug->dump(0, "cvar", $custom_variables); |
|
1919 |
map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables }; |
|
1920 |
} |
|
1921 |
|
|
1922 |
$main::lxdebug->dump(0, "items", $form->{item_list}); |
|
1923 |
|
|
1911 | 1924 |
$dbh->disconnect; |
1912 | 1925 |
|
1913 | 1926 |
$main::lxdebug->leave_sub(); |
SL/OE.pm | ||
---|---|---|
37 | 37 |
use List::Util qw(max first); |
38 | 38 |
use SL::AM; |
39 | 39 |
use SL::Common; |
40 |
use SL::CVar; |
|
40 | 41 |
use SL::DBUtils; |
41 | 42 |
use SL::IC; |
42 | 43 |
|
... | ... | |
248 | 249 |
my $all_units = AM->retrieve_units($myconfig, $form); |
249 | 250 |
$form->{all_units} = $all_units; |
250 | 251 |
|
252 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC', |
|
253 |
dbh => $dbh); |
|
254 |
|
|
251 | 255 |
$form->{employee_id} = (split /--/, $form->{employee})[1] if !$form->{employee_id}; |
252 | 256 |
unless ($form->{employee_id}) { |
253 | 257 |
$form->get_employee($dbh); |
... | ... | |
256 | 260 |
my $ml = ($form->{type} eq 'sales_order') ? 1 : -1; |
257 | 261 |
|
258 | 262 |
if ($form->{id}) { |
263 |
$query = qq|DELETE FROM custom_variables |
|
264 |
WHERE (config_id IN (SELECT id FROM custom_variable_configs WHERE module = 'IC')) |
|
265 |
AND (sub_module = 'orderitems') |
|
266 |
AND (trans_id IN (SELECT id FROM orderitems WHERE trans_id = ?))|; |
|
267 |
do_query($form, $dbh, $query, $form->{id}); |
|
259 | 268 |
|
260 | 269 |
$query = qq|DELETE FROM orderitems WHERE trans_id = ?|; |
261 | 270 |
do_query($form, $dbh, $query, $form->{id}); |
... | ... | |
379 | 388 |
$pricegroup_id *= 1; |
380 | 389 |
|
381 | 390 |
# save detail record in orderitems table |
391 |
my $orderitems_id = $form->{"orderitems_id_$i"}; |
|
392 |
($orderitems_id) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('orderitemsid')|) if (!$orderitems_id); |
|
393 |
|
|
382 | 394 |
@values = (); |
383 |
$query = qq|INSERT INTO orderitems (|; |
|
384 |
if ($form->{"orderitems_id_$i"}) { |
|
385 |
$query .= "id, "; |
|
386 |
} |
|
387 |
$query .= qq|trans_id, parts_id, description, longdescription, qty, base_qty, | . |
|
388 |
qq|sellprice, discount, unit, reqdate, project_id, serialnumber, ship, | . |
|
389 |
qq|pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, | . |
|
390 |
qq|marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor) | . |
|
391 |
qq|VALUES (|; |
|
392 |
if($form->{"orderitems_id_$i"}) { |
|
393 |
$query .= qq|?,|; |
|
394 |
push(@values, $form->{"orderitems_id_$i"}); |
|
395 |
} |
|
396 |
$query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, |
|
397 |
(SELECT factor FROM price_factors WHERE id = ?), ?)|; |
|
395 |
$query = qq|INSERT INTO orderitems ( |
|
396 |
id, trans_id, parts_id, description, longdescription, qty, base_qty, |
|
397 |
sellprice, discount, unit, reqdate, project_id, serialnumber, ship, |
|
398 |
pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, |
|
399 |
marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor) |
|
400 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, |
|
401 |
(SELECT factor FROM price_factors WHERE id = ?), ?)|; |
|
398 | 402 |
push(@values, |
399 |
conv_i($form->{id}), conv_i($form->{"id_$i"}), |
|
403 |
conv_i($orderitems_id), conv_i($form->{id}), conv_i($form->{"id_$i"}),
|
|
400 | 404 |
$form->{"description_$i"}, $form->{"longdescription_$i"}, |
401 | 405 |
$form->{"qty_$i"}, $baseqty, |
402 | 406 |
$fxsellprice, $form->{"discount_$i"}, |
... | ... | |
412 | 416 |
|
413 | 417 |
$form->{"sellprice_$i"} = $fxsellprice; |
414 | 418 |
$form->{"discount_$i"} *= 100; |
419 |
|
|
420 |
CVar->save_custom_variables(module => 'IC', |
|
421 |
sub_module => 'orderitems', |
|
422 |
trans_id => $orderitems_id, |
|
423 |
configs => $ic_cvar_configs, |
|
424 |
variables => $form, |
|
425 |
name_prefix => 'ic_', |
|
426 |
name_postfix => "_$i", |
|
427 |
dbh => $dbh); |
|
415 | 428 |
} |
416 | 429 |
} |
417 | 430 |
|
... | ... | |
637 | 650 |
|
638 | 651 |
my ($query, $query_add, @values, @ids, $sth); |
639 | 652 |
|
653 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC', |
|
654 |
dbh => $dbh); |
|
655 |
|
|
640 | 656 |
# translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later |
641 | 657 |
map { |
642 | 658 |
push @ids, $form->{"trans_id_$_"} |
... | ... | |
798 | 814 |
$sth = prepare_execute_query($form, $dbh, $query, @values); |
799 | 815 |
|
800 | 816 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
817 |
# Retrieve custom variables. |
|
818 |
my $cvars = CVar->get_custom_variables(dbh => $dbh, |
|
819 |
module => 'IC', |
|
820 |
sub_module => 'orderitems', |
|
821 |
trans_id => $ref->{orderitems_id}, |
|
822 |
); |
|
823 |
# $main::lxdebug->dump(0, "cv", $cvars); |
|
824 |
map { $ref->{"ic_cvar_$_->{name}"} = $_->{value} } @{ $cvars }; |
|
825 |
|
|
826 |
# Handle accounts. |
|
801 | 827 |
if (!$ref->{"part_inventory_accno_id"}) { |
802 | 828 |
map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid)); |
803 | 829 |
} |
... | ... | |
874 | 900 |
} |
875 | 901 |
|
876 | 902 |
chop $ref->{taxaccounts}; |
903 |
|
|
877 | 904 |
push @{ $form->{form_details} }, $ref; |
878 | 905 |
$stw->finish; |
879 | 906 |
} |
... | ... | |
971 | 998 |
|
972 | 999 |
IC->prepare_parts_for_printing(); |
973 | 1000 |
|
1001 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
|
1002 |
|
|
974 | 1003 |
my @arrays = |
975 | 1004 |
qw(runningnumber number description longdescription qty ship unit bin |
976 | 1005 |
partnotes serialnumber reqdate sellprice listprice netprice |
... | ... | |
978 | 1007 |
linetotal nodiscount_linetotal tax_rate projectnumber |
979 | 1008 |
price_factor price_factor_name partsgroup); |
980 | 1009 |
|
1010 |
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
|
1011 |
|
|
981 | 1012 |
my @tax_arrays = qw(taxbase tax taxdescription taxrate taxnumber); |
982 | 1013 |
|
983 | 1014 |
$form->{TEMPLATE_ARRAYS} = { map { $_ => [] } (@arrays, @tax_arrays) }; |
... | ... | |
1142 | 1173 |
$sth->finish; |
1143 | 1174 |
} |
1144 | 1175 |
|
1176 |
map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; |
|
1145 | 1177 |
} |
1146 | 1178 |
} |
1147 | 1179 |
|
bin/mozilla/amcvar.pl | ||
---|---|---|
76 | 76 |
foreach my $config (@configs) { |
77 | 77 |
$config->{type_tr} = $translations{$config->{type}}; |
78 | 78 |
|
79 |
foreach my $flag (split m/:/, $config->{flags}) { |
|
80 |
if ($flag =~ m/(.*?)=(.*)/) { |
|
81 |
$config->{"flag_${1}"} = $2; |
|
82 |
} else { |
|
83 |
$config->{"flag_${flag}"} = 1; |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 | 79 |
if ($previous_config) { |
88 | 80 |
$previous_config->{next_id} = $config->{id}; |
89 | 81 |
$config->{previous_id} = $previous_config->{id}; |
bin/mozilla/ic.pl | ||
---|---|---|
1796 | 1796 |
# don't trample on previous variables |
1797 | 1797 |
map { delete $form->{$_} } keys %newform; |
1798 | 1798 |
|
1799 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
|
1800 |
my @ic_cvar_fields = map { "cvar_$_->{name}" } @{ $ic_cvar_configs }; |
|
1801 |
|
|
1799 | 1802 |
# now take it apart and restore original values |
1800 | 1803 |
foreach my $item (split /&/, $previousform) { |
1801 | 1804 |
my ($key, $value) = split m/=/, $item, 2; |
... | ... | |
1819 | 1822 |
|
1820 | 1823 |
# change/add values for assembly item |
1821 | 1824 |
map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id); |
1825 |
map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields; |
|
1822 | 1826 |
|
1823 | 1827 |
# das ist __voll__ bekloppt, dass so auszurechnen jb 22.5.09 |
1824 | 1828 |
#$form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"}; |
... | ... | |
1831 | 1835 |
$form->{"qty_$i"} = 1 unless ($form->{"qty_$i"}); |
1832 | 1836 |
|
1833 | 1837 |
map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id); |
1838 |
map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields; |
|
1834 | 1839 |
|
1835 | 1840 |
$form->{"longdescription_$i"} = $newform{notes}; |
1836 | 1841 |
|
bin/mozilla/io.pl | ||
---|---|---|
193 | 193 |
|
194 | 194 |
_update_part_information(); |
195 | 195 |
_update_ship() if ($is_s_p_order); |
196 |
_update_custom_variables(); |
|
196 | 197 |
|
197 | 198 |
# rows |
198 | 199 |
for $i (1 .. $numrows) { |
... | ... | |
356 | 357 |
|
357 | 358 |
$form->{invsubtotal} += $linetotal; |
358 | 359 |
|
360 |
# Benutzerdefinierte Variablen für Waren/Dienstleistungen/Erzeugnisse |
|
361 |
_render_custom_variables_inputs(ROW2 => \@ROW2, row => $i); |
|
362 |
|
|
359 | 363 |
push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, }; |
360 | 364 |
} |
361 | 365 |
|
... | ... | |
441 | 445 |
|
442 | 446 |
print qq|</tr>|; |
443 | 447 |
|
448 |
my @new_fields = |
|
449 |
qw(bin listprice inventory_accno income_accno expense_accno unit weight |
|
450 |
assembly taxaccounts partsgroup formel longdescription not_discountable |
|
451 |
part_payment_id partnotes id lastcost price_factor_id price_factor); |
|
452 |
push @new_fields, "lizenzen" if ($lizenzen); |
|
453 |
push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] }; |
|
454 |
|
|
444 | 455 |
my $i = 0; |
445 | 456 |
foreach $ref (@{ $form->{item_list} }) { |
446 | 457 |
$checked = ($i++) ? "" : "checked"; |
... | ... | |
494 | 505 |
|
495 | 506 |
print("</tr>\n"); |
496 | 507 |
|
497 |
my @new_fields = |
|
498 |
qw(bin listprice inventory_accno income_accno expense_accno unit weight |
|
499 |
assembly taxaccounts partsgroup formel longdescription not_discountable |
|
500 |
part_payment_id partnotes id lastcost price_factor_id price_factor); |
|
501 |
push(@new_fields, "lizenzen") if ($lizenzen); |
|
502 |
|
|
503 | 508 |
print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields; |
504 | 509 |
print "\n"; |
505 | 510 |
} |
... | ... | |
562 | 567 |
partsgroup formel longdescription not_discountable partnotes lastcost |
563 | 568 |
price_factor_id price_factor); |
564 | 569 |
|
570 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
|
571 |
push @new_fields, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
|
572 |
|
|
565 | 573 |
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new_fields; |
566 | 574 |
|
567 | 575 |
$form->{"marge_price_factor_$i"} = $form->{"new_price_factor_$j"}; |
... | ... | |
672 | 680 |
my @a = (); |
673 | 681 |
my $count = 0; |
674 | 682 |
|
675 |
my @flds = qw(id partnumber description qty ship sellprice unit |
|
676 |
discount inventory_accno income_accno expense_accno listprice |
|
677 |
taxaccounts bin assembly weight projectnumber project_id |
|
678 |
oldprojectnumber runningnumber serialnumber partsgroup payment_id |
|
679 |
not_discountable shop ve gv buchungsgruppen_id language_values |
|
680 |
sellprice_pg pricegroup_old price_old price_new unit_old ordnumber |
|
681 |
transdate longdescription basefactor marge_total marge_percent |
|
682 |
marge_price_factor lastcost price_factor_id partnotes |
|
683 |
stock_out stock_in); |
|
684 |
|
|
685 | 683 |
# remove any makes or model rows |
686 | 684 |
if ($form->{item} eq 'part') { |
687 | 685 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
... | ... | |
695 | 693 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
696 | 694 |
qw(listprice sellprice rop stock); |
697 | 695 |
|
698 |
@flds = |
|
699 |
qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost); |
|
696 |
my @flds = qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost); |
|
700 | 697 |
|
701 | 698 |
for my $i (1 .. ($form->{assembly_rows} - 1)) { |
702 | 699 |
if ($form->{"qty_$i"}) { |
... | ... | |
725 | 722 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost); |
726 | 723 |
|
727 | 724 |
} else { |
725 |
my @flds = qw(id partnumber description qty ship sellprice unit |
|
726 |
discount inventory_accno income_accno expense_accno listprice |
|
727 |
taxaccounts bin assembly weight projectnumber project_id |
|
728 |
oldprojectnumber runningnumber serialnumber partsgroup payment_id |
|
729 |
not_discountable shop ve gv buchungsgruppen_id language_values |
|
730 |
sellprice_pg pricegroup_old price_old price_new unit_old ordnumber |
|
731 |
transdate longdescription basefactor marge_total marge_percent |
|
732 |
marge_price_factor lastcost price_factor_id partnotes |
|
733 |
stock_out stock_in); |
|
734 |
|
|
735 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
|
736 |
push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
|
728 | 737 |
|
729 | 738 |
# this section applies to invoices and orders |
730 | 739 |
# remove any empty numbers |
... | ... | |
1936 | 1945 |
|
1937 | 1946 |
$lxdebug->leave_sub(); |
1938 | 1947 |
} |
1948 |
|
|
1949 |
sub _update_custom_variables { |
|
1950 |
$lxdebug->enter_sub(); |
|
1951 |
|
|
1952 |
$form->{CVAR_CONFIGS} ||= { }; |
|
1953 |
$form->{CVAR_CONFIGS}->{IC} = CVar->get_configs(module => 'IC'); |
|
1954 |
|
|
1955 |
$lxdebug->leave_sub(); |
|
1956 |
} |
|
1957 |
|
|
1958 |
sub _render_custom_variables_inputs { |
|
1959 |
$lxdebug->enter_sub(); |
|
1960 |
|
|
1961 |
my %params = @_; |
|
1962 |
|
|
1963 |
if (!$form->{CVAR_CONFIGS}->{IC}) { |
|
1964 |
$lxdebug->leave_sub(); |
|
1965 |
return; |
|
1966 |
} |
|
1967 |
|
|
1968 |
foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { |
|
1969 |
$cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"}; |
|
1970 |
} |
|
1971 |
|
|
1972 |
CVar->render_inputs(hide_non_editable => 1, |
|
1973 |
variables => $form->{CVAR_CONFIGS}->{IC}, |
|
1974 |
name_prefix => 'ic_', |
|
1975 |
name_postfix => "_$params{row}"); |
|
1976 |
|
|
1977 |
my $num_visible_cvars = 0; |
|
1978 |
foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { |
|
1979 |
my $description = ''; |
|
1980 |
if ($cvar->{flag_editable}) { |
|
1981 |
$num_visible_cvars++; |
|
1982 |
$description = $cvar->{description} . ' '; |
|
1983 |
} |
|
1984 |
|
|
1985 |
push @{ $params{ROW2} }, { line_break => $num_visible_cvars == 1, |
|
1986 |
value => $description . $cvar->{HTML_CODE}, |
|
1987 |
}; |
|
1988 |
} |
|
1989 |
|
|
1990 |
$lxdebug->leave_sub(); |
|
1991 |
} |
locale/de/dn | ||
---|---|---|
302 | 302 |
'NTI' => 'NTI', |
303 | 303 |
'Q' => 'Q', |
304 | 304 |
'_check_io_auth' => '_check_io_auth', |
305 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
306 |
'_update_custom_variables' => '_update_custom_variables', |
|
305 | 307 |
'_update_part_information' => '_update_part_information', |
306 | 308 |
'_update_ship' => '_update_ship', |
307 | 309 |
'add' => 'add', |
locale/de/do | ||
---|---|---|
326 | 326 |
'NTI' => 'NTI', |
327 | 327 |
'Q' => 'Q', |
328 | 328 |
'_check_io_auth' => '_check_io_auth', |
329 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
330 |
'_update_custom_variables' => '_update_custom_variables', |
|
329 | 331 |
'_update_part_information' => '_update_part_information', |
330 | 332 |
'_update_ship' => '_update_ship', |
331 | 333 |
'add' => 'add', |
locale/de/ic | ||
---|---|---|
351 | 351 |
'NTI' => 'NTI', |
352 | 352 |
'Q' => 'Q', |
353 | 353 |
'_check_io_auth' => '_check_io_auth', |
354 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
355 |
'_update_custom_variables' => '_update_custom_variables', |
|
354 | 356 |
'_update_part_information' => '_update_part_information', |
355 | 357 |
'_update_ship' => '_update_ship', |
356 | 358 |
'add' => 'add', |
locale/de/io | ||
---|---|---|
268 | 268 |
'NTI' => 'NTI', |
269 | 269 |
'Q' => 'Q', |
270 | 270 |
'_check_io_auth' => '_check_io_auth', |
271 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
272 |
'_update_custom_variables' => '_update_custom_variables', |
|
271 | 273 |
'_update_part_information' => '_update_part_information', |
272 | 274 |
'_update_ship' => '_update_ship', |
273 | 275 |
'ap_transaction' => 'ap_transaction', |
locale/de/ir | ||
---|---|---|
340 | 340 |
'NTI' => 'NTI', |
341 | 341 |
'Q' => 'Q', |
342 | 342 |
'_check_io_auth' => '_check_io_auth', |
343 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
344 |
'_update_custom_variables' => '_update_custom_variables', |
|
343 | 345 |
'_update_part_information' => '_update_part_information', |
344 | 346 |
'_update_ship' => '_update_ship', |
345 | 347 |
'add' => 'add', |
locale/de/is | ||
---|---|---|
365 | 365 |
'NTI' => 'NTI', |
366 | 366 |
'Q' => 'Q', |
367 | 367 |
'_check_io_auth' => '_check_io_auth', |
368 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
369 |
'_update_custom_variables' => '_update_custom_variables', |
|
368 | 370 |
'_update_part_information' => '_update_part_information', |
369 | 371 |
'_update_ship' => '_update_ship', |
370 | 372 |
'add' => 'add', |
locale/de/login | ||
---|---|---|
411 | 411 |
'Q' => 'Q', |
412 | 412 |
'_check_io_auth' => '_check_io_auth', |
413 | 413 |
'_collect_links' => '_collect_links', |
414 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
415 |
'_update_custom_variables' => '_update_custom_variables', |
|
414 | 416 |
'_update_part_information' => '_update_part_information', |
415 | 417 |
'_update_ship' => '_update_ship', |
416 | 418 |
'add' => 'add', |
locale/de/oe | ||
---|---|---|
378 | 378 |
'NTI' => 'NTI', |
379 | 379 |
'Q' => 'Q', |
380 | 380 |
'_check_io_auth' => '_check_io_auth', |
381 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
382 |
'_update_custom_variables' => '_update_custom_variables', |
|
381 | 383 |
'_update_part_information' => '_update_part_information', |
382 | 384 |
'_update_ship' => '_update_ship', |
383 | 385 |
'add' => 'add', |
locale/de/todo | ||
---|---|---|
404 | 404 |
'Q' => 'Q', |
405 | 405 |
'_check_io_auth' => '_check_io_auth', |
406 | 406 |
'_collect_links' => '_collect_links', |
407 |
'_render_custom_variables_inputs' => '_render_custom_variables_inputs', |
|
408 |
'_update_custom_variables' => '_update_custom_variables', |
|
407 | 409 |
'_update_part_information' => '_update_part_information', |
408 | 410 |
'_update_ship' => '_update_ship', |
409 | 411 |
'add' => 'add', |
sql/Pg-upgrade2/custom_variables_parts_services_assemblies.sql | ||
---|---|---|
2 | 2 |
-- @description: Benutzerdefinierte Variablen f?r Waren, Dienstleistungen, Erzeugnisse. |
3 | 3 |
-- @depends: release_2_6_0 |
4 | 4 |
ALTER TABLE custom_variable_configs ADD COLUMN flags text; |
5 |
ALTER TABLE custom_variables ADD COLUMN sub_module text; |
|
6 |
UPDATE custom_variables SET sub_module = ''; |
templates/webpages/amcvar/render_inputs_de.html | ||
---|---|---|
1 | 1 |
[% USE HTML %] |
2 | 2 |
|
3 |
[%- IF var.type == 'bool' %] |
|
4 |
<input type="checkbox" name="cvar_[% HTML.escape(var.name) %]" value="1"[% IF var.value %] checked[% END %]> |
|
3 |
[%- SET var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%] |
|
4 |
|
|
5 |
[%- IF hide_non_editable && !var.flag_editable %] |
|
6 |
<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]"> |
|
7 |
|
|
8 |
[%- ELSIF var.type == 'bool' %] |
|
9 |
<input type="checkbox" name="[% var_name %]" value="1"[% IF var.value %] checked[% END %]> |
|
5 | 10 |
|
6 | 11 |
[%- ELSIF var.type == 'textfield' %] |
7 |
<textarea name="cvar_[% HTML.escape(var.name) %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
|
|
12 |
<textarea name="[% var_name %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
|
|
8 | 13 |
|
9 | 14 |
[%- ELSIF var.type == 'date' %] |
10 |
<input name="cvar_[% HTML.escape(var.name) %]" id="cvar_[% HTML.escape(var.name) %]" size="12" value="[% HTML.escape(var.value) %]">
|
|
11 |
<input type="button" name="cvar_[% HTML.escape(var.name) %]_button" id="cvar_[% HTML.escape(var.name) %]_trigger" value="?">
|
|
15 |
<input name="[% var_name %]" id="[% var_name %]" size="12" value="[% HTML.escape(var.value) %]">
|
|
16 |
<input name="[% var_name %]_button" id="[% var_name %]_trigger" type="button" value="?">
|
|
12 | 17 |
|
13 | 18 |
<script type="text/javascript"> |
14 | 19 |
<!-- |
15 |
Calendar.setup({ inputField : "cvar_[% HTML.escape(var.name) %]",
|
|
16 |
ifFormat :"[% myconfig_jsc_dateformat %]", |
|
20 |
Calendar.setup({ inputField : "[% var_name %]",
|
|
21 |
ifFormat : "[% myconfig_jsc_dateformat %]",
|
|
17 | 22 |
align : "BR", |
18 |
button : "cvar_[% HTML.escape(var.name) %]_trigger" });
|
|
23 |
button : "[% var_name %]_trigger" });
|
|
19 | 24 |
--> |
20 | 25 |
</script> |
21 | 26 |
|
22 | 27 |
[%- ELSIF var.type == 'timestamp' %] |
23 |
<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
|
|
28 |
<input name="[% var_name %]" value="[% HTML.escape(var.value) %]">
|
|
24 | 29 |
|
25 | 30 |
[%- ELSIF var.type == 'select' %] |
26 | 31 |
|
27 |
<select name="cvar_[% HTML.escape(var.name) %]">
|
|
32 |
<select name="[% var_name %]">
|
|
28 | 33 |
[%- FOREACH option = var.OPTIONS %] |
29 | 34 |
<option[% IF option.value == var.value %] selected[% END %]>[% HTML.escape(option.value) %]</option> |
30 | 35 |
[%- END %] |
31 | 36 |
</select> |
32 | 37 |
|
33 | 38 |
[%- ELSE %] |
34 |
<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]"[% IF var.maxlength %]maxlength="[% HTML.escape(var.maxlength) %]"[% END %]>
|
|
39 |
<input name="[% var_name %]" value="[% HTML.escape(var.value) %]" [%- IF var.maxlength %] maxlength="[% HTML.escape(var.maxlength) %]"[% END -%]>
|
|
35 | 40 |
[%- END %] |
templates/webpages/amcvar/render_inputs_master.html | ||
---|---|---|
1 | 1 |
[% USE HTML %] |
2 | 2 |
|
3 |
[%- IF var.type == 'bool' %] |
|
4 |
<input type="checkbox" name="cvar_[% HTML.escape(var.name) %]" value="1"[% IF var.value %] checked[% END %]> |
|
3 |
[%- SET var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%] |
|
4 |
|
|
5 |
[%- IF hide_non_editable && !var.flag_editable %] |
|
6 |
<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]"> |
|
7 |
|
|
8 |
[%- ELSIF var.type == 'bool' %] |
|
9 |
<input type="checkbox" name="[% var_name %]" value="1"[% IF var.value %] checked[% END %]> |
|
5 | 10 |
|
6 | 11 |
[%- ELSIF var.type == 'textfield' %] |
7 |
<textarea name="cvar_[% HTML.escape(var.name) %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
|
|
12 |
<textarea name="[% var_name %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
|
|
8 | 13 |
|
9 | 14 |
[%- ELSIF var.type == 'date' %] |
10 |
<input name="cvar_[% HTML.escape(var.name) %]" id="cvar_[% HTML.escape(var.name) %]" size="12" value="[% HTML.escape(var.value) %]">
|
|
11 |
<input type="button" name="cvar_[% HTML.escape(var.name) %]_button" id="cvar_[% HTML.escape(var.name) %]_trigger" value="?">
|
|
15 |
<input name="[% var_name %]" id="[% var_name %]" size="12" value="[% HTML.escape(var.value) %]">
|
|
16 |
<input name="[% var_name %]_button" id="[% var_name %]_trigger" type="button" value="?">
|
|
12 | 17 |
|
13 | 18 |
<script type="text/javascript"> |
14 | 19 |
<!-- |
15 |
Calendar.setup({ inputField : "cvar_[% HTML.escape(var.name) %]",
|
|
16 |
ifFormat :"[% myconfig_jsc_dateformat %]", |
|
20 |
Calendar.setup({ inputField : "[% var_name %]",
|
|
21 |
ifFormat : "[% myconfig_jsc_dateformat %]",
|
|
17 | 22 |
align : "BR", |
18 |
button : "cvar_[% HTML.escape(var.name) %]_trigger" });
|
|
23 |
button : "[% var_name %]_trigger" });
|
|
19 | 24 |
--> |
20 | 25 |
</script> |
21 | 26 |
|
22 | 27 |
[%- ELSIF var.type == 'timestamp' %] |
23 |
<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
|
|
28 |
<input name="[% var_name %]" value="[% HTML.escape(var.value) %]">
|
|
24 | 29 |
|
25 | 30 |
[%- ELSIF var.type == 'select' %] |
26 | 31 |
|
27 |
<select name="cvar_[% HTML.escape(var.name) %]">
|
|
32 |
<select name="[% var_name %]">
|
|
28 | 33 |
[%- FOREACH option = var.OPTIONS %] |
29 | 34 |
<option[% IF option.value == var.value %] selected[% END %]>[% HTML.escape(option.value) %]</option> |
30 | 35 |
[%- END %] |
31 | 36 |
</select> |
32 | 37 |
|
33 | 38 |
[%- ELSE %] |
34 |
<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]"[% IF var.maxlength %]maxlength="[% HTML.escape(var.maxlength) %]"[% END %]>
|
|
39 |
<input name="[% var_name %]" value="[% HTML.escape(var.value) %]" [%- IF var.maxlength %] maxlength="[% HTML.escape(var.maxlength) %]"[% END -%]>
|
|
35 | 40 |
[%- END %] |
templates/webpages/oe/sales_order_de.html | ||
---|---|---|
18 | 18 |
[% END %] |
19 | 19 |
|
20 | 20 |
<tr class="listrow[% loop.count % 2 %]" [% UNLESS show_details %]style="display:none;"[% END %]><td colspan="[% row.colspan %]">[% FOREACH row2 = row.ROW2 %] |
21 |
[% IF row2.line_break %]<br/>[% END %] |
|
21 | 22 |
[% row2.value %][% END %] |
22 | 23 |
</td></tr> |
23 | 24 |
[% END %] |
templates/webpages/oe/sales_order_master.html | ||
---|---|---|
18 | 18 |
[% END %] |
19 | 19 |
|
20 | 20 |
<tr class="listrow[% loop.count % 2 %]" [% UNLESS show_details %]style="display:none;"[% END %]><td colspan="[% row.colspan %]">[% FOREACH row2 = row.ROW2 %] |
21 |
[% IF row2.line_break %]<br/>[% END %] |
|
21 | 22 |
[% row2.value %][% END %] |
22 | 23 |
</td></tr> |
23 | 24 |
[% END %] |
Auch abrufbar als: Unified diff
Ausweitung der benutzerdefinierten Variablen für Waren/Dienstleistungen/Erzeugnisse auf Anzeige/Modifikation in Angeboten/Aufträgen.