Verkaufsrechnungssuche: keine Multibox mehr nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 20 Jan 2017 12:36:06 +0000 (13:36 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 23 Jan 2017 10:54:22 +0000 (11:54 +0100)
SL/AR.pm
bin/mozilla/ar.pl
templates/webpages/ar/search.html

index 079e9e8..4caf527 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -499,14 +499,7 @@ sub ar_transactions {
     $where .= " AND NOT invoice = 'f' ";  # remove ar transactions from Sales -> Reports -> Invoices
   };
 
-  if ($form->{customernumber}) {
-    $where .= " AND c.customernumber = ?";
-    push(@values, trim($form->{customernumber}));
-  }
-  if ($form->{customer_id}) {
-    $where .= " AND a.customer_id = ?";
-    push(@values, $form->{customer_id});
-  } elsif ($form->{customer}) {
+  if ($form->{customer}) {
     $where .= " AND c.name ILIKE ?";
     push(@values, like($form->{customer}));
   }
index 0039d31..16be58c 100644 (file)
@@ -40,6 +40,7 @@ use SL::AR;
 use SL::FU;
 use SL::GL;
 use SL::IS;
+use SL::DB::Business;
 use SL::DB::Currency;
 use SL::DB::Default;
 use SL::DB::Employee;
@@ -789,18 +790,11 @@ sub search {
   my $locale   = $main::locale;
   my $cgi      = $::request->{cgi};
 
-  # setup customer selection
-  $form->all_vc(\%myconfig, "customer", "AR");
-
   $form->{title}    = $locale->text('AR Transactions');
 
-  # Auch in Rechnungsübersicht nach Kundentyp filtern - jan
-  $form->get_lists("projects"       => { "key" => "ALL_PROJECTS", "all" => 1 },
-                   "customers"      => "ALL_VC",
-                   "business_types" => "ALL_BUSINESS_TYPES");
   $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
-  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
-  $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
+  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
+  $form->{ALL_BUSINESS_TYPES} = SL::DB::Manager::Business->get_all_sorted;
 
   $form->{CT_CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'CT');
   ($form->{CT_CUSTOM_VARIABLES_FILTER_CODE},
@@ -811,6 +805,8 @@ sub search {
   # 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('ar/search', { %myconfig });
 
@@ -849,8 +845,6 @@ sub ar_transactions {
 
   my ($callback, $href, @columns);
 
-  ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
-
   report_generator_set_default_sort('transdate', 1);
 
   AR->ar_transactions(\%myconfig, \%$form);
index fffbd9c..85f1d12 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>[% 'Customer' | $T8 %]</th>
-      <td colspan=3>
-            [%- INCLUDE 'generic/multibox.html'
-                 name          = 'customer',
-                 default       = oldcustomer,
-                 style         = 'width: 250px',
-                 DATA          = ALL_VC,
-                 id_sub        = 'vc_keys',
-                 label_key     = 'name',
-                 select        = vc_select,
-                 limit         = vclimit,
-                 show_empty    = 1,
-                 allow_textbox = 1,
-                 class         = 'initial_focus',
-                 -%]
-      </td>
+      <td colspan=3>[% L.input_tag("customer", customer, 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 colspan="3">
-            [%- 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>
      </tr>
-    [% IF SHOW_BUSINESS_TYPES %]
+    [% IF ALL_BUSINESS_TYPES.as_list.size > 0 %]
      <tr>
       <th align="right" nowrap>[% 'Customer type' | $T8 %]</th>
-      <td colspan="3">
-          [%- INCLUDE 'generic/multibox.html'
-                 name          =  'business_id',
-                 style         = "width: 250px",
-                 DATA          =  ALL_BUSINESS_TYPES,
-                 id_key        = 'id',
-                 label_key     = 'description',
-                 limit         = vclimit,
-                 show_empty    = 1,
-                 allow_textbox = 0,
-            -%]
-      </td>
+      <td colspan="3">[% L.select_tag("business_id", ALL_BUSINESS_TYPES, with_empty=1, title_key="description", style="width: 250px") %]</td>
      </tr>
     [% END %]
      <tr>
    <br>
    <input class=submit type=submit name=action id="continue" value="[% 'Continue' | $T8 %]">
   </form>
- <script type="text/javascript">
- <!--
-   $(document).ready(function(){
-    $('customer').focus();
-   })
- //-->
- </script>