Einkaufsrechnungssuche: keine Multibox mehr nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 20 Jan 2017 14:03:22 +0000 (15:03 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 23 Jan 2017 10:54:22 +0000 (11:54 +0100)
SL/AP.pm
bin/mozilla/ap.pl
templates/webpages/ap/search.html

index 4145251..8d70064 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -439,10 +439,7 @@ sub ap_transactions {
 
   my @values;
 
-  if ($form->{vendor_id}) {
-    $where .= " AND a.vendor_id = ?";
-    push(@values, $form->{vendor_id});
-  } elsif ($form->{vendor}) {
+  if ($form->{vendor}) {
     $where .= " AND v.name ILIKE ?";
     push(@values, like($form->{vendor}));
   }
index 5f46115..5aa3713 100644 (file)
@@ -816,18 +816,16 @@ sub search {
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
 
-  # setup customer selection
-  $form->all_vc(\%myconfig, "vendor", "AP");
-
   $form->{title}    = $locale->text('AP Transactions');
 
-  $form->get_lists("projects"     => { "key" => "ALL_PROJECTS", "all" => 1 },
-                   "vendors"      => "ALL_VC");
+  $form->get_lists(projects => { "key" => "ALL_PROJECTS", "all" => 1 });
 
-  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
   # constants and subs for template
   $form->{vc_keys}   = sub { "$_[0]->{name}--$_[0]->{id}" };
 
+  $::request->layout->add_javascripts("autocomplete_project.js");
+
   $form->header;
   print $form->parse_html_template('ap/search', { %myconfig });
 
@@ -864,8 +862,6 @@ sub ap_transactions {
 
   $main::auth->assert('vendor_invoice_edit');
 
-  ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
-
   report_generator_set_default_sort('transdate', 1);
 
   AP->ap_transactions(\%myconfig, \%$form);
index 67d2b82..3c33e2a 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE T8 %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
 <h1>[% title %]</h1>
 
  <form method=post name="search" action=[% script %]>
     <table>
      <tr>
       <th align=right>[% 'Vendor' | $T8 %]</th>
-      <td colspan=3>
-            [%- INCLUDE 'generic/multibox.html'
-                 id            = 'vendor',
-                 name          = 'vendor',
-                 default       = oldvendor,
-                 style         = 'width: 250px',
-                 class         = 'initial_focus',
-                 DATA          = ALL_VC,
-                 id_sub        = 'vc_keys',
-                 label_key     = 'name',
-                 select        = vc_select,
-                 limit         = vclimit,
-                 show_empty    = 1,
-                 allow_textbox = 1,
-                 -%]
-      </td>
+      <td colspan=3>[% L.input_tag("vendor", vendor, style="width: 250px", class="initial_focus") %]</td>
      </tr>
     <tr>
      <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
      </tr>
      <tr>
       <th align="right">[% 'Project Number' | $T8 %]</th>
-      <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name          =  'project_id',
-                 style         = "width: 250px",
-                 DATA          =  ALL_PROJECTS,
-                 id_key        = 'id',
-                 label_key     = 'projectnumber',
-                 limit         = vclimit,
-                 show_empty    = 1,
-                 allow_textbox = 0,
-            -%]
-      </td>
+      <td colspan="3">[% P.project_picker("project_id", project_id, style="width: 250px") %]</td>
       <th align="right">[% 'Part Number' | $T8 %]</th>
       <td><input name="parts_partnumber" size="20"></td>
      </tr>