Revision 6b4a71ff
Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
298 | 298 |
|
299 | 299 |
my $position = $i; |
300 | 300 |
|
301 |
my $cvars; |
|
301 | 302 |
if (!$form->{"delivery_order_items_id_$i"}) { |
302 | 303 |
# there is no persistent id, therefore create one with all necessary constraints |
303 | 304 |
my $q_item_id = qq|SELECT nextval('delivery_order_items_id')|; |
... | ... | |
308 | 309 |
do_query($form, $dbh, $query, conv_i($form->{"delivery_order_items_id_$i"}), |
309 | 310 |
conv_i($form->{"id"}), conv_i($position), conv_i($form->{"id_$i"})); |
310 | 311 |
$h_item_id->finish(); |
312 |
|
|
313 |
# get values for CVars from master data for new items |
|
314 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
315 |
module => 'IC', |
|
316 |
trans_id => $form->{"id_$i"}, |
|
317 |
); |
|
318 |
} else { |
|
319 |
# get values for CVars from custom_variables for existing items |
|
320 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
321 |
module => 'IC', |
|
322 |
sub_module => 'delivery_order_items', |
|
323 |
trans_id => $form->{"delivery_order_items_id_$i"}, |
|
324 |
); |
|
311 | 325 |
} |
326 |
# map only non-editable CVars to form (editable ones are already there) |
|
327 |
map { $form->{"ic_cvar_$_->{name}_$i"} = $_->{value} unless $_->{flag_editable} } @{ $cvars }; |
|
328 |
|
|
312 | 329 |
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); |
313 | 330 |
|
314 | 331 |
my $item_unit = $part_unit_map{$form->{"id_$i"}}; |
... | ... | |
983 | 1000 |
} |
984 | 1001 |
} |
985 | 1002 |
|
1003 |
my $cvars; |
|
1004 |
if (! $form->{"delivery_order_items_id_$i"}) { |
|
1005 |
# get values for CVars from master data for new items |
|
1006 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
1007 |
module => 'IC', |
|
1008 |
trans_id => $form->{"id_$i"}, |
|
1009 |
); |
|
1010 |
} else { |
|
1011 |
# get values for CVars from custom_variables for existing items |
|
1012 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
1013 |
module => 'IC', |
|
1014 |
sub_module => 'delivery_order_items', |
|
1015 |
trans_id => $form->{"delivery_order_items_id_$i"}, |
|
1016 |
); |
|
1017 |
} |
|
1018 |
# map only non-editable CVars to form (editable ones are already there) |
|
1019 |
map { $form->{"ic_cvar_$_->{name}_$i"} = $_->{value} unless $_->{flag_editable} } @{ $cvars }; |
|
1020 |
|
|
986 | 1021 |
push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, |
987 | 1022 |
CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_) |
988 | 1023 |
for @{ $ic_cvar_configs }; |
SL/OE.pm | ||
---|---|---|
512 | 512 |
my $position = $i; |
513 | 513 |
|
514 | 514 |
# save detail record in orderitems table |
515 |
my $cvars; |
|
515 | 516 |
if (! $form->{"orderitems_id_$i"}) { |
516 | 517 |
$query = qq|SELECT nextval('orderitemsid')|; |
517 | 518 |
($form->{"orderitems_id_$i"}) = selectrow_query($form, $dbh, $query); |
518 | 519 |
|
519 | 520 |
$query = qq|INSERT INTO orderitems (id, position) VALUES (?, ?)|; |
520 | 521 |
do_query($form, $dbh, $query, $form->{"orderitems_id_$i"}, conv_i($position)); |
522 |
|
|
523 |
# get values for CVars from master data for new items |
|
524 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
525 |
module => 'IC', |
|
526 |
trans_id => $form->{"id_$i"}, |
|
527 |
); |
|
528 |
} else { |
|
529 |
# get values for CVars from custom_variables for existing items |
|
530 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
531 |
module => 'IC', |
|
532 |
sub_module => 'orderitems', |
|
533 |
trans_id => $form->{"orderitems_id_$i"}, |
|
534 |
); |
|
521 | 535 |
} |
536 |
# map only non-editable CVars to form (editable ones are already there) |
|
537 |
map { $form->{"ic_cvar_$_->{name}_$i"} = $_->{value} unless $_->{flag_editable} } @{ $cvars }; |
|
538 |
|
|
522 | 539 |
my $orderitems_id = $form->{"orderitems_id_$i"}; |
523 | 540 |
push @processed_orderitems, $orderitems_id; |
524 | 541 |
|
... | ... | |
1377 | 1394 |
$sth->finish; |
1378 | 1395 |
} |
1379 | 1396 |
|
1397 |
my $cvars; |
|
1398 |
if (! $form->{"orderitems_id_$i"}) { |
|
1399 |
# get values for CVars from master data for new items |
|
1400 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
1401 |
module => 'IC', |
|
1402 |
trans_id => $form->{"id_$i"}, |
|
1403 |
); |
|
1404 |
} else { |
|
1405 |
# get values for CVars from custom_variables for existing items |
|
1406 |
$cvars = CVar->get_custom_variables(dbh => $dbh, |
|
1407 |
module => 'IC', |
|
1408 |
sub_module => 'orderitems', |
|
1409 |
trans_id => $form->{"orderitems_id_$i"}, |
|
1410 |
); |
|
1411 |
} |
|
1412 |
# map only non-editable CVars to form (editable ones are already there) |
|
1413 |
map { $form->{"ic_cvar_$_->{name}_$i"} = $_->{value} unless $_->{flag_editable} } @{ $cvars }; |
|
1414 |
|
|
1380 | 1415 |
push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, |
1381 | 1416 |
CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_) |
1382 | 1417 |
for @{ $ic_cvar_configs }; |
templates/webpages/amcvar/render_inputs_block.html | ||
---|---|---|
10 | 10 |
SET render_cvar_tag_options.no_id = 1; |
11 | 11 |
END; |
12 | 12 |
%] |
13 |
[%- IF (cvar.hide_non_editable && !cvar.var.flag_editable) || cvar.partsgroup_filtered %] |
|
14 |
[%- L.hidden_tag(cvar_tag_name, cvar.var.value, render_cvar_tag_options) %] |
|
15 |
[%- ELSIF !cvar.valid %] |
|
13 |
|
|
14 |
[%- IF (!cvar.hide_non_editable || cvar.var.flag_editable) && !cvar.partsgroup_filtered %] |
|
15 |
|
|
16 |
[%- IF !cvar.valid %] |
|
16 | 17 |
[%- IF show_disabled_message %] |
17 | 18 |
<i>[% 'Element disabled' | $T8 %]</i> |
18 | 19 |
[%- END %] |
... | ... | |
71 | 72 |
[% render_cvar_tag_options.maxlength=cvar.var.maxlength IF cvar.var.maxlength; |
72 | 73 |
L.input_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %] |
73 | 74 |
[%- END %] |
75 |
|
|
76 |
[%- END %] |
|
77 |
|
|
74 | 78 |
[%- END %] |
Auch abrufbar als: Unified diff
Nicht editierbare CVars nicht rendern, aber richtig speichern und drucken.
Dazu werden die Werte dieser Variablen aus der DB gelesen, nämlich:
- aus custom_variables zu den Stammdaten, wenn die Artikelzeile neu
hinzugekommen ist
- aus custom_variables zur Artikelzeile, wenn die Zeile schon im Beleg
gespeichert war
Hier für Angebote/Aufträge und Lieferscheine.
Todo:
- Für Rechnungen muss das noch gemacht werden (wenn dort die item-ids persistent
sind).
- Gruppieren nach Warengruppen im Ausdruck muss getestet werden, aber das geht im
Moment ohnehin nicht.
Siehe auch Ticket 1836 (trac.kivitendo.de) bzw. 4 und 25 (redmine.kivitendo-premium.de)