Warengruppe als Dropdown bei Stammdaten/Berichte/Waren
authorBernd Blessmann <bibi@online.de>
Wed, 27 Jul 2011 11:22:38 +0000 (13:22 +0200)
committerG. Richardson <information@lx-office-hosting.de>
Wed, 27 Jul 2011 12:37:24 +0000 (14:37 +0200)
SL/IC.pm
bin/mozilla/ic.pl
templates/webpages/ic/search.html

index ee92278..c07227f 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -911,6 +911,12 @@ sub all_parts {
     }
   }
 
+  if ($form->{"partsgroup_id"}) {
+    $form->{"l_partsgroup"} = '1'; # show the column
+    push @where_tokens, "pg.id = ?";
+    push @bind_vars, $form->{"partsgroup_id"};
+  }
+
   foreach (@like_filters) {
     next unless $form->{$_};
     $form->{"l_$_"} = '1'; # show the column
index 20a9206..2b35c70 100644 (file)
@@ -115,8 +115,10 @@ sub search {
 
   $form->header;
 
+  $form->get_lists('partsgroup'    => 'ALL_PARTSGROUPS');
   print $form->parse_html_template('ic/search', { %is_xyz,
-                                                  dateformat => $myconfig{dateformat}, });
+                                                  dateformat => $myconfig{dateformat}, 
+                                                  limit => $myconfig{vclimit}, });
 
   $lxdebug->leave_sub();
 }    #end search()
@@ -1103,6 +1105,13 @@ sub generate_report {
     no_sn_joins  => [ qw(bought sold) ],
   );
 
+  # get name of partsgroup if id is given
+  my $pg_name;
+  if ($form->{partsgroup_id}) {
+    my $pg = SL::DB::PartsGroup->new(id => $form->{partsgroup_id})->load;
+    $pg_name = $pg->{'partsgroup'};
+  }
+
   # these strings get displayed at the top of the results to indicate the user which switches were used
   my %optiontexts = (
     active        => $locale->text('Active'),
@@ -1120,6 +1129,7 @@ sub generate_report {
     transdateto   => $locale->text('To (time)')  . " " . $locale->date(\%myconfig, $form->{transdateto}, 1),
     partnumber    => $locale->text('Part Number')      . ": '$form->{partnumber}'",
     partsgroup    => $locale->text('Group')            . ": '$form->{partsgroup}'",
+    partsgroup_id => $locale->text('Group')            . ": '$pg_name'",
     serialnumber  => $locale->text('Serial Number')    . ": '$form->{serialnumber}'",
     description   => $locale->text('Part Description') . ": '$form->{description}'",
     make          => $locale->text('Make')             . ": '$form->{make}'",
@@ -1131,7 +1141,7 @@ sub generate_report {
   );
 
   my @itemstatus_keys = qw(active obsolete orphaned onhand short);
-  my @callback_keys   = qw(onorder ordered rfq quoted bought sold partnumber partsgroup serialnumber description make model
+  my @callback_keys   = qw(onorder ordered rfq quoted bought sold partnumber partsgroup partsgroup_id serialnumber description make model
                            drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean);
 
   # calculate dependencies
index cbdad1c..1d94fe8 100644 (file)
 
       <tr>
        <th align="right" nowrap>[% 'Group' | $T8 %]</th>
-       <td><input name="partsgroup" size="20"></td>
+       <td>
+         [%- INCLUDE generic/multibox.html
+           name          = 'partsgroup',
+           select_name   = 'partsgroup_id',
+           DATA          = ALL_PARTSGROUPS,
+           show_empty    = 1,
+           id_key        = 'id',
+           label_key     = 'partsgroup',
+           style         = 'width:250px',
+           limit         = limit,
+           allow_textbox = 1
+         -%]
+       </td>
        <th align="right" nowrap>[% 'Serial Number' | $T8 %]</th> <td><input name="serialnumber" size="20"></td>
       </tr>