From: Moritz Bunkus Date: Thu, 16 Jun 2011 11:07:25 +0000 (+0200) Subject: select_item() in io.pl auf Template umgestellt X-Git-Tag: release-2.7.0beta1~390 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=461b6311d70b58f07997b209d6e55c3d0b9c838c;p=kivitendo-erp.git select_item() in io.pl auf Template umgestellt --- diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index c65d742da..a213a4753 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -438,125 +438,27 @@ sub set_pricegroup { sub select_item { $main::lxdebug->enter_sub(); - my %params = @_; - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - my $cgi = $main::cgi; - - my $mode = $params{mode} || croak "Missing parameter 'mode'"; - my $is_purchase = $mode eq 'IS'; + my %params = @_; + my $mode = $params{mode} || croak "Missing parameter 'mode'"; _check_io_auth(); - my @column_index = qw(ndx partnumber description rop onhand unit sellprice); - my %column_data; - $column_data{ndx} = qq| |; - $column_data{partnumber} = - qq|| . $locale->text('Number') . qq||; - $column_data{description} = - qq|| . $locale->text('Part Description') . qq||; - $column_data{sellprice} = - qq|| . $locale->text('Price') . qq||; - if ($is_purchase){ - $column_data{rop} = - qq|| . $locale->text('ROP') . qq||; - }# ende if $is_purchase -> Überschrift Mindestlagerbestand - ähnliche Prüfung weiter unten - $column_data{onhand} = - qq|| . $locale->text('Qty') . qq||; - $column_data{unit} = - qq|| . $locale->text('Unit') . qq||; - # list items with radio button on a form - $form->header; - - my $title = $locale->text('Select from one of the items below'); - my $colspan = $#column_index + 1; - - print qq| - - -
- - - - - - - |; - - map { print "\n$column_data{$_}" } @column_index; - - print qq||; - - my $i = 0; - my $j; - foreach my $ref (@{ $form->{item_list} }) { - my $checked = ($i++) ? "" : "checked"; - - if ($::lx_office_conf{features}->{lizenzen}) { - if ($ref->{inventory_accno} > 0) { - $ref->{"lizenzen"} = qq||; - foreach my $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) { - $ref->{"lizenzen"} .= - qq||; - } - $ref->{"lizenzen"} .= qq||; - $ref->{"lizenzen"} =~ s/\"/"/g; - } - } - - my $display_sellprice = $ref->{sellprice} * (1 - $form->{tradediscount}); - $display_sellprice /= $ref->{price_factor} if ($ref->{price_factor}); - $display_sellprice = $form->format_amount(\%myconfig, $display_sellprice, 2); - my $new_id = $ref->{id}; - - map { $ref->{$_} = H($ref->{$_}) } qw(id partnumber description unit); + $::form->{title} = $::locale->text('Select from one of the items below'); + $::form->header; - $column_data{ndx} = qq||; - $column_data{partnumber} = qq||; - $column_data{description} = qq||; - $column_data{sellprice} = qq||; - $column_data{onhand} = qq||; - $column_data{unit} = qq||; - - if ($is_purchase){ - $column_data{rop} = qq||; - }# ende if $is_purchase -> Falls der Aufruf über eine Einkaufsmaske kam, handelt es sich um einen Lieferantenauftrag und uns interessiert auch die Mindestbestandsmenge - - $j++; - $j %= 2; - print qq| -|; - - map { print "\n$column_data{$_}" } @column_index; - - print("\n"); - } - - print qq| - -
$title
$ref->{partnumber}$ref->{description}${display_sellprice}| . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ") . qq|$ref->{unit}| . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . qq|

-|; + my @item_list = map { + $_->{display_sellprice} = $_->{sellprice} * (1 - $::form->{tradediscount}); + $_->{display_sellprice} /= $_->{price_factor} if ($_->{price_factor}); + $_; + } @{ $::form->{item_list} }; # delete action variable - map { delete $form->{$_} } qw(action item_list header); - - my $previous_form = $::auth->save_form_in_session(form => $form); + delete @{$::form}{qw(action item_list header)}; - print qq| - - - - -
- -
- - - -|; + print $::form->parse_html_template('io/select_item', { PREVIOUS_FORM => $::auth->save_form_in_session(form => $::form), + MODE => $mode, + ITEM_LIST => \@item_list, + IS_PURCHASE => $mode eq 'IS' }); $main::lxdebug->leave_sub(); } diff --git a/templates/webpages/io/select_item.html b/templates/webpages/io/select_item.html new file mode 100644 index 000000000..2e3c91d32 --- /dev/null +++ b/templates/webpages/io/select_item.html @@ -0,0 +1,45 @@ +[% USE LxERP %][% USE HTML %][% USE L %] + + +
[% title %]
+ +
+ + + + + + + + [%- IF IS_PURCHASE %] + + [%- END %] + + + + + [%- FOREACH item = ITEM_LIST %] + + + + + [%- IF IS_PURCHASE %] + + [%- END %] + + + + + [%- END %] + + +
 [% LxERP.t8('Number') %][% LxERP.t8('Part Description') %][% LxERP.t8('Price') %][% LxERP.t8('ROP') %][% LxERP.t8('Qty') %][% LxERP.t8('Unit') %]
[% HTML.escape(item.partnumber) %][% HTML.escape(item.description) %][% LxERP.format_amount(item.rop, '') %][% LxERP.format_amount(item.display_sellprice, 2) %][% LxERP.format_amount(item.onhand, '') %][% HTML.escape(item.unit) %]

+ + [% L.hidden_tag('select_item_mode', MODE) %] + [% L.hidden_tag('select_item_previous_form', PREVIOUS_FORM) %] + [% L.hidden_tag('nextsub', 'item_selected') %] + + [% L.submit_tag('action', LxERP.t8('Continue')) %] +
+ +