Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bce08af4

Von Sven Schöling vor etwa 8 Jahren hinzugefügt

  • ID bce08af4ca2b6a160505dedd3a28edb455e1de7a
  • Vorgänger 46b1d1ce
  • Nachfolger 660c7e53

Preisupdate in eigenen controller verlagert

...und dabei das völlig kaputte Exceptionhandling gefixt

Unterschiede anzeigen:

SL/Controller/PartsPriceUpdate.pm
package SL::Controller::PartsPriceUpdate;
use strict;
use parent qw(SL::Controller::Base);
use SL::DBUtils qw(prepare_query selectfirst_array_query prepare_query do_statement do_query);
use SL::JSON;
use SL::Helper::Flash qw(flash);
use SL::DB;
use SL::DB::Part;
use SL::DB::Pricegroup;
use SL::Locale::String qw(t8);
use Rose::Object::MakeMethods::Generic (
'scalar --get_set_init' => [ qw(pricegroups pricegroups_by_id filter) ],
);
__PACKAGE__->run_before('check_rights');
sub action_search_update_prices {
my ($self) = @_;
$self->render('ic/search_update_prices',
title => t8('Update Prices'),
);
}
sub action_confirm_price_update {
my ($self) = @_;
my @errors;
my $found;
for my $key (keys %{ $self->filter->{prices} || {} }) {
my $row = $self->filter->{prices}{$key};
next if $row->{price_as_number} eq '';
my $type = $row->{type};
my $value = $::form->parse_amount(\%::myconfig, $row->{price_as_number});
my $name = $key =~ /^\d+$/ ? $self->pricegroups_by_id->{$key}->pricegroup
: $key eq 'sellprice' ? t8('Sell Price')
: $key eq 'listprice' ? t8('List Price')
: '';
if (0 > $value && ($type eq 'percent')) {
push @errors, t8('You cannot adjust the price for pricegroup "#1" by a negative percentage.', $name);
} elsif (!$value) {
push @errors, t8('No valid number entered for pricegroup "#1".', $name);
} elsif (0 < $value) {
$found = 1;
}
}
push @errors, t8('No prices will be updated because no prices have been entered.') if !$found;
my $num_matches = $self->get_num_matches_for_priceupdate();
if (@errors) {
flash('error', $_) for @errors;
return $self->action_search_update_prices;
} else {
my $key = $::auth->create_unique_sesion_value(SL::JSON::to_json($self->filter));
$self->render('ic/confirm_price_update',
num_matches => $num_matches,
filter_key => $key,
);
}
}
sub action_update_prices {
my ($self) = @_;
my $num_updated = $self->do_update_prices;
if ($num_updated) {
$::form->redirect(t8('#1 prices were updated.', $num_updated));
} else {
$::form->error(t8('Could not update prices!'));
}
}
sub _create_filter_for_priceupdate {
my ($self) = @_;
my $filter = $self->filter;
my @where_values;
my $where = '1 = 1';
for my $item (qw(partnumber drawing microfiche make model pg.partsgroup description serialnumber)) {
my $column = $item;
$column =~ s/.*\.//;
next unless $filter->{$column};
$where .= qq| AND $item ILIKE ?|;
push @where_values, "%$filter->{$column}%";
}
# items which were never bought, sold or on an order
if ($filter->{itemstatus} eq 'orphaned') {
$where .=
qq| AND (p.onhand = 0)
AND p.id NOT IN
(
SELECT DISTINCT parts_id FROM invoice
UNION
SELECT DISTINCT parts_id FROM assembly
UNION
SELECT DISTINCT parts_id FROM orderitems
UNION
SELECT DISTINCT parts_id FROM delivery_order_items
)|;
} elsif ($filter->{itemstatus} eq 'active') {
$where .= qq| AND p.obsolete = '0'|;
} elsif ($filter->{itemstatus} eq 'obsolete') {
$where .= qq| AND p.obsolete = '1'|;
} elsif ($filter->{itemstatus} eq 'onhand') {
$where .= qq| AND p.onhand > 0|;
} elsif ($filter->{itemstatus} eq 'short') {
$where .= qq| AND p.onhand < p.rop|;
}
for my $column (qw(make model)) {
next unless ($filter->{$column});
$where .= qq| AND p.id IN (SELECT DISTINCT parts_id FROM makemodel WHERE $column ILIKE ?|;
push @where_values, "%$filter->{$column}%";
}
return ($where, @where_values);
}
sub get_num_matches_for_priceupdate {
my ($self) = @_;
my $filter = $self->filter;
my $dbh = SL::DB->client->dbh;
my ($where, @where_values) = $self->_create_filter_for_priceupdate;
my $num_updated = 0;
my $query;
for my $column (qw(sellprice listprice)) {
next if $filter->{prices}{$column}{price_as_number} eq "";
$query =
qq|SELECT COUNT(*)
FROM parts
WHERE id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where)|;
my ($result) = selectfirst_array_query($::form, $dbh, $query, @where_values);
$num_updated += $result if (0 <= $result);
}
my @ids = grep { $filter->{prices}{$_}{price_as_number} } map { $_->id } @{ $self->pricegroups };
if (@ids) {
$query =
qq|SELECT COUNT(*)
FROM prices
WHERE parts_id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where)
AND pricegroup_id IN (@{[ join ',', ('?')x@ids ]})|;
my ($result) = selectfirst_array_query($::form, $dbh, $query, @where_values, @ids);
$num_updated += $result if (0 <= $result);
}
return $num_updated;
}
sub do_update_prices {
SL::DB->client->with_transaction(\&_update_prices, $_[0]);
}
sub _update_prices {
my ($self) = @_;
my $filter_json = $::auth->get_session_value($::form->{filter_key});
my $filter = SL::JSON::from_json($filter_json);
$self->filter($filter);
die "missing filter" unless $filter;
my ($where, @where_values) = $self->_create_filter_for_priceupdate;
my $num_updated = 0;
# connect to database
my $dbh = SL::DB->client->dbh;
for my $column (qw(sellprice listprice)) {
my $row = $filter->{prices}{$column};
next if ($row->{price_as_number} eq "");
my $value = $::form->parse_amount(\%::myconfig, $row->{price_as_number});
my $operator = '+';
if ($row->{type} eq "percent") {
$value = ($value / 100) + 1;
$operator = '*';
}
my $query =
qq|UPDATE parts SET $column = $column $operator ?
WHERE id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where)|;
my $result = do_query($::form, $dbh, $query, $value, @where_values);
$num_updated += $result if 0 <= $result;
}
my $q_add =
qq|UPDATE prices SET price = price + ?
WHERE parts_id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where) AND (pricegroup_id = ?)|;
my $sth_add = prepare_query($::form, $dbh, $q_add);
my $q_multiply =
qq|UPDATE prices SET price = price * ?
WHERE parts_id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where) AND (pricegroup_id = ?)|;
my $sth_multiply = prepare_query($::form, $dbh, $q_multiply);
for my $pg (@{ $self->pricegroups }) {
my $row = $filter->{prices}{$pg->id};
next if $row->{price_as_number} eq "";
my $value = $::form->parse_amount(\%::myconfig, $row->{price_as_number});
my $result;
if ($row->{type} eq "percent") {
$result = do_statement($::form, $sth_multiply, $q_multiply, ($value / 100) + 1, @where_values, $pg->id);
} else {
$result = do_statement($::form, $sth_add, $q_add, $value, @where_values, $pg->id);
}
$num_updated += $result if (0 <= $result);
}
$sth_add->finish;
$sth_multiply->finish;
1;
}
sub init_pricegroups {
SL::DB::Manager::Pricegroup->get_all_sorted(query => [
obsolete => 0,
]);
}
sub init_pricegroups_by_id {
+{ map { $_->id => $_ } @{ $_[0]->pricegroups } }
}
sub check_rights {
$::auth->assert('part_service_assembly_edit');
}
sub init_filter {
$::form->{filter} || {};
}
1;
SL/IC.pm
use strict;
sub get_pricegroups {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
my $dbh = $form->get_standard_dbh;
# get pricegroups
my $query = qq|SELECT id, pricegroup FROM pricegroup ORDER BY lower(pricegroup)|;
my $pricegroups = selectall_hashref_query($form, $dbh, $query);
my $i = 1;
foreach my $pg (@{ $pricegroups }) {
$form->{"price_$i"} = $form->format_amount($myconfig, $form->{"price_$i"}, -2);
$form->{"pricegroup_id_$i"} = "$pg->{id}";
$form->{"pricegroup_$i"} = "$pg->{pricegroup}";
$i++;
}
#correct rows
$form->{price_rows} = $i - 1;
$main::lxdebug->leave_sub();
return $pricegroups;
}
sub retrieve_buchungsgruppen {
$main::lxdebug->enter_sub();
......
$main::lxdebug->leave_sub();
}
sub assembly_item {
$main::lxdebug->enter_sub();
......
return $form->{parts};
}
sub _create_filter_for_priceupdate {
$main::lxdebug->enter_sub();
my $self = shift;
my $myconfig = \%main::myconfig;
my $form = $main::form;
my @where_values;
my $where = '1 = 1';
foreach my $item (qw(partnumber drawing microfiche make model pg.partsgroup)) {
my $column = $item;
$column =~ s/.*\.//;
next unless ($form->{$column});
$where .= qq| AND $item ILIKE ?|;
push(@where_values, like($form->{$column}));
}
foreach my $item (qw(description serialnumber)) {
next unless ($form->{$item});
$where .= qq| AND (${item} ILIKE ?)|;
push(@where_values, like($form->{$item}));
}
# items which were never bought, sold or on an order
if ($form->{itemstatus} eq 'orphaned') {
$where .=
qq| AND (p.onhand = 0)
AND p.id NOT IN
(
SELECT DISTINCT parts_id FROM invoice
UNION
SELECT DISTINCT parts_id FROM assembly
UNION
SELECT DISTINCT parts_id FROM orderitems
)|;
} elsif ($form->{itemstatus} eq 'active') {
$where .= qq| AND p.obsolete = '0'|;
} elsif ($form->{itemstatus} eq 'obsolete') {
$where .= qq| AND p.obsolete = '1'|;
} elsif ($form->{itemstatus} eq 'onhand') {
$where .= qq| AND p.onhand > 0|;
} elsif ($form->{itemstatus} eq 'short') {
$where .= qq| AND p.onhand < p.rop|;
}
foreach my $column (qw(make model)) {
next unless ($form->{$column});
$where .= qq| AND p.id IN (SELECT DISTINCT parts_id FROM makemodel WHERE $column ILIKE ?|;
push(@where_values, like($form->{$column}));
}
$main::lxdebug->leave_sub();
return ($where, @where_values);
}
sub get_num_matches_for_priceupdate {
$main::lxdebug->enter_sub();
my $self = shift;
my $myconfig = \%main::myconfig;
my $form = $main::form;
my $dbh = $form->get_standard_dbh($myconfig);
my ($where, @where_values) = $self->_create_filter_for_priceupdate();
my $num_updated = 0;
my $query;
for my $column (qw(sellprice listprice)) {
next if ($form->{$column} eq "");
$query =
qq|SELECT COUNT(*)
FROM parts
WHERE id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where)|;
my ($result) = selectfirst_array_query($form, $dbh, $query, @where_values);
$num_updated += $result if (0 <= $result);
}
$query =
qq|SELECT COUNT(*)
FROM prices
WHERE parts_id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where) AND (pricegroup_id = ?)|;
my $sth = prepare_query($form, $dbh, $query);
for my $i (1 .. $form->{price_rows}) {
next if ($form->{"price_$i"} eq "");
my ($result) = do_statement($form, $sth, $query, @where_values, conv_i($form->{"pricegroup_id_$i"}));
$num_updated += $result if (0 <= $result);
}
$sth->finish();
$main::lxdebug->leave_sub();
return $num_updated;
}
sub update_prices {
my ($self, $myconfig, $form) = @_;
$main::lxdebug->enter_sub();
my $num_updated = SL::DB->client->with_transaction(\&_update_prices, $self, $myconfig, $form);
$main::lxdebug->leave_sub();
return $num_updated;
}
sub _update_prices {
my ($self, $myconfig, $form) = @_;
my ($where, @where_values) = $self->_create_filter_for_priceupdate();
my $num_updated = 0;
# connect to database
my $dbh = SL::DB->client->dbh;
for my $column (qw(sellprice listprice)) {
next if ($form->{$column} eq "");
my $value = $form->parse_amount($myconfig, $form->{$column});
my $operator = '+';
if ($form->{"${column}_type"} eq "percent") {
$value = ($value / 100) + 1;
$operator = '*';
}
my $query =
qq|UPDATE parts SET $column = $column $operator ?
WHERE id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where)|;
my $result = do_query($form, $dbh, $query, $value, @where_values);
$num_updated += $result if (0 <= $result);
}
my $q_add =
qq|UPDATE prices SET price = price + ?
WHERE parts_id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where) AND (pricegroup_id = ?)|;
my $sth_add = prepare_query($form, $dbh, $q_add);
my $q_multiply =
qq|UPDATE prices SET price = price * ?
WHERE parts_id IN
(SELECT p.id
FROM parts p
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE $where) AND (pricegroup_id = ?)|;
my $sth_multiply = prepare_query($form, $dbh, $q_multiply);
for my $i (1 .. $form->{price_rows}) {
next if ($form->{"price_$i"} eq "");
my $value = $form->parse_amount($myconfig, $form->{"price_$i"});
my $result;
if ($form->{"pricegroup_type_$i"} eq "percent") {
$result = do_statement($form, $sth_multiply, $q_multiply, ($value / 100) + 1, @where_values, conv_i($form->{"pricegroup_id_$i"}));
} else {
$result = do_statement($form, $sth_add, $q_add, $value, @where_values, conv_i($form->{"pricegroup_id_$i"}));
}
$num_updated += $result if (0 <= $result);
}
$sth_add->finish();
$sth_multiply->finish();
return $num_updated;
}
# get partnumber, description, unit, sellprice and soldtotal with choice through $sortorder for Top100
sub get_parts {
$main::lxdebug->enter_sub();
bin/mozilla/ic.pl
$lxdebug->leave_sub();
} #end search()
sub search_update_prices {
$lxdebug->enter_sub();
$auth->assert('part_service_assembly_edit');
my $pricegroups = IC->get_pricegroups(\%myconfig, \%$form);
$form->{title} = $locale->text('Update Prices');
$form->header;
print $form->parse_html_template('ic/search_update_prices', { PRICE_ROWS => $pricegroups });
$lxdebug->leave_sub();
} #end search()
sub confirm_price_update {
$lxdebug->enter_sub();
$auth->assert('part_service_assembly_edit');
my @errors = ();
my $value_found = undef;
foreach my $idx (qw(sellprice listprice), (1..$form->{price_rows})) {
my $name = $idx =~ m/\d/ ? $form->{"pricegroup_${idx}"} : $idx eq 'sellprice' ? $locale->text('Sell Price') : $locale->text('List Price');
my $type = $idx =~ m/\d/ ? $form->{"pricegroup_type_${idx}"} : $form->{"${idx}_type"};
my $value_idx = $idx =~ m/\d/ ? "price_${idx}" : $idx;
my $value = $form->parse_amount(\%myconfig, $form->{$value_idx});
if ((0 > $value) && ($type eq 'percent')) {
push @errors, $locale->text('You cannot adjust the price for pricegroup "#1" by a negative percentage.', $name);
} elsif (!$value && ($form->{$value_idx} ne '')) {
push @errors, $locale->text('No valid number entered for pricegroup "#1".', $name);
} elsif (0 < $value) {
$value_found = 1;
}
}
push @errors, $locale->text('No prices will be updated because no prices have been entered.') if (!$value_found);
my $num_matches = IC->get_num_matches_for_priceupdate();
$form->header();
if (@errors) {
$form->show_generic_error(join('<br>', @errors));
}
$form->{nextsub} = "update_prices";
map { delete $form->{$_} } qw(action header);
print $form->parse_html_template('ic/confirm_price_update', { HIDDENS => [ map { name => $_, value => $form->{$_} }, keys %$form ],
num_matches => $num_matches });
$lxdebug->leave_sub();
}
sub update_prices {
$lxdebug->enter_sub();
$auth->assert('part_service_assembly_edit');
my $num_updated = IC->update_prices(\%myconfig, \%$form);
if (-1 != $num_updated) {
$form->redirect($locale->text('#1 prices were updated.', $num_updated));
} else {
$form->error($locale->text('Could not update prices!'));
}
$lxdebug->leave_sub();
}
sub top100 {
$::lxdebug->enter_sub();
menus/user/00-erp.yaml
icon: prices_update
order: 800
access: part_service_assembly_edit
module: ic.pl
params:
action: search_update_prices
action: PartsPriceUpdate/search_update_prices
- parent: master_data
id: master_data_price_rules
name: Price Rules
templates/webpages/ic/confirm_price_update.html
[%- USE T8 %]
[%- USE HTML %]
[%- USE LxERP %]
[%- USE L %]
<form method="post" action="ic.pl">
[%- FOREACH row = HIDDENS %]
<input type="hidden" name="[% HTML.escape(row.name) %]" value="[% HTML.escape(row.value) %]" >
[%- END %]
<form method="post" action="controller.pl">
<h2 class="confirm">[% 'Confirm!' | $T8 %]</h2>
<p>
[% LxERP.t8('Approximately #1 prices will be updated.', num_matches) %]
</p>
<p>[% LxERP.t8('Approximately #1 prices will be updated.', num_matches) %]</p>
<p>[% 'Are you sure you want to update the prices' | $T8 %]?</p>
<p>
<input name="action" class="submit" type="submit" value="[% 'Continue' | $T8 %]">
[% L.hidden_tag('filter_key', filter_key) %]
[% L.hidden_tag('action', 'PartsPriceUpdate/dispatch') %]
<input name="action_update_prices" class="submit" type="submit" value="[% 'Continue' | $T8 %]">
<input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]">
</p>
</form>
templates/webpages/ic/search_update_prices.html
[%- USE T8 %]
[%- USE HTML %]
[%- USE LxERP %]
[%- USE L %]
<h1>[% 'Update prices' | $T8 %]</h1>
<form method="post" action="ic.pl">
<input type="hidden" name="title" value="[% 'Update prices' | $T8 %]">
<p>
<table>
<tr>
<th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
<td><input name="partnumber" size="20"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
<td colspan="3"><input name="description" size="20"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Partsgroup' | $T8 %]</th>
<td><input name="partsgroup" size="20"></td>
<th align="right" nowrap>[% 'Serial Number' | $T8 %]</th>
<td><input name="serialnumber" size="20"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Make' | $T8 %]</th>
<td><input name="make" size="20"></td>
<th align="right" nowrap>[% 'Model' | $T8 %]</th>
<td><input name="model" size="20"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Drawing' | $T8 %]</th>
<td><input name="drawing" size="20"></td>
<th align="right" nowrap>[% 'Microfiche' | $T8 %]</th>
<td><input name="microfiche" size="20"></td>
</tr>
<tr>
<td></td>
<td colspan="3">
<input name="itemstatus" id="itemstatus_active" class="radio" type="radio" value="active" checked>
<label for="itemstatus_active">[% 'Active' | $T8 %]</label>
<input name="itemstatus" id="itemstatus_onhand" class="radio" type="radio" value="onhand">
<label for="itemstatus_onhand">[% 'On Hand' | $T8 %]</label>
<input name="itemstatus" id="itemstatus_short" class="radio" type="radio" value="short">
<label for="itemstatus_short">[% 'Short' | $T8 %]</label>
<input name="itemstatus" id="itemstatus_obsolete" class="radio" type="radio" value="obsolete">
<label for="itemstatus_obsolete">[% 'Obsolete' | $T8 %]</label>
<input name="itemstatus" id="itemstatus_orphaned" class="radio" type="radio" value="orphaned">
<label for="itemstatus_orphaned">[% 'Orphaned' | $T8 %]</label>
</td>
</tr>
</table>
</p>
<hr size="1" noshade>
<p>
<table>
<tr>
<th class="listheading">[% 'Price group' | $T8 %]</th>
<th class="listheading">[% 'Preis' | $T8 %]</th>
<th class="listheading">[% 'Prozentual/Absolut' | $T8 %]</th>
</tr>
<tr>
<td>[% 'Sell Price' | $T8 %]</td>
<td><input name="sellprice" size="11" value="[% HTML.escape(sellprice) %]"></td>
<td align="center">
<input name="sellprice_type" class="radio" type="radio" value="percent" checked> /
<input name="sellprice_type" class="radio" type="radio" value="absolut">
</td>
</tr>
<tr>
<td>[% 'List Price' | $T8 %]</td>
<td><input name="listprice" size="11" value="[% HTML.escape(listprice) %]"></td>
<td align="center">
<input name="listprice_type" class="radio" type="radio" value="percent" checked> /
<input name="listprice_type" class="radio" type="radio" value="absolut">
</td>
</tr>
[%- FOREACH row = PRICE_ROWS %]
<input type="hidden" name="pricegroup_id_[% loop.count %]" value="[% HTML.escape(row.id) %]">
<tr>
<td><input type="hidden" name="pricegroup_[% loop.count %]" size="30" value="[% HTML.escape(row.pricegroup) %]">[% HTML.escape(row.pricegroup) %]</td>
<td><input name="price_[% loop.count %]" size="11"></td>
<td align="center">
<input name="pricegroup_type_[% loop.count %]" class="radio" type="radio" value="percent" checked> /
<input name="pricegroup_type_[% loop.count %]" class="radio" type="radio" value="absolut">
</td>
</tr>
[%- END %]
</table>
</p>
<hr size="3" noshade>
<input type="hidden" name="nextsub" value="confirm_price_update">
<input type="hidden" name="price_rows" value="[% HTML.escape(price_rows) %]">
<p>
<input class="submit" type="submit" name="action" value="[% 'Continue' | $T8 %]">
</p>
</form>
[% PROCESS 'common/flash.html' %]
<form method="post" action="controller.pl">
<table>
<tr>
<th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
<td>[% L.input_tag('filter.partnumber', FORM.filter.partnumber, size=20) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
<td colspan="3">[% L.input_tag('filter.description', FORM.filter.description, size=20) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Partsgroup' | $T8 %]</th>
<td>[% L.input_tag('filter.partsgroup', FORM.filter.partsgroup, size=20) %]</td>
<th align="right" nowrap>[% 'Serial Number' | $T8 %]</th>
<td>[% L.input_tag('filter.serialnumber', FORM.filter.serialnumber, size=20) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Make' | $T8 %]</th>
<td>[% L.input_tag('filter.make', FORM.filter.make, size=20) %]</td>
<th align="right" nowrap>[% 'Model' | $T8 %]</th>
<td>[% L.input_tag('filter.model', FORM.filter.model, size=20) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Drawing' | $T8 %]</th>
<td>[% L.input_tag('filter.drawing', FORM.filter.drawing, size=20) %]</td>
<th align="right" nowrap>[% 'Microfiche' | $T8 %]</th>
<td>[% L.input_tag('filter.microfiche', FORM.filter.microfiche, size=20) %]</td>
</tr>
<tr>
<td></td>
<td colspan="3">
[% L.radio_button_tag('filter.itemstatus', value='active', label=LxERP.t8('Active'), checked=!FORM.filter.itemstatus||FORM.filter.itemstatus=='active') %]
[% L.radio_button_tag('filter.itemstatus', value='onhand', label=LxERP.t8('On Hand'), checked=FORM.filter.itemstatus=='onhand') %]
[% L.radio_button_tag('filter.itemstatus', value='short', label=LxERP.t8('Short'), checked=FORM.filter.itemstatus=='short') %]
[% L.radio_button_tag('filter.itemstatus', value='obsolete', label=LxERP.t8('Obsolete'), checked=FORM.filter.itemstatus=='obsolete') %]
[% L.radio_button_tag('filter.itemstatus', value='orphaned', label=LxERP.t8('Orphaned'), checked=FORM.filter.itemstatus=='orphaned') %]
</td>
</tr>
</table>
<hr size="1" noshade>
<table>
<tr>
<th class="listheading">[% 'Price group' | $T8 %]</th>
<th class="listheading">[% 'Preis' | $T8 %]</th>
<th class="listheading">[% 'Prozentual/Absolut' | $T8 %]</th>
</tr>
<tr>
<td>[% 'Sell Price' | $T8 %]</td>
<td>[% L.input_tag('filter.prices.sellprice.price_as_number', FORM.filter.prices.sellprice.price_as_number, size=11) %]</td>
<td align="center">
[% L.radio_button_tag("filter.prices.sellprice.type",
value="percent",
checked=!FORM.filter.prices.sellprice.type || FORM.filter.prices.sellprice.type == 'percent') %] /
[% L.radio_button_tag("filter.prices.sellprice.type",
value="absolut",
checked=FORM.filter.prices.sellprice.type == 'absolut') %]
</td>
</tr>
<tr>
<td>[% 'List Price' | $T8 %]</td>
<td>[% L.input_tag('filter.prices.listprice.price_as_number', FORM.filter.prices.listprice.price_as_number, size=11) %]</td>
<td align="center">
[% L.radio_button_tag("filter.prices.listprice.type",
value="percent",
checked=!FORM.filter.prices.listprice.type || FORM.filter.prices.listprice.type == 'percent') %] /
[% L.radio_button_tag("filter.prices.listprice.type",
value="absolut",
checked=FORM.filter.prices.listprice.type == 'absolut') %]
</td>
</tr>
[%- FOREACH pg = SELF.pricegroups %]
<tr>
<td>[% pg.pricegroup | html %]</td>
<td>[% L.input_tag('filter.prices.' _ pg.id _ '.price_as_number', FORM.filter.prices.${pg.id}.price_as_number, size=11) %]</td>
<td align="center">
[% L.radio_button_tag("filter.prices." _ pg.id _ ".type",
value="percent",
checked=!FORM.filter.prices.${pg.id}.type || FORM.filter.prices.${pg.id}.type == 'percent') %] /
[% L.radio_button_tag("filter.prices." _ pg.id _ ".type",
value="absolut",
checked=FORM.filter.prices.${pg.id}.type == 'absolut') %]
</td>
</tr>
[%- END %]
</table>
<hr size="3" noshade>
[% L.hidden_tag('action', 'PartsPriceUpdate/dispatch') %]
<input class="submit" type="submit" name="action_confirm_price_update" value="[% 'Continue' | $T8 %]">
</form>

Auch abrufbar als: Unified diff