]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Merge branch 'f-use-proper-selects-and-pickers'
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 23 Jan 2017 13:57:31 +0000 (14:57 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 23 Jan 2017 13:57:31 +0000 (14:57 +0100)
52 files changed:
SL/AP.pm
SL/AR.pm
SL/BP.pm
SL/CP.pm
SL/Controller/Admin.pm
SL/Controller/BankTransaction.pm
SL/DB/AuthUser.pm
SL/Form.pm
SL/IS.pm
SL/Presenter/Tag.pm
SL/Template/Plugin/L.pm
bin/mozilla/ap.pl
bin/mozilla/ar.pl
bin/mozilla/arap.pl [deleted file]
bin/mozilla/bp.pl
bin/mozilla/common.pl
bin/mozilla/cp.pl
bin/mozilla/dn.pl
bin/mozilla/do.pl
bin/mozilla/ic.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
bin/mozilla/rp.pl
bin/mozilla/vk.pl
doc/dokumentation.xml
doc/html/ch04.html
locale/de/all
scripts/rose_auto_create_model.pl
t/000setup_database.t
templates/webpages/admin/edit_user.html
templates/webpages/am/config.html
templates/webpages/amcvar/search_filter.html
templates/webpages/ap/form_header.html
templates/webpages/ap/search.html
templates/webpages/ar/form_header.html
templates/webpages/ar/search.html
templates/webpages/arap/select_project.html [deleted file]
templates/webpages/bank_transactions/create_invoice.html
templates/webpages/bp/search.html
templates/webpages/cp/form_header.html
templates/webpages/do/form_header.html
templates/webpages/do/search.html
templates/webpages/dunning/add.html
templates/webpages/dunning/search.html
templates/webpages/generic/multibox.html [deleted file]
templates/webpages/ic/search.html
templates/webpages/ir/form_header.html
templates/webpages/is/form_header.html
templates/webpages/oe/form_header.html
templates/webpages/oe/search.html
templates/webpages/vk/search_invoice.html

index 41452511aeb541d629a3b46154928f0d913a10f3..8d700640e532b86b80506c23286ff1af7c1e1383 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 4fea4afe9f7fc9d2dae6bb2b2ba9a6a3b1c02bf0..4caf5273ca5ebb1227194b35c8e4215ce460bf52 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -99,8 +99,6 @@ sub _post_transaction {
   }
   $form->{paid}   = $form->round_amount($form->{paid} * ($form->{exchangerate} || 1), 2);
 
-  ($null, $form->{employee_id}) = split /--/, $form->{employee};
-
   $form->get_employee($dbh) unless $form->{employee_id};
 
   # if we have an id delete old records else make one
@@ -501,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 724ab2767e9e5db7366fde0d1cd4c7f212172367..4489b8dae07ad84467be0aaa01fed9765995372f 100644 (file)
--- a/SL/BP.pm
+++ b/SL/BP.pm
@@ -40,54 +40,6 @@ use SL::DB;
 
 use strict;
 
-sub get_vc {
-  $main::lxdebug->enter_sub();
-
-  my ($self, $myconfig, $form) = @_;
-
-  # connect to database
-  my $dbh = $form->dbconnect($myconfig);
-
-  my %arap = (invoice           => 'ar',
-              sales_order       => 'oe',
-              purchase_order    => 'oe',
-              sales_quotation   => 'oe',
-              request_quotation => 'oe',
-              check             => 'ap',
-              receipt           => 'ar');
-
-  my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
-  my $arap_type = defined($arap{$form->{type}}) ? $arap{$form->{type}} : 'ar';
-
-  my $query =
-    qq|SELECT count(*) | .
-    qq|FROM (SELECT DISTINCT ON (vc.id) vc.id FROM $vc vc, $arap_type a, status s | .
-    qq|  WHERE a.${vc}_id = vc.id  AND s.trans_id = a.id AND s.formname = ? | .
-    qq|    AND s.spoolfile IS NOT NULL) AS total|;
-
-  my ($count) = selectrow_query($form, $dbh, $query, $form->{type});
-
-  # build selection list
-  if ($count < $myconfig->{vclimit}) {
-    $query =
-      qq|SELECT DISTINCT ON (vc.id) vc.id, vc.name | .
-      qq|FROM $vc vc, $arap_type a, status s | .
-      qq|WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | .
-      qq|  AND s.spoolfile IS NOT NULL|;
-
-    my $sth = $dbh->prepare($query);
-    $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})");
-
-    $form->{"all_${vc}"} = [];
-    while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
-      push @{ $form->{"all_${vc}"} }, $ref;
-    }
-    $sth->finish;
-  }
-
-  $main::lxdebug->leave_sub();
-}
-
 sub payment_accounts {
   $main::lxdebug->enter_sub();
 
@@ -312,4 +264,3 @@ sub print_spool {
 }
 
 1;
-
index dc52af8aa6e21358d8dd8c19cb67f81184e0b1b0..75e753e07605f309881729e2697f722ba2a13a18 100644 (file)
--- a/SL/CP.pm
+++ b/SL/CP.pm
@@ -101,34 +101,6 @@ sub paymentaccounts {
   $main::lxdebug->leave_sub();
 }
 
-sub get_openvc {
-  $main::lxdebug->enter_sub();
-
-  my ($self, $myconfig, $form) = @_;
-
-  my $dbh = SL::DB->client->dbh;
-
-  my $arap = ($form->{vc} eq 'customer') ? 'ar' : 'ap';
-  my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
-  my $query =
-    qq|SELECT count(*) | .
-    qq|FROM $vc ct, $arap a | .
-    qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid)|;
-  my ($count) = selectrow_query($form, $dbh, $query);
-
-  # build selection list
-  if ($count < $myconfig->{vclimit}) {
-    $query =
-      qq|SELECT DISTINCT ct.id, ct.name | .
-      qq|FROM $vc ct, $arap a | .
-      qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid) | .
-      qq|ORDER BY ct.name|;
-    $form->{"all_$form->{vc}"} = selectall_hashref_query($form, $dbh, $query);
-  }
-
-  $main::lxdebug->leave_sub();
-}
-
 sub get_openinvoices {
   $main::lxdebug->enter_sub();
 
@@ -360,4 +332,3 @@ sub _process_payment {
 }
 
 1;
-
index 0d60ba6719c9e0a8b90421987cfa8dc047f64047..fbf99a864d1e8424fd59e60d597fede6e86bfd5f 100644 (file)
@@ -115,7 +115,6 @@ sub action_new_user {
   my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager});
   $self->user(SL::DB::AuthUser->new(
     config_values => {
-      vclimit      => 200,
       countrycode  => $defaults->language('de'),
       numberformat => $defaults->numberformat('1.000,00'),
       dateformat   => $defaults->dateformat('dd.mm.yy'),
index 3f96808f65348bb2872b121f6f0c8dac62872c28..752dba0a400f3b44b111533938f129d4b8b32216 100644 (file)
@@ -305,7 +305,6 @@ sub action_create_invoice {
     vendor_id   => $use_vendor_filter ? $vendor_of_transaction->id   : undef,
     vendor_name => $use_vendor_filter ? $vendor_of_transaction->name : undef,
     ALL_VENDORS => $all_vendors,
-    limit       => $myconfig{vclimit},
     callback    => $callback,
   );
 }
index a8d8ab5139aa316186b6aab4100f17ca40722b24..2565d067f661842bf4a76b2d68e12d5af7287728 100644 (file)
@@ -11,7 +11,7 @@ use SL::DB::Helper::Util;
 use constant CONFIG_VARS => qw(copies countrycode dateformat timeformat default_media default_printer_id
                                email favorites fax hide_cvar_search_options mandatory_departments menustyle name
                                numberformat show_form_details signature stylesheet taxincluded_checked tel
-                               template_format vclimit focus_position form_cvars_nr_cols item_multiselect);
+                               template_format focus_position form_cvars_nr_cols item_multiselect);
 
 __PACKAGE__->meta->add_relationship(
   groups => {
index 78eac8a6432ab6c4e86592cc832b408b6ac36e0c..04b20129c8b4ef8a318c7002f1bc1315d9f5daac 100644 (file)
@@ -2453,79 +2453,6 @@ sub get_name {
   return scalar(@{ $self->{name_list} });
 }
 
-# the selection sub is used in the AR, AP, IS, IR, DO and OE module
-#
-sub all_vc {
-  $main::lxdebug->enter_sub();
-
-  my ($self, $myconfig, $table, $module) = @_;
-
-  my $ref;
-  my $dbh = $self->get_standard_dbh;
-
-  $table = $table eq "customer" ? "customer" : "vendor";
-
-  # build selection list
-  # Hotfix für Bug 1837 - Besser wäre es alte Buchungsbelege
-  # OHNE Auswahlliste (reines Textfeld) zu laden. Hilft aber auch
-  # nicht für veränderbare Belege (oe, do, ...)
-  my $obsolete = $self->{id} ? '' : "WHERE NOT obsolete";
-  my $query = qq|SELECT count(*) FROM $table $obsolete|;
-  my ($count) = selectrow_query($self, $dbh, $query);
-
-  if ($count <= $myconfig->{vclimit}) {
-    $query = qq|SELECT id, name, salesman_id
-                FROM $table $obsolete
-                ORDER BY name|;
-    $self->{"all_$table"} = selectall_hashref_query($self, $dbh, $query);
-  }
-
-  # get self
-  $self->get_employee($dbh);
-
-  # setup sales contacts
-  $query = qq|SELECT e.id, e.name
-              FROM employee e
-              WHERE (e.sales = '1') AND (NOT e.id = ?)
-              ORDER BY name|;
-  $self->{all_employees} = selectall_hashref_query($self, $dbh, $query, $self->{employee_id});
-
-  # this is for self
-  push(@{ $self->{all_employees} },
-       { id   => $self->{employee_id},
-         name => $self->{employee} });
-
-    # prepare query for departments
-    $query = qq|SELECT id, description
-                FROM department
-                ORDER BY description|;
-
-  $self->{all_departments} = selectall_hashref_query($self, $dbh, $query);
-
-  # get languages
-  $query = qq|SELECT id, description
-              FROM language
-              ORDER BY id|;
-
-  $self->{languages} = selectall_hashref_query($self, $dbh, $query);
-
-  # get printer
-  $query = qq|SELECT printer_description, id
-              FROM printers
-              ORDER BY printer_description|;
-
-  $self->{printers} = selectall_hashref_query($self, $dbh, $query);
-
-  # get payment terms
-  $query = qq|SELECT id, description
-              FROM payment_terms
-              WHERE ( obsolete IS FALSE OR id = ? )
-              ORDER BY sortkey |;
-  $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef);
-
-  $main::lxdebug->leave_sub();
-}
-
 sub new_lastmtime {
   $main::lxdebug->enter_sub();
 
index 6d1e843cdbb007d6417c1df88832f30c63be8e95..6018634dd8c3a0d01e83876619c4d089e1c79ae9 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1339,9 +1339,6 @@ SQL
   # need the current dbh to get the not yet committed mtime
   $form->new_lastmtime('ar', $provided_dbh);
 
-  $form->{name} = $form->{customer};
-  $form->{name} =~ s/--\Q$form->{customer_id}\E//;
-
   # add shipto
   if (!$form->{shipto_id}) {
     $form->add_shipto($dbh, $form->{id}, "AR");
index e1a041d090d1d506f95bf41f8b74537b1fe69a16..0c2dff2d42f512adde80be8b440a87246a9dfab5 100644 (file)
@@ -7,7 +7,7 @@ use SL::HTML::Restrict;
 use parent qw(Exporter);
 
 use Exporter qw(import);
-our @EXPORT = qw(html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag checkbox_tag stringify_attributes restricted_html);
+our @EXPORT = qw(html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag checkbox_tag button_tag submit_tag ajax_submit_tag stringify_attributes restricted_html);
 
 use Carp;
 
@@ -30,6 +30,11 @@ sub _id {
 }
 }
 
+sub _J {
+  my $string = shift;
+  $string    =~ s/(\"|\'|\\)/\\$1/g;
+  return $string;
+}
 
 sub stringify_attributes {
   my ($self, %params) = @_;
@@ -219,6 +224,39 @@ sub checkbox_tag {
   return $code;
 }
 
+sub button_tag {
+  my ($self, $onclick, $value, %attributes) = @_;
+
+  _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
+  $attributes{type} ||= 'button';
+
+  $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm};
+
+  return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
+}
+
+sub submit_tag {
+  my ($self, $name, $value, %attributes) = @_;
+
+  _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
+
+  if ( $attributes{confirm} ) {
+    $attributes{onclick} = 'return confirm("'. _J(delete($attributes{confirm})) .'");';
+  }
+
+  return $self->input_tag($name, $value, %attributes, type => 'submit', class => 'submit');
+}
+
+sub ajax_submit_tag {
+  my ($self, $url, $form_selector, $text, %attributes) = @_;
+
+  $url           = _J($url);
+  $form_selector = _J($form_selector);
+  my $onclick    = qq|kivi.submit_ajax_form('${url}', '${form_selector}')|;
+
+  return $self->button_tag($onclick, $text, %attributes);
+}
+
 sub javascript {
   my ($self, $data) = @_;
   return $self->html_tag('script', $data, type => 'text/javascript');
@@ -329,6 +367,36 @@ Creates a HTML 'input type=text' tag named C<$name> with the value
 C<$value> and with arbitrary HTML attributes from C<%attributes>. The
 tag's C<id> defaults to C<name_to_id($name)>.
 
+=item C<submit_tag $name, $value, %attributes>
+
+Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
+value C<$value> and with arbitrary HTML attributes from C<%attributes>. The
+tag's C<id> defaults to C<name_to_id($name)>.
+
+If C<$attributes{confirm}> is set then a JavaScript popup dialog will
+be added via the C<onclick> handler asking the question given with
+C<$attributes{confirm}>. The request is only submitted if the user
+clicks the dialog's ok/yes button.
+
+=item C<ajax_submit_tag $url, $form_selector, $text, %attributes>
+
+Creates a HTML 'input type="button"' tag with a very specific onclick
+handler that submits the form given by the jQuery selector
+C<$form_selector> to the URL C<$url> (the actual JavaScript function
+called for that is C<kivi.submit_ajax_form()> in
+C<js/client_js.js>). The button's label will be C<$text>.
+
+=item C<button_tag $onclick, $text, %attributes>
+
+Creates a HTML 'input type="button"' tag with an onclick handler
+C<$onclick> and a value of C<$text>. The button does not have a name
+nor an ID by default.
+
+If C<$attributes{confirm}> is set then a JavaScript popup dialog will
+be prepended to the C<$onclick> handler asking the question given with
+C<$attributes{confirm}>. The request is only submitted if the user
+clicks the dialog's "ok/yes" button.
+
 =item C<man_days_tag $name, $object, %attributes>
 
 Creates two HTML inputs: a text input for entering a number and a drop
index bd3edda552a853c4dfb74f5a0c4e8f7f5fab01d2..56dd4fbe895bb46e7a54a81dd31587039a14c7f2 100644 (file)
@@ -73,6 +73,9 @@ sub part_picker   { return _call_presenter('part_picker',   @_); }
 sub chart_picker  { return _call_presenter('chart_picker',  @_); }
 sub customer_vendor_picker   { return _call_presenter('customer_vendor_picker',   @_); }
 sub project_picker           { return _call_presenter('project_picker',           @_); }
+sub button_tag               { return _call_presenter('button_tag',               @_); }
+sub submit_tag               { return _call_presenter('submit_tag',               @_); }
+sub ajax_submit_tag          { return _call_presenter('ajax_submit_tag',          @_); }
 
 sub _set_id_attribute {
   my ($attributes, $name, $unique) = @_;
@@ -143,37 +146,6 @@ sub link {
   return $self->html_tag('a', $content, %params, href => $href);
 }
 
-sub submit_tag {
-  my ($self, $name, $value, %attributes) = _hashify(3, @_);
-
-  if ( $attributes{confirm} ) {
-    $attributes{onclick} = 'return confirm("'. _J(delete($attributes{confirm})) .'");';
-  }
-
-  return $self->input_tag($name, $value, %attributes, type => 'submit', class => 'submit');
-}
-
-sub button_tag {
-  my ($self, $onclick, $value, %attributes) = _hashify(3, @_);
-
-  _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
-  $attributes{type} ||= 'button';
-
-  $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm};
-
-  return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
-}
-
-sub ajax_submit_tag {
-  my ($self, $url, $form_selector, $text, @slurp) = @_;
-
-  $url           = _J($url);
-  $form_selector = _J($form_selector);
-  my $onclick    = qq|kivi.submit_ajax_form('${url}', '${form_selector}')|;
-
-  return $self->button_tag($onclick, $text, @slurp);
-}
-
 sub yes_no_tag {
   my ($self, $name, $value, %attributes) = _hashify(3, @_);
 
@@ -528,36 +500,6 @@ Creates a HTML 'input type=hidden' tag named C<$name> with the value
 C<$value> and with arbitrary HTML attributes from C<%attributes>. The
 tag's C<id> defaults to C<name_to_id($name)>.
 
-=item C<submit_tag $name, $value, %attributes>
-
-Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
-value C<$value> and with arbitrary HTML attributes from C<%attributes>. The
-tag's C<id> defaults to C<name_to_id($name)>.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be added via the C<onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's ok/yes button.
-
-=item C<ajax_submit_tag $url, $form_selector, $text, %attributes>
-
-Creates a HTML 'input type="button"' tag with a very specific onclick
-handler that submits the form given by the jQuery selector
-C<$form_selector> to the URL C<$url> (the actual JavaScript function
-called for that is C<kivi.submit_ajax_form()> in
-C<js/client_js.js>). The button's label will be C<$text>.
-
-=item C<button_tag $onclick, $text, %attributes>
-
-Creates a HTML 'input type="button"' tag with an onclick handler
-C<$onclick> and a value of C<$text>. The button does not have a name
-nor an ID by default.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be prepended to the C<$onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's "ok/yes" button.
-
 =item C<textarea_tag $name, $value, %attributes>
 
 Creates a HTML 'textarea' tag named C<$name> with the content
index ca88e920cf7c9f8ca93c92102034f56796b2f71b..8d55d01acde552e986aa54c759b66a3727d6156f 100644 (file)
@@ -42,12 +42,12 @@ use SL::GL;
 use SL::IR;
 use SL::IS;
 use SL::ReportGenerator;
+use SL::DB::Currency;
 use SL::DB::Default;
 use SL::DB::PurchaseInvoice;
 use SL::Webdav;
 use SL::Locale::String qw(t8);
 
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
@@ -175,7 +175,6 @@ sub create_links {
   IR->get_vendor(\%myconfig, \%$form);
 
   $form->{$_}        = $saved{$_} for keys %saved;
-  $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
   $form->{rowcount}  = 1;
   $form->{AP_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AP} ? $form->{acc_trans}->{AP}->[0]->{chart_id} : $form->{AP_links}->{AP}->[0]->{chart_id};
 
@@ -185,17 +184,7 @@ sub create_links {
   # currencies
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
-  $form->{selectcurrency} = "";
-  map { my $quoted = H($_); $form->{selectcurrency} .= "<option value=\"${quoted}\">${quoted}\n" } $form->get_all_currencies(\%myconfig);
-
-  # vendors
-  if (@{ $form->{all_vendor} || [] }) {
-    $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
-    map { my $quoted = H($_->{name} . "--" . $_->{id}); $form->{selectvendor} .= "<option value=\"${quoted}\">${quoted}\n" }
-      (@{ $form->{all_vendor} });
-  }
-
-  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
 
   $form->{employee} = "$form->{employee}--$form->{employee_id}";
 
@@ -239,7 +228,7 @@ sub form_header {
 
   $::form->{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load if $::form->{id};
 
-  $form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor' : 'row_' . $form->{rowcount};
+  $form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor_id' : 'row_' . $form->{rowcount};
 
   $form->{title_} = $form->{title};
   $form->{title} = $form->{title} eq 'Add' ? $locale->text('Add Accounts Payables Transaction') : $locale->text('Edit Accounts Payables Transaction');
@@ -247,12 +236,6 @@ sub form_header {
   # type=submit $locale->text('Add Accounts Payables Transaction')
   # type=submit $locale->text('Edit Accounts Payables Transaction')
 
-  # set option selected
-  foreach my $item (qw(vendor currency)) {
-    my $to_replace         =  H($form->{$item});
-    $form->{"select$item"} =~ s/ selected//;
-    $form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/;
-  }
   my $readonly = $form->{id} ? "readonly" : "";
 
   $form->{radier} = ($::instance_conf->get_ap_changeable == 2)
@@ -324,11 +307,10 @@ sub form_header {
     $charts{$item->{accno}} = $item;
   }
 
-  my $follow_up_vc         =  $form->{vendor};
-  $follow_up_vc            =~ s/--.*?//;
+  my $follow_up_vc         = $form->{vendor_id} ? SL::DB::Vendor->load_cached($form->{vendor_id})->name : '';
   my $follow_up_trans_info =  "$form->{invnumber} ($follow_up_vc)";
 
-  $::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
+  $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
   my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
   my $first_taxchart;
 
@@ -427,6 +409,7 @@ sub form_header {
 
   print $form->parse_html_template('ap/form_header', {
     today => DateTime->today,
+    currencies => SL::DB::Manager::Currency->get_all_sorted,
   });
 
   $main::lxdebug->leave_sub();
@@ -525,7 +508,9 @@ sub update {
 
   $form->{invdate} = $form->{transdate};
 
-  my $vendor_changed = &check_name("vendor");
+  if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
+    IR->get_vendor(\%::myconfig, $form);
+  }
 
   $form->{rowcount} = $count + 1;
 
@@ -628,7 +613,7 @@ sub post {
   # check if there is a vendor, invoice, due date and invnumber
   $form->isblank("transdate", $locale->text("Invoice Date missing!"));
   $form->isblank("duedate",   $locale->text("Due Date missing!"));
-  $form->isblank("vendor",    $locale->text('Vendor missing!'));
+  $form->isblank("vendor_id", $locale->text('Vendor missing!'));
   $form->isblank("invnumber", $locale->text('Invoice Number missing!'));
 
   if ($myconfig{mandatory_departments} && !$form->{department_id}) {
@@ -683,8 +668,7 @@ sub post {
   }
 
   # if old vendor ne vendor redo form
-  my ($vendor) = split /--/, $form->{vendor};
-  if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
+  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
     &update;
     $::dispatcher->end_request;
   }
@@ -831,18 +815,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 });
 
@@ -879,8 +861,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 dc7074c615c51de3ebe4558dae70d2ac0f3ca83a..16be58c0925462284a2f29d4dd87ebeb07bb7d7e 100644 (file)
@@ -40,7 +40,10 @@ 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;
 use SL::DB::Invoice;
 use SL::ReportGenerator;
 
@@ -172,34 +175,14 @@ sub create_links {
   IS->get_customer(\%myconfig, \%$form);
 
   $form->{$_}          = $saved{$_} for keys %saved;
-  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
   $form->{rowcount}    = 1;
   $form->{AR_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AR} ? $form->{acc_trans}->{AR}->[0]->{chart_id} : $form->{AR_links}->{AR}->[0]->{chart_id};
 
   # currencies
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
-  $form->{selectcurrency} = "";
-  map { $form->{selectcurrency} .= "<option>$_\n" } $form->get_all_currencies(\%myconfig);
-
-  # customers
-  if (@{ $form->{all_customer} || [] }) {
-    $form->{customer} = "$form->{customer}--$form->{customer_id}";
-    map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
-      (@{ $form->{all_customer} });
-  }
-
   $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
 
-  $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
-  # sales staff
-  if (@{ $form->{all_employees} || [] }) {
-    $form->{selectemployee} = "";
-    map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
-      (@{ $form->{all_employees} || [] });
-  }
-
   # build the popup menus
   $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
 
@@ -225,9 +208,9 @@ sub form_header {
   $form->{invoice_obj} = _retrieve_invoice_object();
 
   my ($title, $readonly, $exchangerate, $rows);
-  my ($notes, $customer, $employee, $amount, $project);
+  my ($notes, $amount, $project);
 
-  $form->{initial_focus} = !($form->{amount_1} * 1) ? 'customer' : 'row_' . $form->{rowcount};
+  $form->{initial_focus} = !($form->{amount_1} * 1) ? 'customer_id' : 'row_' . $form->{rowcount};
 
   $title = $form->{title};
   # $locale->text('Add Accounts Receivables Transaction')
@@ -241,12 +224,6 @@ sub form_header {
                       : ($::instance_conf->get_ar_changeable == 1);
   $readonly = ($form->{radier}) ? "" : $readonly;
 
-  # set option selected
-  foreach my $item (qw(customer currency employee)) {
-    $form->{"select$item"} =~ s/ selected//;
-    $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
-  }
-
   $form->{forex}        = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy');
   $form->{exchangerate} = $form->{forex} if $form->{forex};
 
@@ -284,11 +261,10 @@ sub form_header {
     }
   }
 
-  my $follow_up_vc         =  $form->{customer};
-  $follow_up_vc            =~ s/--.*?//;
+  my $follow_up_vc         = $form->{customer_id} ? SL::DB::Customer->load_cached($form->{customer_id})->name : '';
   my $follow_up_trans_info =  "$form->{invnumber} ($follow_up_vc)";
 
-  $::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
+  $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
 
   my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
   my $first_taxchart;
@@ -388,6 +364,16 @@ sub form_header {
 
   $form->{totalpaid} = sum map { $_->{paid} } @payments;
 
+  my $employees = SL::DB::Manager::Employee->get_all_sorted(
+    where => [
+      or => [
+        (id     => $::form->{employee_id}) x !!$::form->{employee_id},
+        deleted => undef,
+        deleted => 0,
+      ],
+    ],
+  );
+
   $form->header;
   print $::form->parse_html_template('ar/form_header', {
     paid_missing         => $::form->{invtotal} - $::form->{totalpaid},
@@ -400,6 +386,8 @@ sub form_header {
     title_str            => $title,
     follow_up_trans_info => $follow_up_trans_info,
     today                => DateTime->today,
+    currencies           => scalar(SL::DB::Manager::Currency->get_all_sorted),
+    employees            => $employees,
   });
 
   $main::lxdebug->leave_sub();
@@ -504,7 +492,9 @@ sub update {
 
   $form->{invdate} = $form->{transdate};
 
-  &check_name("customer");
+  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
+    IS->get_customer(\%myconfig, $form);
+  }
 
   $form->{invtotal} =
     ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
@@ -616,7 +606,7 @@ sub post {
   # check if there is an invoice number, invoice and due date
   $form->isblank("transdate", $locale->text('Invoice Date missing!'));
   $form->isblank("duedate",   $locale->text('Due Date missing!'));
-  $form->isblank("customer",  $locale->text('Customer missing!'));
+  $form->isblank("customer_id", $locale->text('Customer missing!'));
 
   if ($myconfig{mandatory_departments} && !$form->{department_id}) {
     $form->{saved_message} = $::locale->text('You have to specify a department.');
@@ -662,8 +652,7 @@ sub post {
   }
 
   # if oldcustomer ne customer redo form
-  my ($customer) = split /--/, $form->{customer};
-  if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
+  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
     update();
     $::dispatcher->end_request;
   }
@@ -801,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},
@@ -823,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 });
 
@@ -861,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);
diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl
deleted file mode 100644 (file)
index a4e04c0..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-#=====================================================================
-# SQL-Ledger Accounting
-# Copyright (c) 2002
-#
-#  Author: Dieter Simader
-#   Email: dsimader@sql-ledger.org
-#     Web: http://www.sql-ledger.org
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1335, USA.
-#======================================================================
-#
-# common routines for gl, ar, ap, is, ir, oe
-#
-
-use strict;
-
-# any custom scripts for this one
-if (-f "bin/mozilla/custom_arap.pl") {
-  eval { require "bin/mozilla/custom_arap.pl"; };
-}
-if (-f "bin/mozilla/$::myconfig{login}_arap.pl") {
-  eval { require "bin/mozilla/$::myconfig{login}_arap.pl"; };
-}
-
-1;
-
-require "bin/mozilla/common.pl";
-
-# end of main
-
-sub check_name {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit       | sales_order_edit    | invoice_edit |' .
-                'request_quotation_edit       | sales_quotation_edit      | purchase_order_edit | cash         |' .
-                'purchase_delivery_order_edit | sales_delivery_order_edit');
-
-  my ($name, %params) = @_;
-
-  $name = $name eq "customer" ? "customer" : "vendor";
-
-  my ($new_name,$new_id) = $form->{$name} =~ /^(.*?)--(\d+)$/;
-  my $i = 0;
-  # if we use a selection
-  if ($form->{"select$name"}) {
-    if ($form->{"old$name"} ne $form->{$name}) {
-
-      # this is needed for is, ir and oe
-      $form->{update} = 0;
-      # for credit calculations
-      $form->{oldinvtotal}  = 0;
-      $form->{oldtotalpaid} = 0;
-      $form->{calctax}      = 1;
-
-      $form->{"${name}_id"} = $new_id;
-
-      _reset_salesman_id();
-      delete @{ $form }{qw(payment_id)};
-
-      IS->get_customer(\%myconfig, \%$form) if ($name eq 'customer');
-      IR->get_vendor(\%myconfig, \%$form) if ($name eq 'vendor');
-
-      $form->{$name} = $form->{"old$name"} = "$new_name--$new_id";
-
-      $i = 1;
-    }
-  } else {
-
-    # check name, combine name and id
-    if ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|) {
-
-      # this is needed for is, ir and oe
-      $form->{update} = 0;
-
-      # for credit calculations
-      $form->{oldinvtotal}  = 0;
-      $form->{oldtotalpaid} = 0;
-      $form->{calctax}      = 1;
-
-      # return one name or a list of names in $form->{name_list}
-      $i = $form->get_name(\%myconfig, $name);
-
-      if ($i > 1) {
-        if ($params{no_select}) {
-          # $locale->text('Customer')
-          # $locale->text('Vendor')
-          $form->error($locale->text("More than one #1 found matching, please be more specific.", $locale->text(ucfirst $name)));
-        } else {
-          &select_name($name);
-          $::dispatcher->end_request;
-        }
-      }
-
-      if ($i == 1) {
-
-        # we got one name
-        $form->{"${name}_id"} = $form->{name_list}[0]->{id};
-        $form->{$name}        = $form->{name_list}[0]->{name};
-        $form->{"old$name"}   = qq|$form->{$name}--$form->{"${name}_id"}|;
-
-        _reset_salesman_id();
-        delete @{ $form }{qw(payment_id)};
-
-        IS->get_customer(\%myconfig, \%$form) if ($name eq 'customer');
-        IR->get_vendor(\%myconfig, \%$form) if ($name eq 'vendor');
-
-      } else {
-
-        # name is not on file
-        # $locale->text('Customer not on file or locked!')
-        # $locale->text('Vendor not on file or locked!')
-        my $msg = ucfirst $name . " not on file or locked!";
-        $form->error($locale->text($msg));
-      }
-    }
-  }
-  $form->language_payment(\%myconfig);
-
-  $main::lxdebug->leave_sub();
-
-  return $i;
-}
-
-# $locale->text('Customer not on file!')
-# $locale->text('Vendor not on file!')
-
-sub select_name {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('ar_transactions| ap_transactions | vendor_invoice_edit  | sales_order_edit    | invoice_edit | sales_delivery_order_edit |' .
-                'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
-
-  my ($table) = @_;
-
-  my @column_index = qw(ndx name address);
-
-  my $label             = ucfirst $table;
-  my %column_data;
-  $column_data{ndx}  = qq|<th>&nbsp;</th>|;
-  $column_data{name} =
-    qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
-  $column_data{address} =
-    qq|<th class=listheading>| . $locale->text('Address') . qq|</th>|;
-
-  # list items with radio button on a form
-  $form->header;
-
-  my $title = $locale->text('Select from one of the names below');
-
-  print qq|
-    <h1>$title</h1>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr class=listheading>|;
-
-  map { print "\n$column_data{$_}" } @column_index;
-
-  print qq|
-        </tr>
-|;
-
-  my $i = 0;
-  my $j;
-  foreach my $ref (@{ $form->{name_list} }) {
-    my $checked = ($i++) ? "" : "checked";
-
-    $ref->{name} =~ s/\"/&quot;/g;
-
-    $column_data{ndx} =
-      qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
-    $column_data{name} =
-      qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
-    $column_data{address} = qq|<td>$ref->{address}&nbsp;</td>|;
-
-    $j++;
-    $j %= 2;
-    print qq|
-        <tr class=listrow$j>|;
-
-    map { print "\n$column_data{$_}" } @column_index;
-
-    print qq|
-        </tr>
-
-<input name="new_id_$i" type=hidden value=$ref->{id}>
-
-|;
-
-  }
-
-  print qq|
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<input name=lastndx type=hidden value=$i>
-
-|;
-
-  # delete variables
-  map { delete $form->{$_} } qw(action name_list header);
-
-  # save all other form variables
-  foreach my $key (keys %${form}) {
-    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
-    $form->{$key} =~ s/\"/&quot;/g;
-    print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
-  }
-
-  print qq|
-<input type=hidden name=nextsub value=name_selected>
-
-<input type=hidden name=vc value=$table>
-<br>
-<input class=submit type=submit name=action value="|
-    . $locale->text('Continue') . qq|">
-</form>
-|;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub name_selected {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit  | sales_order_edit    | invoice_edit | sales_delivery_order_edit | ' .
-                'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
-
-  # replace the variable with the one checked
-
-  # index for new item
-  my $i = $form->{ndx};
-
-  _reset_salesman_id();
-  delete @{ $form }{qw(payment_id)};
-
-  $form->{ $form->{vc} }    = $form->{"new_name_$i"};
-  $form->{"$form->{vc}_id"} = $form->{"new_id_$i"};
-  $form->{"old$form->{vc}"} =
-    qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
-
-  # delete all the new_ variables
-  for $i (1 .. $form->{lastndx}) {
-    map { delete $form->{"new_${_}_$i"} } qw(id name);
-  }
-
-  map { delete $form->{$_} } qw(ndx lastndx nextsub);
-
-  IS->get_customer(\%myconfig, \%$form) if ($form->{vc} eq 'customer');
-  IR->get_vendor(\%myconfig, \%$form) if ($form->{vc} eq 'vendor');
-
-  &update(1);
-
-  $main::lxdebug->leave_sub();
-}
-
-# Reset the $::form field 'salesman_id' to the ID of the currently
-# logged in user. Useful when changing to a customer/vendor that has
-# no salesman listed in their master data.
-sub _reset_salesman_id {
-  my $current_employee   = SL::DB::Manager::Employee->current;
-  $::form->{salesman_id} = $current_employee->id if $current_employee && exists $::form->{salesman_id};
-}
-
-sub select_project {
-  $::lxdebug->enter_sub;
-
-  $::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
-                  'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
-
-  my ($is_global, $nextsub) = @_;
-  my $project_list = delete $::form->{project_list};
-
-  map { delete $::form->{$_} } qw(action header update);
-
-  my @hiddens;
-  for my $key (keys %$::form) {
-    next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
-    push @hiddens, { key => $key, value => $::form->{$key} };
-  }
-  push @hiddens, { key => 'is_global',                value => $is_global },
-                 { key => 'project_selected_nextsub', value => $nextsub };
-
-  $::form->header;
-  print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
-
-  $::lxdebug->leave_sub;
-}
-
-sub project_selected {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-
-  $main::auth->assert('ar_transactions  | ap_transactions    | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
-                'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
-
-  # replace the variable with the one checked
-
-  # index for new item
-  my $i = $form->{ndx};
-
-  my $prefix = $form->{"is_global"} ? "global" : "";
-  my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}";
-
-  $form->{"${prefix}projectnumber${suffix}"} =
-    $form->{"new_projectnumber_$i"};
-  $form->{"old${prefix}projectnumber${suffix}"} =
-    $form->{"new_projectnumber_$i"};
-  $form->{"${prefix}project_id${suffix}"} = $form->{"new_id_$i"};
-
-  # delete all the new_ variables
-  for $i (1 .. $form->{lastndx}) {
-    map { delete $form->{"new_${_}_$i"} } qw(id projectnumber description);
-  }
-
-  my $nextsub = $form->{project_selected_nextsub} || 'update';
-
-  map { delete $form->{$_} } qw(ndx lastndx nextsub is_global project_selected_nextsub);
-
-  call_sub($nextsub);
-
-  $main::lxdebug->leave_sub();
-}
-
-sub continue       { call_sub($main::form->{"nextsub"}); }
-
-1;
-
-__END__
-
-=head1 NAME
-
-arap.pl - helper functions or customer/vendor retrieval
-
-=head1 SYNOPSIS
-
- check_name('vendor')
-
-=head1 DESCRIPTION
-
-Don't use anyting in this file without extreme care, and even then be prepared for massive headaches.
-
-It's a collection of helper routines that wrap the customer/vendor dropdown/textfield duality into something even complexer.
-
-=head1 FUNCTIONS
-
-=head2 check_name customer|vendor
-
-check_name was originally meant to update the selected customer or vendor. The
-way it does that has generted more hate than almost any other part of this
-software.
-
-What it does is:
-
-=over 4
-
-=item *
-
-It checks if a vendor or customer is given. No failsafe, vendor fallback if
-$_[0] is something fancy.
-
-=item *
-
-It assumes, that there is a field named customer or vendor in $form.
-
-=item *
-
-It assumes, that this field is filled with name--id, and tries to split that.
-sql ledger uses that combination to get ids into the select keys.
-
-=item *
-
-It looks for a field selectcustomer or selectvendor in $form. sql ledger used
-to store a copy of the html select in there. (again, don't ask)
-
-=item *
-
-If this field exists, it looks for a field called oldcustomer or oldvendor, in
-which the old name--id string was stored in sql ledger, and compares those.
-
-=item *
-
-if they don't match, it will set customer_id or vendor_id in $form, load the
-entry (which will clobber everything in $form named like a column in customer
-oder vendor) and return.
-
-=item *
-
-If there was no select* entry, it assumes that vclimit was lower than the
-number of entries, and that an input field was generated. In that case the
-splitting is omitted (since users don't generally include ids in entered names)
-
-=item *
-
-It looks for a *_id field, and combines it with the given input into a name--id
-entry and compares it to the old* entry. (Missing any of these will instantly
-break check_namea.
-
-=item *
-
-If those do not match, $form->get_name is called to get matching results.
-get_name only matches by *number and name, not by id, don't try to get it to do
-so.
-
-=item *
-
-The results are stored in $form>{name_list} but a count is returned, and
-checked.
-
-=item *
-
-If only one result was found, *_id, * and old* are copied into $form, the entry
-is loaded (like above, clobbering)
-
-=item *
-
-If there is more than one, a selection dialog is rendered
-
-=item *
-
-If none is found, an error is generated.
-
-=back
-
-=head3 I built a customer/vendor box somewhere and it doesn't work, what's wrong?
-
-Make sure a select* field is given if and only if you render a select box. The
-actual contents are ignored, but recognition fails if not present.
-
-Make sure old* and *_id fields are set correctly (name--id form for old*). They
-are necessary in all steps and branches.
-
-Since get_customer and get_vendor clobber a lot of fields, make sure what
-changes exactly.
-
-=head3 select- version works fine, but things go awry when I use a textbox, any idea?
-
-If there is more than one match, check_name will display a select form, that
-will redirect to the original C<nextsub>. Unfortunately any hidden vars or
-input fields will be lost in the process unless saved before in a callback.
-
-If you still want to use it, you can disable this feature, like this:
-
-  check_name('customer', no_select => 1)
-
-In that case multiple matches will trigger an error.
-
-Otherwise you'll have to care to include a complete state in callback.
-
-=cut
index 78a343852e44cc7888ff56fcc8db5b47e95cfba6..f40708b80059739562b3e814da9f3750b1a01e0c 100644 (file)
@@ -69,9 +69,6 @@ sub search {
 
   assert_bp_access();
 
-  # setup customer/vendor selection
-  BP->get_vc(\%::myconfig, $::form);
-
   my %label = (
        invoice           => { title => $::locale->text('Sales Invoices'),  invnumber => 1, ordnumber => 1 },
        sales_order       => { title => $::locale->text('Sales Orders'),    ordnumber => 1, },
index 8e77f6309039916e616533adc65bf96d8b80b0ef..e21b3c5052d6bf3672131d66f79cdc43a40d9ad1 100644 (file)
@@ -437,4 +437,6 @@ sub db {
   goto &SL::DB::Helper::Mappings::db;
 }
 
+sub continue { call_sub($::form->{nextsub}); }
+
 1;
index 969f3c4053611e0119a9f80ba8f75678abc64d8f..2bc2c1aa906e580ad7ef04d68b97fe9120fc5a7f 100644 (file)
@@ -41,7 +41,6 @@ use Data::Dumper;
 use strict;
 #use warnings;
 
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 
 our ($form, %myconfig, $lxdebug, $locale, $auth);
@@ -60,27 +59,6 @@ sub payment {
   $form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP";
   $form->{arap} = lc $form->{ARAP};
 
-  # setup customer/vendor selection for open invoices
-  if ($form->{all_vc}) {
-    # Dieser Zweig funktioniert derzeit NIE. Ggf. ganz raus oder
-    # alle offenen Zahlungen wieder korrekt anzeigen. jb 12.10.2010
-    $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
-  } else {
-    CP->get_openvc(\%myconfig, \%$form);
-  }
-  # Auswahlliste für vc zusammenbauen
-  # Erweiterung für schliessende option und erweiterung um value
-  # für bugfix 1771 (doppelte Leerzeichen werden nicht 'gepostet')
-  $form->{"select$form->{vc}"} = "";
-
-  if ($form->{"all_$form->{vc}"}) {
-    $form->{"select$form->{vc}"} .= "<option value=\"\"></option>\n";
-    # s.o. jb 12.10.2010
-    $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
-    # hotfix for 2450. TODO remove legacy code and use L
-    map { $form->{"select$form->{vc}"} .= "<option value=\"" . H($_->{name}) . "--$_->{id}\">" . H($_->{name}) . "--$_->{id}</option>\n" }
-      @{ $form->{"all_$form->{vc}"} };
-  }
   CP->paymentaccounts(\%myconfig, \%$form);
 
   # Standard Konto für Umlaufvermögen
@@ -95,13 +73,6 @@ sub payment {
   map { $form->{selectaccount} .= "<option value=\"$_->{accno}--$_->{description}\">$_->{accno}--$_->{description}</option>\n";
         $form->{account}        = "$_->{accno}--$_->{description}" if ($_->{accno} eq $accno_arap) } @{ $form->{PR}{"$form->{ARAP}_paid"} };
 
-  # Braucht man das hier Ã¼berhaupt? Erstmal auskommentieren .. jan 18.12.2010
-  #  map {
-  #    $form->{"select$form->{ARAP}"} .=
-  #      "<option>$_->{accno}--$_->{description}\n"
-  #  } @{ $form->{PR}{ $form->{ARAP} } };
-  # ENDE LOESCHMICH in 2012
-
   # currencies
   # oldcurrency ist zwar noch hier als fragment enthalten, wird aber bei
   # der aktualisierung der form auch nicht mitübernommen. das konzept
@@ -131,35 +102,26 @@ sub form_header {
 
   $auth->assert('cash');
 
-  my ($vc, $arap, $exchangerate);
+  $::request->layout->add_javascripts("autocomplete_customer.js");
 
-  if ($form->{ $form->{vc} } eq "") {
+  my ($arap, $exchangerate);
+
+  if (!$form->{ $form->{vc} . '_id' }) {
     map { $form->{"addr$_"} = "" } (1 .. 4);
   }
 
-  # sometimes it happens that values in customer arrive without the signs '--'
-  # but in order to select the right option field we need values with '--'
-  if ($form->{vc} eq "customer" && $form->{"all_$form->{vc}"}){
-    my ($customername) = split /--/, $form->{ $form->{vc} };
-    $form->{ $form->{vc} } = $customername . "--" . $form->{customer_id};
-  }
   # bugfix 1771
   # geändert von <option>asdf--2929
   # nach:
   #              <option value="asdf--2929">asdf--2929</option>
   # offen: $form->{ARAP} kann raus?
-  for my $item ($form->{vc}, "account", "currency", $form->{ARAP}) {
+  for my $item ("account", "currency", $form->{ARAP}) {
     $form->{$item} = H($form->{$item});
     $form->{"select$item"} =~ s/ selected//;
     $form->{"select$item"} =~ s/option value="\Q$form->{$item}\E">\Q$form->{$item}\E/option selected value="$form->{$item}">$form->{$item}/;
   }
 
-  $vc =
-    ($form->{"select$form->{vc}"})
-    ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}\n</select>|
-    : qq|<input name=$form->{vc} size=35 value="$form->{$form->{vc}}">|;
-
-  $form->{openinvoices} = $form->{all_vc} ? "" : 1;
+  $form->{openinvoices} = 1;
 
   # $locale->text('AR')
   # $locale->text('AP')
@@ -172,7 +134,6 @@ sub form_header {
     is_customer => $form->{vc}   eq 'customer',
     is_receipt  => $form->{type} eq 'receipt',
     arap        => $arap,
-    vccontent   => $vc,
   });
 
   $lxdebug->leave_sub;
@@ -211,9 +172,7 @@ sub update {
 
   $auth->assert('cash');
 
-  my ($new_name_selected) = @_;
-
-  my ($buysell, $newvc, $updated, $exchangerate, $amount);
+  my ($buysell, $updated, $exchangerate, $amount);
 
   if ($form->{vc} eq 'customer') {
     $buysell = "buy";
@@ -221,59 +180,6 @@ sub update {
     $buysell = "sell";
   }
 
-  # if we switched to all_vc
-  # funktioniert derzeit nicht 12.10.2010 jb
-  if ($form->{all_vc} ne $form->{oldall_vc}) {
-
-    $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1;
-
-    $form->{"select$form->{vc}"} = "";
-
-    if ($form->{all_vc}) {
-      $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
-
-      if ($form->{"all_$form->{vc}"}) {
-        map {
-          $form->{"select$form->{vc}"} .=
-            "<option>$_->{name}--$_->{id}\n"
-        } @{ $form->{"all_$form->{vc}"} };
-      }
-    } else {  # ab hier wieder ausgeführter code (s.o.):
-      CP->get_openvc(\%myconfig, \%$form);
-
-      if ($form->{"all_$form->{vc}"}) {
-        $newvc =
-          qq|$form->{"all_$form->{vc}"}[0]->{name}--$form->{"all_$form->{vc}"}[0]->{id}|;
-        map {
-          $form->{"select$form->{vc}"} .=
-            "<option>$_->{name}--$_->{id}\n"
-        } @{ $form->{"all_$form->{vc}"} };
-      }
-
-      # if the name is not the same
-      if ($form->{"select$form->{vc}"} !~ /$form->{$form->{vc}}/) {
-        $form->{ $form->{vc} } = $newvc;
-      }
-    }
-  }
-
-  # search by customernumber
-  # the customernumber has to be correct otherwise nothing is found
-  if ($form->{vc} eq 'customer' and $form->{customernumber} and $form->{ARAP} eq 'AR') {
-    $form->{open} ='Y'; # only open invoices
-    # ar_transactions automatically searches by $form->{customer_id} or else
-    # $form->{customer} if available, and these variables will always be set
-    # so we have to empty these values first
-    $form->{customer_id} = '';
-    $form->{customer} = '';
-    AR->ar_transactions(\%myconfig, \%$form);
-
-    # Here we just take the first returned value even if the custumernumber
-    # may not be unique
-    $form->{customer} = $form->{AR}[0]{name};
-    $form->{customer_id} = $form->{AR}[0]{customer_id};
-  }
-
   # search by invoicenumber,
   if ($form->{invnumber}) {
     $form->{open} ='Y'; # only open invoices
@@ -296,51 +202,32 @@ sub update {
       foreach my $i ( @{ $form->{AR} } ) {
         next unless $i->{invnumber} eq $form->{invnumber};
         # found exactly matching invnumber
-        $form->{$form->{vc}} = $i->{name};
         $form->{customer_id} = $i->{customer_id};
-        #$form->{"old${form->{vc}"} = $i->{customer_id};
         $found_exact_invnumber_match = 1;
       };
 
       unless ( $found_exact_invnumber_match ) {
         # use first returned entry, may not be the correct one if invnumber doesn't
         # match uniquely
-        $form->{$form->{vc}} = $form->{AR}[0]{name};
         $form->{customer_id} = $form->{AR}[0]{customer_id};
       };
     } else {
       # s.o. nur für zahlungsausgang
       AP->ap_transactions(\%myconfig, \%$form);
-      $form->{$form->{vc}} = $form->{AP}[0]{name};
+      $form->{vendor_id} = $form->{AP}[0]{vendor_id};
     }
   }
 
   # determine customer/vendor
-  if ( $form->{customer_id} and ($form->{invnumber} or $form->{customernumber}) ) {
-    # we already know the exact customer_id, so fill $form with customer data
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
     IS->get_customer(\%myconfig, \%$form);
-    $updated = 1;
-  } else {
-    # check_name is called with "customer" or "vendor" and otherwise uses contents of $form
-    # check_name also runs get_customer/get_vendor
-    $updated = &check_name($form->{vc});
-  };
-
-  if ($new_name_selected || $updated) {
-    # get open invoices from ar/ap using $form->{vc} and a.${vc}_id, i.e. customer_id
-    CP->get_openinvoices(\%myconfig, \%$form);
-    ($newvc) = split /--/, $form->{ $form->{vc} };
-    $form->{"old$form->{vc}"} = qq|$newvc--$form->{"$form->{vc}_id"}|;
-    $updated = 1;
   }
 
-  if ($form->{currency} ne $form->{oldcurrency}) {
-    $form->{oldcurrency} = $form->{currency};
-    if (!$updated) {
-      CP->get_openinvoices(\%myconfig, \%$form);
-      $updated = 1;
-    }
-  }
+  $form->{oldcurrency} = $form->{currency};
+
+  # get open invoices from ar/ap using a.${vc}_id, i.e. customer_id
+  CP->get_openinvoices(\%myconfig, \%$form) if $form->{"${vc}_id"};
 
   if (!$form->{forex}) {        # read exchangerate from input field (not hidden)
     $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
@@ -350,7 +237,7 @@ sub update {
 
   $amount = $form->{amount} = $form->parse_amount(\%myconfig, $form->{amount});
 
-  if ($updated) {
+  if ($form->{"${vc}_id"}) {
     $form->{rowcount} = 0;
 
     $form->{queued} = "";
@@ -415,7 +302,7 @@ sub update {
   $form->{amount}=$amount;
 
   &form_header;
-  &list_invoices;
+  list_invoices() if $form->{"${vc}_id"};
   &form_footer;
 
   $lxdebug->leave_sub();
@@ -456,7 +343,11 @@ sub check_form {
 
   my ($closedto, $datepaid, $amount);
 
-  &check_name($form->{vc});
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+  }
 
   if ($form->{currency} ne $form->{oldcurrency}) {
     &update;
index 8a10912cff3b6173fbadb5f1e09a17aefe07419c..c6c520e66d980764deca4738480215f7a88f635c 100644 (file)
@@ -36,6 +36,7 @@ use POSIX qw(strftime);
 
 use SL::IS;
 use SL::DN;
+use SL::DB::Department;
 use SL::DB::Dunning;
 use SL::Helper::Flash qw(flash);
 use SL::Locale::String qw(t8);
@@ -98,12 +99,8 @@ sub add {
 
   $main::auth->assert('dunning_edit');
 
-  # setup customer selection
-  $form->all_vc(\%myconfig, "customer", "AR");
-
   DN->get_config(\%myconfig, \%$form);
 
-  $form->{SHOW_CUSTOMER_SELECTION}      = $form->{all_customer}    && scalar @{ $form->{all_customer} };
   $form->{SHOW_DUNNING_LEVEL_SELECTION} = $form->{DUNNING}         && scalar @{ $form->{DUNNING} };
   $form->{SHOW_DEPARTMENT_SELECTION}    = $form->{all_departments} && scalar @{ $form->{all_departments} || [] };
 
@@ -306,8 +303,6 @@ sub search {
 
   DN->get_config(\%myconfig, \%$form);
 
-  $form->{SHOW_CUSTOMER_DDBOX}   = scalar @{ $form->{ALL_CUSTOMERS} } <= $myconfig{vclimit};
-  $form->{SHOW_DEPARTMENT_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} };
   $form->{SHOW_DUNNING_LEVELS}   = scalar @{ $form->{DUNNING} };
 
   $form->{title}    = $locale->text('Dunnings');
index f69da647bb5df0396a43d4d855bf7fa9b214d63f..69df28eeb02f6274a9ce6ba916843f81ad0b8b3f 100644 (file)
@@ -45,7 +45,6 @@ use SL::MoreCommon qw(ary_diff restore_form save_form);
 use SL::ReportGenerator;
 use SL::WH;
 use Sort::Naturally ();
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/io.pl";
 require "bin/mozilla/reportgenerator.pl";
@@ -172,9 +171,6 @@ sub order_links {
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
 
-  # get customer/vendor
-  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
-
   # retrieve order/quotation
   my $editing = $form->{id};
 
@@ -197,17 +193,6 @@ sub order_links {
   $form->restore_vars(qw(taxincluded)) if $form->{id};
   $form->restore_vars(qw(salesman_id)) if $editing;
 
-  if ($form->{"all_$form->{vc}"}) {
-    unless ($form->{"$form->{vc}_id"}) {
-      $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
-    }
-  }
-
-  ($form->{ $form->{vc} })  = split /--/, $form->{ $form->{vc} };
-  $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
-
-  $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
   $main::lxdebug->leave_sub();
 }
 
@@ -259,12 +244,14 @@ sub form_header {
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
 
+  my $class       = "SL::DB::" . ($form->{vc} eq 'customer' ? 'Customer' : 'Vendor');
+  $form->{VC_OBJ} = $class->load_cached($form->{ $form->{vc} . '_id' });
+
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
 
   my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
-  $form->get_lists($vc              => "ALL_VC",
-                   "price_factors"  => "ALL_PRICE_FACTORS",
+  $form->get_lists("price_factors"  => "ALL_PRICE_FACTORS",
                    "business_types" => "ALL_BUSINESS_TYPES",
     );
   $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
@@ -302,13 +289,6 @@ sub form_header {
     ]
   ]);
 
-  map { $_->{value} = "$_->{name}--$_->{id}"        } @{ $form->{ALL_VC} };
-
-  $form->{SHOW_VC_DROP_DOWN} =  $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
-
-  $form->{oldvcname}         =  $form->{"old$form->{vc}"};
-  $form->{oldvcname}         =~ s/--.*//;
-
   my $dispatch_to_popup = '';
   if ($form->{resubmit} && ($form->{format} eq "html")) {
     $dispatch_to_popup  = "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
@@ -320,10 +300,7 @@ sub form_header {
   $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});");
 
 
-  my $follow_up_vc                =  $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
-  $follow_up_vc                   =~ s/--\d*\s*$//;
-
-  $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')';
+  $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')';
 
   $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part));
 
@@ -383,7 +360,14 @@ sub update_delivery_order {
   my $payment_id;
   $payment_id = $form->{payment_id} if $form->{payment_id};
 
-  check_name($form->{vc});
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
+
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+  }
+
   $form->{discount} =  $form->{"$form->{vc}_discount"} if defined $form->{"$form->{vc}_discount"};
   # Problem: Wenn man ohne Erneuern einen Kunden/Lieferanten
   # wechselt, wird der entsprechende Kunden/ Lieferantenrabatt
@@ -501,11 +485,9 @@ sub search {
 
   $form->get_lists("projects"       => { "key" => "ALL_PROJECTS",
                                          "all" => 1 },
-                   "$form->{vc}s"   => "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_VC_DROP_DOWN} =  $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
   $form->{title}             = $locale->text('Delivery Orders');
 
   $form->header();
@@ -727,7 +709,7 @@ sub save {
   $form->{donumber} =~ s/\s*$//g;
 
   my $msg = ucfirst $form->{vc};
-  $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
+  $form->isblank($form->{vc} . "_id", $locale->text($msg . " missing!"));
 
   # $locale->text('Customer missing!');
   # $locale->text('Vendor missing!');
@@ -736,7 +718,13 @@ sub save {
   validate_items();
 
   # if the name changed get new values
-  if (check_name($form->{vc})) {
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
+
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+
     update();
     $::dispatcher->end_request;
   }
@@ -1831,7 +1819,6 @@ __END__
 
 do.pl - Script for all calls to delivery order
 
-
 =head1 FUNCTIONS
 
 =over 2
index d67409398356fd5803b0fa0a01321848b01750ef..3205382296ccc0a5c4672c9cc6c541a86196e52c 100644 (file)
@@ -84,9 +84,6 @@ sub search {
   $form->{lastsort}     = ""; # memory for which table was sort at last time
   $form->{ndxs_counter} = 0;  # counter for added entries to top100
 
-  # for seach all possibibilities, is_service only used as UNLESS so == 0
-  my %is_xyz     = ("is_part" => 1, "is_service" => 0, "is_assembly" =>1 );
-
   $form->{title} = (ucfirst $form->{searchitems}) . "s";
   $form->{title} =~ s/ys$/ies/;
   $form->{title} = $locale->text($form->{title});
@@ -100,7 +97,7 @@ sub search {
   $form->header;
 
   $form->get_lists('partsgroup'    => 'ALL_PARTSGROUPS');
-  print $form->parse_html_template('ic/search', { %is_xyz, });
+  print $form->parse_html_template('ic/search');
 
   $lxdebug->leave_sub();
 }    #end search()
index d4a42a78d45029b098e259b507834798d1a08564..5691c443e8dc4235fa6461b317be02ebf22e47c2 100644 (file)
@@ -36,12 +36,13 @@ use SL::FU;
 use SL::IR;
 use SL::IS;
 use SL::DB::Default;
+use SL::DB::Department;
 use SL::DB::PurchaseInvoice;
+use SL::DB::Vendor;
 use List::Util qw(max sum);
 use List::UtilsBy qw(sort_by);
 
 require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 
 use strict;
@@ -109,17 +110,6 @@ sub invoice_links {
   # create links
   $form->create_links("AP", \%myconfig, "vendor");
 
-  #quote all_vendor Bug 133
-  foreach my $ref (@{ $form->{all_vendor} }) {
-    $ref->{name} = $form->quote($ref->{name});
-  }
-
-  if ($form->{all_vendor}) {
-    unless ($form->{vendor_id}) {
-      $form->{vendor_id} = $form->{all_vendor}->[0]->{id};
-    }
-  }
-
   $form->backup_vars(qw(payment_id language_id taxzone_id
                         currency delivery_term_id intnotes cp_id));
 
@@ -132,25 +122,6 @@ sub invoice_links {
   my @curr = $form->get_all_currencies();
   map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
 
-  $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
-
-  # build vendor/customer drop down comatibility... don't ask
-  if (@{ $form->{"all_vendor"} || [] }) {
-    $form->{"selectvendor"} = 1;
-    $form->{vendor}         = qq|$form->{vendor}--$form->{vendor_id}|;
-  }
-
-  # departments
-  if ($form->{all_departments}) {
-    $form->{selectdepartment} = "<option>\n";
-    $form->{department}       = "$form->{department}--$form->{department_id}";
-
-    map {
-      $form->{selectdepartment} .=
-        "<option>$_->{description}--$_->{id}\n"
-    } (@{ $form->{all_departments} || [] });
-  }
-
   # forex
   $form->{forex} = $form->{exchangerate};
   my $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
@@ -258,7 +229,8 @@ sub form_header {
   my %TMPL_VAR = ();
   my @custom_hiddens;
 
-  $TMPL_VAR{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $form->{id})->load if $form->{id};
+  $TMPL_VAR{invoice_obj} = SL::DB::PurchaseInvoice->load_cached($form->{id}) if $form->{id};
+  $TMPL_VAR{vendor_obj}  = SL::DB::Vendor->load_cached($form->{vendor_id})   if $form->{vendor_id};
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
 
@@ -267,15 +239,11 @@ sub form_header {
   my @old_project_ids = ($form->{"globalproject_id"});
   map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"};
 
-  $form->get_lists("projects"      => { "key"    => "ALL_PROJECTS",
-                                        "all"    => 0,
-                                        "old_id" => \@old_project_ids },
-                   "taxzones"      => "ALL_TAXZONES",
+  $form->get_lists("taxzones"      => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
                    "currencies"    => "ALL_CURRENCIES",
-                   "vendors"       => "ALL_VENDORS",
-                   "departments"   => "all_departments",
                    "price_factors" => "ALL_PRICE_FACTORS");
 
+  $TMPL_VAR{ALL_DEPARTMENTS}       = SL::DB::Manager::Department->get_all_sorted;
   $TMPL_VAR{ALL_EMPLOYEES}         = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id},  deleted => 0 ] ]);
   $TMPL_VAR{ALL_CONTACTS}          = SL::DB::Manager::Contact->get_all_sorted(query => [
     or => [
@@ -286,15 +254,6 @@ sub form_header {
       ]
     ]
   ]);
-  $TMPL_VAR{department_labels}     = sub { "$_[0]->{description}--$_[0]->{id}" };
-
-  # customer
-  $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
-  $TMPL_VAR{vclimit} = $myconfig{vclimit};
-  $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('vendor', '', 1, 0)";
-  push @custom_hiddens, "vendor_id";
-  push @custom_hiddens, "oldvendor";
-  push @custom_hiddens, "selectvendor";
 
   # currencies and exchangerate
   my @values = map { $_       } @{ $form->{ALL_CURRENCIES} };
@@ -312,10 +271,6 @@ sub form_header {
   $TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
   $TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
 
-  my $follow_up_vc         =  $form->{vendor};
-  $follow_up_vc            =~ s/--\d*\s*$//;
-  $TMPL_VAR{vendor_name} = $follow_up_vc;
-
 # set option selected
   foreach my $item (qw(AP)) {
     $form->{"select$item"} =~ s/ selected//;
@@ -341,7 +296,7 @@ sub form_header {
   $TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice();
   $form->{duedate}             = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{due_due})->to_kivitendo if $TMPL_VAR{payment_terms_obj};
 
-  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js));
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part autocomplete_project client_js));
 
   $form->header();
 
@@ -487,7 +442,9 @@ sub update {
 
   $main::auth->assert('vendor_invoice_edit');
 
-  &check_name('vendor');
+  if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
+    IR->get_vendor(\%myconfig, $form);
+  }
 
   if (!$form->{forex}) {        # read exchangerate from input field (not hidden)
     $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
@@ -749,14 +706,14 @@ sub post {
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
   $form->isblank("invdate",   $locale->text('Invoice Date missing!'));
-  $form->isblank("vendor",    $locale->text('Vendor missing!'));
+  $form->isblank("vendor_id", $locale->text('Vendor missing!'));
   $form->isblank("invnumber", $locale->text('Invnumber missing!'));
 
   $form->{invnumber} =~ s/^\s*//g;
   $form->{invnumber} =~ s/\s*$//g;
 
   # if the vendor changed get new values
-  if (&check_name('vendor')) {
+  if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
     &update;
     $::dispatcher->end_request;
   }
index 5db9b9cf1dbaacab10ea4086052fa7ccca9a0fc3..942323fa910a74c902fe5b610cf26fb7dac7eb06 100644 (file)
@@ -45,11 +45,12 @@ use English qw(-no_match_vars);
 
 use SL::DB::Default;
 use SL::DB::Customer;
+use SL::DB::Department;
 use SL::DB::Invoice;
 use SL::DB::PaymentTerm;
 
+require "bin/mozilla/common.pl";
 require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
 
 use strict;
 
@@ -143,13 +144,6 @@ sub invoice_links {
   # create links
   $form->create_links("AR", \%myconfig, "customer");
 
-  if ($form->{all_customer}) {
-    unless ($form->{customer_id}) {
-      $form->{customer_id} = $form->{all_customer}->[0]->{id};
-      $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id};
-    }
-  }
-
   my $editing = $form->{id};
 
   $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id
@@ -158,11 +152,6 @@ sub invoice_links {
 
   IS->get_customer(\%myconfig, \%$form);
 
-  #quote all_customer Bug 133
-  foreach my $ref (@{ $form->{all_customer} }) {
-    $ref->{name} = $form->quote($ref->{name});
-  }
-
   $form->restore_vars(qw(id));
 
   IS->retrieve_invoice(\%myconfig, \%$form);
@@ -171,23 +160,6 @@ sub invoice_links {
   $form->restore_vars(qw(taxincluded)) if $form->{id};
   $form->restore_vars(qw(salesman_id)) if $editing;
 
-
-  # build vendor/customer drop down compatibility... don't ask
-  if (@{ $form->{"all_customer"} }) {
-    $form->{"selectcustomer"} = 1;
-    $form->{customer}         = qq|$form->{customer}--$form->{"customer_id"}|;
-  }
-
-  $form->{"oldcustomer"}  = $form->{customer};
-
-  if ($form->{"oldcustomer"} !~ m/--\d+$/ && $form->{"customer_id"}) {
-    $form->{"oldcustomer"} .= qq|--$form->{"customer_id"}|
-  }
-
-
-#  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
-#  $form->{selectcustomer} = 1;
-
   $form->{employee} = "$form->{employee}--$form->{employee_id}";
 
   # forex
@@ -291,10 +263,9 @@ sub form_header {
   my %TMPL_VAR = ();
   my @custom_hiddens;
 
-  if ($form->{id}) {
-    require SL::DB::Invoice;
-    $TMPL_VAR{invoice_obj} = SL::DB::Invoice->new(id => $form->{id})->load;
-  }
+  $TMPL_VAR{customer_obj} = SL::DB::Customer->load_cached($form->{customer_id}) if $form->{customer_id};
+  $TMPL_VAR{invoice_obj}  = SL::DB::Invoice->load_cached($form->{id})           if $form->{id};
+
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
 
@@ -302,10 +273,9 @@ sub form_header {
 
   $form->get_lists("taxzones"      => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
                    "currencies"    => "ALL_CURRENCIES",
-                   "customers"     => "ALL_CUSTOMERS",
                    "price_factors" => "ALL_PRICE_FACTORS");
 
-  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
 
   # Projects
   my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
@@ -340,15 +310,6 @@ sub form_header {
       ]
     ]
   ]);
-  $TMPL_VAR{department_labels}     = sub { "$_[0]->{description}--$_[0]->{id}" };
-
-  # customer
-  $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
-  $TMPL_VAR{vclimit} = $myconfig{vclimit};
-  $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('customer', '', 0, 0)";
-  push @custom_hiddens, "customer_id";
-  push @custom_hiddens, "oldcustomer";
-  push @custom_hiddens, "selectcustomer";
 
   # currencies and exchangerate
   my @values = map { $_       } @{ $form->{ALL_CURRENCIES} };
@@ -365,10 +326,6 @@ sub form_header {
   $TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
   $TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
 
-  my $follow_up_vc         =  $form->{customer};
-  $follow_up_vc            =~ s/--\d*\s*$//;
-  $TMPL_VAR{customer_name} = $follow_up_vc;
-
 # set option selected
   foreach my $item (qw(AR)) {
     $form->{"select$item"} =~ s/ selected//;
@@ -448,7 +405,7 @@ sub form_footer {
   $form->{taxaccounts_array} = [ split(/ /, $form->{taxaccounts}) ];
 
   if( $form->{customer_id} && !$form->{taxincluded_changed_by_user} ) {
-    my $customer = SL::DB::Customer->new(id => $form->{customer_id})->load();
+    my $customer = SL::DB::Customer->load_cached($form->{customer_id});
     $form->{taxincluded} = defined($customer->taxincluded_checked) ? $customer->taxincluded_checked : $myconfig{taxincluded_checked};
   }
 
@@ -561,7 +518,11 @@ sub update {
   my $taxincluded         = $form->{taxincluded} ? "checked" : '';
   $form->{update} = 1;
 
-  &check_name("customer");
+  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
+
+    IS->get_customer(\%myconfig, $form);
+  }
 
   $form->{taxincluded} ||= $taxincluded;
 
@@ -750,7 +711,7 @@ sub post {
 
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
   $form->isblank("invdate",  $locale->text('Invoice Date missing!'));
-  $form->isblank("customer", $locale->text('Customer missing!'));
+  $form->isblank("customer_id", $locale->text('Customer missing!'));
   $form->error($locale->text('Cannot post invoice for a closed period!'))
         if ($form->date_closed($form->{"invdate"}, \%myconfig));
 
@@ -758,7 +719,7 @@ sub post {
   $form->{invnumber} =~ s/\s*$//g;
 
   # if oldcustomer ne customer redo form
-  if (&check_name('customer')) {
+  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
     &update;
     $::dispatcher->end_request;
   }
index a38f04baa83c2a8e3a45eaf94739c892b04b779a..17d9fb5008af96b986ecbca8f9f8ebcbc56e9db6 100644 (file)
@@ -52,8 +52,8 @@ use SL::DB::Customer;
 use SL::DB::TaxZone;
 use SL::DB::PaymentTerm;
 
+require "bin/mozilla/common.pl";
 require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/reportgenerator.pl";
 
 use strict;
@@ -241,9 +241,6 @@ sub order_links {
 
   check_oe_access();
 
-  # get customer/vendor
-  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
-
   # retrieve order/quotation
   my $editing = $form->{id};
 
@@ -256,8 +253,6 @@ sub order_links {
     if          $form->{rowcount}  && $form->{type}     eq 'sales_order'
      && defined $form->{customer}  && $form->{customer} eq '';
 
-  $form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"};
-
   $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes shipto_id delivery_term_id currency));
 
   # get customer / vendor
@@ -271,18 +266,6 @@ sub order_links {
   $form->{forex}       = $form->{exchangerate};
   $form->{employee}    = "$form->{employee}--$form->{employee_id}";
 
-  # build vendor/customer drop down comatibility... don't ask
-  if (@{ $form->{"all_$form->{vc}"} || [] }) {
-    $form->{"select$form->{vc}"} = 1;
-    $form->{$form->{vc}}         = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
-  }
-
-  $form->{"old$form->{vc}"}  = $form->{$form->{vc}};
-
-  if ($form->{"old$form->{vc}"} !~ m/--\d+$/ && $form->{"$form->{vc}_id"}) {
-    $form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}|
-  }
-
   $main::lxdebug->leave_sub();
 }
 
@@ -354,8 +337,6 @@ sub form_header {
 
   $form->get_lists("taxzones"      => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
                    "currencies"    => "ALL_CURRENCIES",
-                   $vc             => { key   => "ALL_" . uc($vc),
-                                        limit => $myconfig{vclimit} + 1 },
                    "price_factors" => "ALL_PRICE_FACTORS");
   $form->{ALL_PAYMENTS} = SL::DB::Manager::PaymentTerm->get_all( where => [ or => [ obsolete => 0, id => $form->{payment_id} || undef ] ]);
 
@@ -399,23 +380,9 @@ sub form_header {
   ]);
   $TMPL_VAR{sales_employee_labels} = sub { $_[0]->{name} || $_[0]->{login} };
 
-  # vendor/customer
-  $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
-  $TMPL_VAR{vclimit} = $myconfig{vclimit};
-  $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('$form->{vc}', '', @{[ $form->{vc} eq 'vendor' ? 1 : 0 ]}, 0)";
-  push @custom_hiddens, "$form->{vc}_id";
-  push @custom_hiddens, "old$form->{vc}";
-  push @custom_hiddens, "select$form->{vc}";
-
   # currencies and exchangerate
-  my @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
-  my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
   $form->{currency}            = $form->{defaultcurrency} unless $form->{currency};
   $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
-  $TMPL_VAR{currencies}        = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
-                                                      '-values' => \@values, '-labels' => \%labels,
-                                                      '-onchange' => "document.getElementById('update_button').click();"
-                                     )) if scalar @values;
   push @custom_hiddens, "forex";
   push @custom_hiddens, "exchangerate" if $form->{forex};
 
@@ -604,7 +571,13 @@ sub update {
 
   $form->{update} = 1;
 
-  &check_name($form->{vc});
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
+
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+  }
 
   if (!$form->{forex}) {        # read exchangerate from input field (not hidden)
     map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate) unless $recursive_call;
@@ -774,9 +747,7 @@ sub search {
   }
 
   # setup vendor / customer data
-  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
   $form->get_lists("projects"     => { "key" => "ALL_PROJECTS", "all" => 1 },
-                   "$form->{vc}s" => "ALL_VC",
                    "taxzones"     => "ALL_TAXZONES",
                    "business_types" => "ALL_BUSINESS_TYPES",);
   $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
@@ -793,6 +764,8 @@ sub search {
 
   $form->{ORDER_PROBABILITIES} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
 
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(autocomplete_project));
+
   $form->header();
 
   print $form->parse_html_template('oe/search', {
@@ -1180,7 +1153,7 @@ sub save_and_close {
   $form->{$idx} =~ s/\s*$//g;
 
   my $msg = ucfirst $form->{vc};
-  $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
+  $form->isblank($form->{vc} . '_id', $locale->text($msg . " missing!"));
 
   # $locale->text('Customer missing!');
   # $locale->text('Vendor missing!');
@@ -1190,17 +1163,14 @@ sub save_and_close {
 
   &validate_items;
 
-  my $payment_id;
-  if($form->{payment_id}) {
-    $payment_id = $form->{payment_id};
-  }
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
 
-  # if the name changed get new values
-  if (&check_name($form->{vc})) {
-    if($form->{payment_id} eq "") {
-      $form->{payment_id} = $payment_id;
-    }
-    &update;
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+
+    update();
     $::dispatcher->end_request;
   }
 
@@ -1287,7 +1257,7 @@ sub save {
   $form->{$idx} =~ s/\s*$//g;
 
   my $msg = ucfirst $form->{vc};
-  $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
+  $form->isblank($form->{vc} . '_id', $locale->text($msg . " missing!"));
 
   # $locale->text('Customer missing!');
   # $locale->text('Vendor missing!');
@@ -1298,17 +1268,14 @@ sub save {
   remove_emptied_rows();
   &validate_items;
 
-  my $payment_id;
-  if($form->{payment_id}) {
-    $payment_id = $form->{payment_id};
-  }
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
 
-  # if the name changed get new values
-  if (&check_name($form->{vc})) {
-    if($form->{payment_id} eq "") {
-      $form->{payment_id} = $payment_id;
-    }
-    &update;
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+
+    update();
     $::dispatcher->end_request;
   }
 
@@ -1451,15 +1418,14 @@ sub invoice {
     $form->{quodate}      = $form->{transdate};
   }
 
-  my $payment_id;
-  if ($form->{payment_id}) {
-    $payment_id = $form->{payment_id};
-  }
+  my $vc = $form->{vc};
+  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
 
-  # if the name changed get new values
-  if (&check_name($form->{vc})) {
-    $form->{payment_id} = $payment_id if $form->{payment_id} eq "";
-    &update;
+    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
+
+    update();
     $::dispatcher->end_request;
   }
 
@@ -1525,8 +1491,6 @@ sub invoice {
 
   require "bin/mozilla/$form->{script}";
 
-  map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
-
   my $currency = $form->{currency};
   &invoice_links;
 
index 845b1be3d9fb13194e2eb1defa2e58507ec12a16..a4ba678e6948bc4a78ab74464c644240b2533258 100644 (file)
@@ -47,7 +47,6 @@ use SL::ReportGenerator;
 use Data::Dumper;
 use List::MoreUtils qw(any);
 
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
@@ -174,12 +173,7 @@ sub report {
 
     $nextsub = "generate_$::form->{report}";
 
-    # setup vc selection
-    $::form->all_vc(\%::myconfig, $::form->{vc}, $is_sales ? "AR" : "AP");
-    $vc .= "<option>$_->{name}--$_->{id}\n" for @{ $::form->{"all_$::form->{vc}"} };
-    $vc = ($vc)
-        ? qq|<select name=$::form->{vc} class="initial_focus"><option>\n$vc</select>|
-        : qq|<input name=$::form->{vc} size=35 class="initial_focus">|;
+    $vc = qq|<input name=$::form->{vc} size=35 class="initial_focus">|;
   }
 
   my ($selection, $paymentaccounts);
index c7a886feb4ea5ac6fdab22e9077abd793cda3690..ea05ab41b654286d4ef43aa736f928206b550476 100644 (file)
@@ -36,12 +36,12 @@ use POSIX qw(strftime);
 use List::Util qw(sum first);
 
 use SL::AM;
+use SL::DB::Employee;
 use SL::VK;
 use SL::IS;
 use SL::ReportGenerator;
 use Data::Dumper;
 
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
@@ -57,18 +57,17 @@ sub search_invoice {
 
   my ($customer);
 
-  # setup customer selection
-  $form->all_vc(\%myconfig, "customer", "AR");
+  $::request->layout->add_javascripts("autocomplete_project.js");
 
   $form->{title}    = $locale->text('Sales Report');
 
-  $form->get_lists("projects"        => { "key" => "ALL_PROJECTS", "all" => 1 },
-                   "departments"     => "ALL_DEPARTMENTS",
+  $form->get_lists("departments"     => "ALL_DEPARTMENTS",
                    "business_types"  => "ALL_BUSINESS_TYPES",
                    "salesmen"        => "ALL_SALESMEN",
-                   'employees'       => 'ALL_EMPLOYEES',
-                   'partsgroup'      => 'ALL_PARTSGROUPS',
-                   "customers"       => "ALL_VC");
+                   'partsgroup'      => 'ALL_PARTSGROUPS');
+
+  $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted;
+
   $form->{CUSTOM_VARIABLES_IC}                  = CVar->get_configs('module' => 'IC');
   ($form->{CUSTOM_VARIABLES_FILTER_CODE_IC},
    $form->{CUSTOM_VARIABLES_INCLUSION_CODE_IC}) = CVar->render_search_options('variables'      => $form->{CUSTOM_VARIABLES_IC},
@@ -80,10 +79,6 @@ sub search_invoice {
    $form->{CUSTOM_VARIABLES_INCLUSION_CODE_CT}) = CVar->render_search_options('variables'      => $form->{CUSTOM_VARIABLES_CT},
                                                                            'include_prefix' => 'l_',
                                                                            'include_value'  => 'Y');
-  $form->{vc_keys}   = sub { "$_[0]->{name}--$_[0]->{id}" };
-  $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} };
-  $form->{salesman_labels} = $form->{employee_labels};
-
   $form->header;
   print $form->parse_html_template('vk/search_invoice', { %myconfig });
 
index 09dbde82dc37ecd2a3969132e78312d23c26d2d8..35c2c735c22f9162495ae8fb52b6a9b50dd38b7b 100644 (file)
@@ -6616,8 +6616,7 @@ Beschreibung: &lt;%description%&gt;
             </listitem>
 
             <listitem>
-              <para>Enthält unter anderem Listenbegrenzung vclimit,
-              Datumsformat dateformat und Nummernformat numberformat</para>
+              <para>Enthält unter anderem Datumsformat dateformat und Nummernformat numberformat</para>
             </listitem>
 
             <listitem>
index 1ce2cc593b2262caf9e3e24431f36c513e6606c9..55b29c72ecb75eab043fabb994bf59bd89e701e2 100644 (file)
 }</pre></div><div class="sect3" title="4.1.3.2. %::myconfig"><div class="titlepage"><div><div><h4 class="title"><a name="d0e6540"></a>4.1.3.2. %::myconfig</h4></div></div></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Das einzige Hash unter den globalen Variablen</p></li><li class="listitem"><p>Wird spätestens benötigt wenn auf die Datenbank
               zugegriffen wird</p></li><li class="listitem"><p>Wird bei jedem Request neu erstellt.</p></li><li class="listitem"><p>Enthält die Userdaten des aktuellen Logins</p></li><li class="listitem"><p>Sollte nicht ohne Filterung irgendwo gedumpt werden oder
               extern serialisiert werden, weil da auch der Datenbankzugriff
-              für diesen user drinsteht.</p></li><li class="listitem"><p>Enthält unter anderem Listenbegrenzung vclimit,
-              Datumsformat dateformat und Nummernformat numberformat</p></li><li class="listitem"><p>Enthält Datenbankzugriffinformationen</p></li></ul></div><p>
+              für diesen user drinsteht.</p></li><li class="listitem"><p>Enthält unter anderem Datumsformat dateformat und Nummernformat numberformat</p></li><li class="listitem"><p>Enthält Datenbankzugriffinformationen</p></li></ul></div><p>
                   <code class="varname">%::myconfig</code> ist im Moment der Ersatz für
           ein Userobjekt. Die meisten Funktionen, die etwas anhand des
           aktuellen Users entscheiden müssen, befragen
index 19dd2e645c2168d23829a925cfe15abb5428d1f3..722eb2ae892b0dd2991e3cd6c58cc43021794efa 100755 (executable)
@@ -772,8 +772,6 @@ $self->{texts} = {
   'Customer deleted!'           => 'Kunde gelöscht!',
   'Customer details'            => 'Kundendetails',
   'Customer missing!'           => 'Kundenname fehlt!',
-  'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
-  'Customer not on file!'       => 'Kunde ist nicht in der Datenbank!',
   'Customer saved'              => 'Kunde gespeichert',
   'Customer saved!'             => 'Kunde gespeichert!',
   'Customer type'               => 'Kundentyp',
@@ -1009,7 +1007,6 @@ $self->{texts} = {
   'Draft suggestions'           => 'Entwurfsvorschläge',
   'Drafts'                      => 'Entwürfe',
   'Drawing'                     => 'Zeichnung',
-  'Dropdown Limit'              => 'Auswahllistenbegrenzung',
   'Due'                         => 'Fällig',
   'Due Date'                    => 'Fälligkeitsdatum',
   'Due Date missing!'           => 'Fälligkeitsdatum fehlt!',
@@ -1759,7 +1756,6 @@ $self->{texts} = {
   'Monat'                       => 'Monat',
   'Month'                       => 'Monat',
   'Monthly'                     => 'monatlich',
-  'More than one #1 found matching, please be more specific.' => 'Mehr als ein #1 wurde gefunden, bitte geben Sie den Namen genauer an.',
   'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
   'Multi mode not supported.'   => 'Multimodus wird nicht unterstützt.',
   'Multiple addresses can be entered separated by commas.' => 'Mehrere Adressen können durch Kommata getrennt angegeben werden.',
@@ -2516,8 +2512,6 @@ $self->{texts} = {
   'Select federal state...'     => 'Bundesland auswählen...',
   'Select file to upload'       => 'Datei zum Hochladen auswählen',
   'Select from one of the items below' => 'Wählen Sie einen der untenstehenden Einträge',
-  'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
-  'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
   'Select postscript or PDF!'   => 'Postscript oder PDF auswählen!',
   'Select tax office...'        => 'Finanzamt auswählen...',
   'Select template to paste'    => 'Einzufügende Vorlage auswählen',
@@ -3429,8 +3423,6 @@ $self->{texts} = {
   'Vendor details'              => 'Lieferantendetails',
   'Vendor filter for AP transaction drafts' => 'Filter für Entwürfe',
   'Vendor missing!'             => 'Lieferant fehlt!',
-  'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
-  'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
   'Vendor saved'                => 'Lieferant gespeichert',
   'Vendor saved!'               => 'Lieferant gespeichert!',
   'Vendor type'                 => 'Lieferantentyp',
index 5d311c18e93c8d8e2a4943733b12026c09991bbf..dc3d0176c4cc1a71a983a93d186416adf98fbc23 100755 (executable)
@@ -489,7 +489,6 @@ sub drop_and_create_test_database {
     signature                => '',
     hide_cvar_search_options => '',
     numberformat             => '1.000,00',
-    vclimit                  => 0,
     favorites                => '',
     copies                   => '',
     menustyle                => 'v3',
index 53b5ffe44bc8925bb9af0ebbb9ab72746a0413f5..e5031d1f9178e7d62d1fefd2edb49f2898b789ed 100755 (executable)
@@ -162,7 +162,6 @@ sub create_client_user_and_employee {
     signature                => '',
     hide_cvar_search_options => '',
     numberformat             => '1.000,00',
-    vclimit                  => 0,
     favorites                => '',
     copies                   => '',
     menustyle                => 'v3',
index 34a01a2dede8e5175b764e664cc1ed54c2e945a7..1a90d3f29adce7ab85f1a65c0ede3fcc7452a4b5 100644 (file)
       <td>[% L.select_tag("user.config_values.numberformat", SELF.all_numberformats, default=props.numberformat) %]</td>
      </tr>
 
-     <tr>
-      <th align="right">[% LxERP.t8("Dropdown Limit") %]</th>
-      <td>[% L.input_tag("user.config_values.vclimit", props.vclimit) %]</td>
-     </tr>
-
      <tr>
       <th align="right">[% LxERP.t8("Language") %]</th>
       <td>[% L.select_tag("user.config_values.countrycode", SELF.all_countrycodes, title_key="title", default=props.countrycode) %]</td>
index fa0d5081bbfb4b1cd0b6dffa47e1cf38435ed5fd..bfe849b035582128e0becd5e04aaebf25d10673b 100644 (file)
       </td>
      </tr>
 
-     <tr>
-      <th align="right">[% 'Dropdown Limit' | $T8 %]</th>
-      <td><input name="vclimit" size="10" value="[% HTML.escape(MYCONFIG.vclimit) %]"></td>
-     </tr>
-
      <tr>
       <th align="right">[% 'Language' | $T8 %]</th>
       <td>
index e2ff61555df6c40ada1daa0b1577835af32bb205..96b774418d9e65437bdc0cf1ef25e1ba137222d3 100644 (file)
@@ -16,7 +16,6 @@
      </select>
 
      [%- ELSIF var.type == 'date' %]
-     [% 'from (time)' | $T8 %]
      [% L.date_tag(filter_prefix _'cvar_'_ HTML.escape(var.name) _'_from') %]
 
      [% 'to (time)' | $T8 %]
index 9623a712b1ef344be89128c1a6a3979e4c846859..889080b02dda2921bb4ebeb4bde67bceb8cb362d 100644 (file)
@@ -5,11 +5,6 @@
 
 <form method="post" action="[% script | html %]">
 
-<input type="hidden" name="selectvendor" value="[% selectvendor | html %]">
-<input type="hidden" name="selectcurrency" value="[% selectcurrency | html %]">
-
-<input type="hidden" name="oldvendor" value="[% oldvendor | html %]">
-<input type="hidden" name="vendor_id" value="[% vendor_id | html %]">
 <input type="hidden" name="terms" value="[% terms | html %]">
 
 <input type="hidden" name="creditlimit" value="[% creditlimit | html %]">
               <tr>
                 <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
                 <td colspan="3">
-                  [% IF ( selectvendor ) %]
-                    <select name="vendor" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>[% selectvendor %]</select>
-                  [% ELSE %]
-                    <input name=vendor value="[% vendor | html %]" size="35"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>
-                  [% END %]
-                  <input type="button" value="D" onclick="show_vc_details('vendor')">
+                 [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 300px") %]
+                 [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
+                 [% L.hidden_tag("previous_vendor_id", vendor_id) %]
                 </td>
               </tr>
 
 
               <tr>
                 <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
-                <td><select name="currency">[% selectcurrency %]</select></td>
+                <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
 
                 [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
                   <th align=right>[% 'Exchangerate' | $T8 %]</th>
index 67d2b826024fa581e0e2b5566fc8014e9efe09c6..d7dfbf3e28fc2e0747cac44afaea1775485b2f67 100644 (file)
@@ -1,5 +1,6 @@
 [%- USE T8 %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
+[% SET style="width: 250px" %]
 <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>[% L.input_tag("vendor", vendor, style=style, class="initial_focus") %]</td>
      </tr>
     <tr>
      <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
-     <td colspan="3">[% L.input_tag("cp_name", '', size=20) %]</td>
+     <td>[% L.input_tag("cp_name", '', style=style) %]</td>
     </tr>
      <tr>
       <th align=right nowrap>[% 'Department' | $T8 %]</th>
-      <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style="width: 200px") %]</td>
+      <td>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Invoice Number' | $T8 %]</th>
-      <td colspan=3><input name=invnumber size=20></td>
+      <td>[% L.input_tag("invnumber", "", style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Order Number' | $T8 %]</th>
-      <td colspan=3><input name=ordnumber size=20></td>
+      <td>[% L.input_tag("ordnumber", "", style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Notes' | $T8 %]</th>
-      <td><input name=notes size=20></td>
+      <td>[% L.input_tag("notes", "", style=style) %]</td>
       <th align="right">[% 'Part Description' | $T8 %]</th>
-      <td><input name="parts_description" size="20"></td>
+      <td>[% L.input_tag("parts_description", "", style=style) %]</td>
      </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>[% P.project_picker("project_id", project_id, style=style) %]</td>
       <th align="right">[% 'Part Number' | $T8 %]</th>
-      <td><input name="parts_partnumber" size="20"></td>
+      <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
      </tr>
      <tr>
-      <th align=right nowrap>[% 'From' | $T8 %]</th>
+      <th align=right nowrap>[% 'Invoice Date' | $T8 %]</th>
       <td>
        [% L.date_tag('transdatefrom') %]
-      </td>
-     <th align=right>[% 'Bis' | $T8 %]</th>
-     <td>
-      [% L.date_tag('transdateto') %]
+       [% 'Bis' | $T8 %]
+       [% L.date_tag('transdateto') %]
      </td>
     </tr>
    <input type=hidden name=sort value=transdate>
index 258a40a57452b0daed19e172c00e772dc6f12249..bb943964b688cc53c323c8222e2c13c54045ad60 100644 (file)
               <tr>
                 <th align="right" nowrap>[% 'Customer' | $T8 %]</th>
                 <td colspan=3>
-[%- IF selectcustomer %]
-    <select id='customer' name="customer" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'customer'%] class="initial_focus"[% END %]>[% selectcustomer %]</select>
-[%- ELSE %]
-    <input id='customer' name=customer value="[% customer | html %]" size=35[% IF initial_focus == 'customer'%] class="initial_focus"[% END %]>
-[%- END %]
-                <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('customer')"></td>
-                [% L.hidden_tag('selectcustomer', selectcustomer) %]
-                [% L.hidden_tag('oldcustomer', oldcustomer) %]
-                [% L.hidden_tag('customer_id', customer_id) %]
-                [% L.hidden_tag('terms', terms) %]
+                 [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : "")) %]
+                 [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
+                 [% L.hidden_tag("previous_customer_id", customer_id) %]
+                 [% L.hidden_tag('terms', terms) %]
+               </td>
               </tr>
 [%- IF max_dunning_level || invoice_obj.dunning_config_id  %]
               <tr>
@@ -92,8 +87,7 @@
 [%- END %]
               <tr>
                 <th align=right>[% 'Currency' | $T8 %]</th>
-                <td><select name=currency>[% selectcurrency %]</select></td>
-                [% L.hidden_tag('selectcurrency', selectcurrency) %]
+                <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
                 [% L.hidden_tag('defaultcurrency', defaultcurrency) %]
                 [% L.hidden_tag('fxgain_accno', fxgain_accno) %]
                 [% L.hidden_tag('fxloss_accno', fxloss_accno) %]
           </td>
           <td align=right>
             <table>
-[%- IF selectemployee %]
               <tr>
                 <th align=right nowrap>[% 'Salesperson' | $T8 %]</th>
-                <td  colspan=2><select name=employee>[% selectemployee %]</select>[% L.hidden_tag('selectemployee', selectemployee) %]</td>
+                <td  colspan=2>[% P.select_tag("employee_id", employees, default=employee_id, title_key='safe_name') %]</td>
               </tr>
-[%- ELSE %]
-                [% L.hidden_tag('employee', employee) %]
-[%- END %]
               <tr>
                 <th align=right nowrap>[% 'Invoice Number' | $T8 %]</th>
                 <td><input name=invnumber size=11 value="[% invnumber | html %]"></td>
index fffbd9c211603fe756a912cbf966e761712342a9..d3e606bb11868808fa5873d9b00c9f51f0fe22a9 100644 (file)
@@ -1,5 +1,6 @@
 [%- USE T8 %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
+[%- SET style="width: 250px" %]
 <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>[% L.input_tag("customer", customer, style=style, class="initial_focus") %]</td>
      </tr>
     <tr>
      <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
-     <td colspan="3">[% L.input_tag("cp_name", '', size=20) %]</td>
+     <td>[% L.input_tag("cp_name", '', style=style) %]</td>
     </tr>
      <tr>
       <th align=right nowrap>[% 'Department' | $T8 %]</th>
-      <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style="width: 200px") %]</td>
+      <td>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Invoice Number' | $T8 %]</th>
-      <td colspan=3><input name=invnumber id=invnumber size=20></td>
+      <td>[% L.input_tag("invnumber", "", style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Order Number' | $T8 %]</th>
-      <td colspan=3><input name=ordnumber id=ordnumber size=20></td>
+      <td>[% L.input_tag("ordnumber", "", style=style) %]</td>
      </tr>
      <tr>
       <th align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
-      <td colspan=3><input name="cusordnumber" id="cusordnumber" size="20"></td>
+      <td>[% L.input_tag("cusordnumber", "", style=style) %]</td>
      </tr>
      <tr>
       <th align="right">[% 'Employee' | $T8 %]</th>
-      <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
+      <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style=style) %]</td>
      </tr>
     <tr>
      <th align="right">[% 'Salesman' | $T8 %]</th>
-     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
+     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Transaction description' | $T8 %]</th>
-      <td><input name=transaction_description id=transaction_description size=20></td>
+      <td>[% L.input_tag("transaction_description", "", style=style) %]</td>
       <th align="right">[% 'Part Description' | $T8 %]</th>
-      <td><input name="parts_description" size="20"></td>
+      <td>[% L.input_tag("parts_description", "", style=style) %]</td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Notes' | $T8 %]</th>
-      <td><input name=notes id=notes size=20></td>
+      <td>[% L.input_tag("notes", "", style=style) %]</td>
       <th align="right">[% 'Part Number' | $T8 %]</th>
-      <td><input name="parts_partnumber" size="20"></td>
+      <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
      </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>[% P.project_picker("project_id", project_id, style=style) %]</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>[% L.select_tag("business_id", ALL_BUSINESS_TYPES, with_empty=1, title_key="description", style=style) %]</td>
      </tr>
     [% END %]
      <tr>
       <th align=right nowrap>[% 'Invoice Date' | $T8 %]</th>
       <td>
-       [% 'From' | $T8 %]
        [% L.date_tag('transdatefrom') %]
-      </td>
-     <th align=right>[% 'Bis' | $T8 %]</th>
-     <td>
-      [% L.date_tag('transdateto') %]
+       [% 'Bis' | $T8 %]
+       [% L.date_tag('transdateto') %]
      </td>
     </tr>
      <tr>
       <th align=right nowrap>[% 'Due Date' | $T8 %]</th>
       <td>
-       [% 'From' | $T8 %]
        [% L.date_tag('duedatefrom') %]
-      </td>
-     <th align=right>[% 'Bis' | $T8 %]</th>
-     <td>
-      [% L.date_tag('duedateto') %]
+       [% 'Bis' | $T8 %]
+       [% L.date_tag('duedateto') %]
      </td>
     </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>
diff --git a/templates/webpages/arap/select_project.html b/templates/webpages/arap/select_project.html
deleted file mode 100644 (file)
index ffd0b86..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-[%- USE HTML %]
-[%- USE T8 %]
-[%- USE L  %]
-[%- USE LxERP %]
-
-<h1>[% 'Select from one of the projects below' | $T8 %]</h1>
-
-<form method=post action="[% script %]">
-
-<table width=100%>
- <tr class=listheading>
-  <th>&nbsp;</th>
-  <th>[% 'Number' | $T8 %]</th>
-  <th>[% 'Description' | $T8 %]</th>
- </tr>
-[%- FOREACH row IN project_list %]
- <tr class=listrow[% loop.count % 2 %]>
-  <td>[% L.radio_button_tag('ndx', value=loop.count, checked=loop.first) %]</td>
-  <td>[% row.projectnumber | html %]</td>
-  <td>[% row.description | html %]</td>
-  [% L.hidden_tag('new_id_' _ loop.count, row.id) %]
-  [% L.hidden_tag('new_projectnumber_' _ loop.count, row.projectnumber) %]
- </tr>
-[%- END %]
-</table>
-
-<hr size=3 noshade>
-
-[% L.hidden_tag(row.key, row.value) FOREACH row = hiddens %]
-[% L.hidden_tag('lastndx', project_list.size) %]
-[% L.hidden_tag('nextsub', 'project_selected') %]
-[% L.hidden_tag('rownumber', rownumber) %]
-[% L.submit_tag('action', LxERP.t8('Continue')) %]
-
-</form>
-
index a1806cba252d6f58057987903502779acefab62a..818f01f287003b92a283b4cb9d7e3ffb9393551a 100644 (file)
@@ -1,4 +1,4 @@
-[%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE T8 %]
+[%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE T8 %][%- USE P -%]
 
   <b>Transaction</b>
   <table>
   <table>
    <tr>
     <th align="right">[%- LxERP.t8("Vendor") %]</th>
-    <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name          = 'vendor',
-                 select_name   = 'vendor_id',
-                 default       = ALL_VENDORS.size < limit ? vendor_id : vendor_name,
-                 style         = 'width: 250px',
-                 DATA          = ALL_VENDORS,
-                 id_key        = 'id',
-                 label_key     = 'name',
-                 limit         = limit,
-                 show_empty    = 1,
-                 allow_textbox = 1,
-                 class         = 'initial_focus',
-                 onChange      = 'filter_drafts();',
-                 -%]
-    </td>
+    <td>[% P.input_tag("vendor", vendor_name, class="initial_focus", style="width: 250px") %]</td>
    </tr>
   </table>
 </form>
@@ -98,4 +83,3 @@ function filter_drafts() {
 }
 //-->
 </script>
-
index 6fd976762552908126c04e6d9114ad922fa23e7f..6baf327659f53980cfc7f5f93519eafc7e83431c 100644 (file)
@@ -9,22 +9,7 @@
 <table>
   <tr>
     <th align=right>[% 'Customer' | $T8 %]</th>
-    <td colspan=3>
-  [%- IF vc == 'customer' ? all_customer.size : all_vendor.size %]
-      [%- INCLUDE 'generic/multibox.html'
-           name          = vc,
-           DATA          = vc == 'customer' ? all_customer : all_vendor,
-           id_sub        = 'vc_keys',
-           label_sub     = 'vc_keys',
-           select        = vc_select,
-           limit         = vclimit,
-           show_empty    = 1,
-           allow_textbox = 1,
-      -%]
-  [%- ELSE %]
-    [% L.input_tag(vc, '', size=35) %]
-  [%- END %]
-</td>
+    <td colspan=3>[% L.input_tag(vc, '', size=35) %]</td>
   </tr>
 [% IF show_accounts %]
   <tr>
@@ -81,5 +66,3 @@
 [% L.submit_tag('action', LxERP.t8('Continue')) %]
 
 </form>
-
-
index 7b87c2fc9115728d81c637a6171e9de52857921b..4b519b8b0f4d21bb9553f985327167041a95f559 100644 (file)
@@ -1,9 +1,11 @@
 [%- USE L %]
 [%- USE HTML %]
 [%- USE T8 %]
-[%- USE LxERP %]
+[%- USE LxERP %][%- USE P -%]
 <form method=post action=cp.pl>
 
+[% SET vc_id = vc _ '_id'
+       style = "width: 250px" %]
 [% L.hidden_tag('defaultcurrency', defaultcurrency) %]
 [% L.hidden_tag('closedto', closedto) %]
 [% L.hidden_tag('vc', vc) %]
 
 <h1>[% is_receipt ? LxERP.t8('Receipt') : LxERP.t8('Payment') %]</h1>
 
-<table width=100%>
+<table>
   <tr valign=top>
     <td>
       <table>
         <tr>
           <th align=right>[% is_customer ? LxERP.t8('Customer') : LxERP.t8('Vendor') %]</th>
-          <td>[% vccontent %]</td>
-         [% IF vc == 'customer' %]
-           [% L.hidden_tag('selectcustomer', selectcustomer) %]
-           [% L.hidden_tag('customer_id', customer_id) %]
-           [% L.hidden_tag('oldcustomer', oldcustomer) %]
-          [% ELSE %]
-           [% L.hidden_tag('selectvendor', selectvendor) %]
-           [% L.hidden_tag('vendor_id', vendor_id) %]
-           [% L.hidden_tag('oldvendor', oldvendor) %]
-          [% END %]
-        </tr>
-        [% IF vc == 'customer' %]
-        <tr>
-          <th align=right>[% 'Customer Number' | $T8 %]</th>
-          <td><input name="customernumber" size="35"></td>
+          <td>
+           [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="initial_focus", style=style) %]
+           [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
+          </td>
         </tr>
-        [% END %]
         <tr>
           <th align=right>[% 'Invoice Number' | $T8 %]</th>
           <td><input name="invnumber" size="35"></td>
index 277181e4fa8a4d3f14db32ddabdf24bd5b447919..326db490a8ca1122bf35bd2a2335c0b909b39faf 100644 (file)
@@ -1,15 +1,13 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
 <h1>[% title %]</h1>
 
  <script type="text/javascript" src="js/show_form_details.js"></script>
  <script type="text/javascript" src="js/show_history.js"></script>
  <script type="text/javascript" src="js/show_vc_details.js"></script>
- <script type="text/javascript" src="js/common.js"></script>
  <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
- <script type="text/javascript" src="js/vendor_selection.js"></script>
  <script type="text/javascript" src="js/calculate_qty.js"></script>
  <script type="text/javascript" src="js/stock_in_out.js"></script>
  <script type="text/javascript" src="js/follow_up.js"></script>
  </style>
 
  [%- IF vc == 'customer' %]
- [%- SET vc = 'customer' %]
- [%- SET the_vc_id = customer_id %]
- [%- SET the_vc = customer %]
- [%- SET the_oldvc = oldcustomer %]
  [%- SET is_customer = '1' %]
  [%- ELSE %]
  [%- SET vc = 'vendor' %]
- [%- SET the_vc_id = vendor_id %]
- [%- SET the_vc = vendor %]
- [%- SET the_oldvc = oldvendor %]
  [%- SET is_customer = '0' %]
  [%- END %]
+ [%- SET vc_id = vc _ "_id" %]
  [%- IF delivered %]
  [%- SET DISABLED = ' disabled' %]
  [%- END %]
      <td>
       <table width="100%">
        <tr>
-        <input type="hidden" name="[% vc %]_id" value="[% HTML.escape(the_vc_id) %]">
-        <input type="hidden" name="old[% vc %]" value="[% HTML.escape(the_oldvc) %]">
-        <input type="hidden" name="tradediscount" value="[% HTML.escape(tradediscount) %]">
         <th align="right">[% IF is_customer %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
         <td>
-         [%- UNLESS !delivered && SHOW_VC_DROP_DOWN %]
-         <input type="text" value="[% HTML.escape(oldvcname) %]" name="[% HTML.escape(vc) %]"[% RO %]>
-         [%- ELSE %]
-         <select name="[% vc %]" class="fixed_width" onchange="document.do.update_button.click();"[% RO %]>
-          [%- FOREACH row = ALL_VC %]
-          <option value="[% HTML.escape(row.value) %]" [% IF the_oldvc == row.value %] selected[% END %]>[% HTML.escape(row.name) %]</option>
-          [%- END %]
-         </select>
-         <input type="hidden" name="select[% vc %]" value="1">
-         [%- END %]
-         <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% vc %]')">
+         [% IF RO %]
+          [% P.hidden_tag(vc_id, $vc_id) %]
+          [% HTML.escape(VC_OBJ.name) %]
+         [% ELSE %]
+          [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="fixed_width") %]
+         [% END %]
+         [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
+         [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %]
         </td>
 
         [%- IF ALL_CONTACTS.size %]
index 0e723c27a4243f21e98c702846f5cb96beb1d489..e46a942ce0e94fc83ae53ec3e0e11fd504f71a3e 100644 (file)
@@ -1,6 +1,6 @@
 [%- USE T8 %]
 [%- USE L %]
-[%- USE HTML %][%- USE LxERP %]
+[%- USE HTML %][%- USE LxERP %][%- USE P -%]
 <h1>[% title %]</h1>
 
  [%- IF vc == 'customer' %]
    <table>
     <tr>
      <th align="right">[% IF is_customer %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
-     <td colspan="3">
-      [%- UNLESS SHOW_VC_DROP_DOWN %]
-      <input type="text" name="[% HTML.escape(vc) %]" class="fixed_width initial_focus">
-      [%- ELSE %]
-      <select name="[% vc %]" class="fixed_width initial_focus">
-       <option></option>
-       [%- FOREACH row = ALL_VC %]
-       <option>[% HTML.escape(row.name) %]--[% HTML.escape(row.id) %]</option>
-       [%- END %]
-      </select>
-      <input type="hidden" name="select[% vc %]" value="1">
-      [%- END %]
-     </td>
+     <td colspan="3">[% P.input_tag(vc, "", class="fixed_width initial_focus") %]</td>
     </tr>
 
     <tr>
@@ -81,7 +69,7 @@
      <th align="right">[% 'Transaction description' | $T8 %]</th>
      <td><input name="transaction_description" class="fixed_width"></td>
      <th align="right">[% 'Part Description' | $T8 %]</th>
-     <td><input name="parts_description" size="20"></td>
+     <td><input name="parts_description" size="20" class="fixed_width"></td>
     </tr>
 
     <tr>
@@ -95,7 +83,7 @@
       </select>
      </td>
      <th align="right">[% 'Part Number' | $T8 %]</th>
-     <td><input name="parts_partnumber" size="20"></td>
+     <td><input name="parts_partnumber" size="20", class="fixed_width"></td>
     </tr>
 
     <tr>
      <th align="right">[% 'Delivery Order Date' | $T8 %] [% 'From' | $T8 %]</th>
      <td>
       [% L.date_tag('transdatefrom') %]
-     </td>
-     <th align="right">[% 'Bis' | $T8 %]</th>
-     <td>
+      [% 'Bis' | $T8 %]
       [% L.date_tag('transdateto') %]
      </td>
     </tr>
      <th align="right">[% 'Reqdate' | $T8 %] [% 'From' | $T8 %]</th>
      <td>
       [% L.date_tag('reqdatefrom') %]
-     </td>
-     <th align="right">[% 'Bis' | $T8 %]</th>
-     <td>
+      [% 'Bis' | $T8 %]
       [% L.date_tag('reqdateto') %]
      </td>
     </tr>
      <th align="right">[% 'Insert Date' | $T8 %] [% 'From' | $T8 %]</th>
      <td>
        [% L.date_tag('insertdatefrom') %]
-     </td>
-     <th align="right">[% 'Bis' | $T8 %]</th>
-     <td>
+       [% 'Bis' | $T8 %]
        [% L.date_tag('insertdateto') %]
      </td>
     </tr>
index 4173a51afda62c21748b71cf967ef9ed9dca050a..d4a18df5405c7b517dda2d0dc595fbc7a747854d 100644 (file)
@@ -8,14 +8,7 @@
    <tr>
     <th align="right">[% 'Customer' | $T8 %]</th>
     <td colspan="3">
-     [% IF SHOW_CUSTOMER_SELECTION %]
-      <select name="customer" class="initial_focus">
-       <option></option>
-       [% FOREACH row = all_customer %]<option>[% HTML.escape(row.name) %]--[% HTML.escape(row.id) %]</option>[% END %]
-      </select>
-      [% ELSE %]
       <input name="customer" size="35" class="initial_focus">
-     [% END %]
     </td>
    </tr>
 
     </tr>
    [% END %]
 
-   [% IF SHOW_DEPARTMENT_SELECTION %]
-    <tr>
-     <th align="right">[% 'Department' | $T8 %]</th>
-     <td colspan="3">
-      <select name="department">
-       <option></option>
-       [% FOREACH row = all_departments %]<option>[% HTML.escape(row.description) %]--[% HTML.escape(row.id) %]</option>[% END %]
-      </select>
-     </td>
-    </tr>
-   [% END %]
-
    <tr>
     <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
     <td colspan="3"><input name="invnumber" size="20"></td>
index 83b59c6b3e268a4dd9046664fbbd4855af906256..c70809493cbe6c41a39d89b15915bd11306d1bdb 100644 (file)
@@ -1,6 +1,6 @@
 [%- USE T8 %]
 [%- USE HTML %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
 <h1>[% title %]</h1>
 
 [% PROCESS 'common/flash.html' %]
      <table>
       <tr>
        <th align="right">[% 'Customer' | $T8 %]</th>
-       <td colspan="3">
-        [% IF SHOW_CUSTOMER_DDBOX %]
-         <select id='customer' name="customer_id" class="initial_focus">
-          <option value=""></option>
-          [% FOREACH row = ALL_CUSTOMERS %]<option value="[% HTML.escape(row.id) %]">[% HTML.escape(row.name) %]</option>
-          [% END %]
-         </select>
-         [% ELSE %]
-         <input id='customer' name="customer" size="35" class="initial_focus">
-        [% END %]
-       </td>
+       <td colspan="3">[% P.input_tag("customer", "", size="35", class="initial_focus") %]</td>
       </tr>
 
       [% IF SHOW_DUNNING_LEVELS %]
@@ -39,7 +29,7 @@
        </tr>
       [% END %]
 
-      [% IF SHOW_DEPARTMENT_DDBOX %]
+      [% IF ALL_DEPARTMENTS.as_list.size %]
        <tr>
         <th align="right" nowrap>[% 'Department' | $T8 %]</th>
         <td colspan="3">
diff --git a/templates/webpages/generic/multibox.html b/templates/webpages/generic/multibox.html
deleted file mode 100644 (file)
index bf39fe8..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-[%- USE HTML %]
-[%#-
-     Multibox
-
-  This template makes an input box for you,
-  decides whether it should be a text field or a drop down box,
-  generates the HTML code, and fixes everything just right.
-
-  call:  PROCESS generic/multibox.html var = var, var2 = ....
-
-  options and variables:
-    name          : name of the select/textfield
-    id            : id of the select/textfield, optional, defaults to name
-    default       : entered/selected value. defaults to a dereference of name, since it is usually set to that for update mechanisms
-    id_key        : key that holds the id in each row.
-    id_sub        : name of a perl sub that calculates the id for each row. will be called with a hashref.
-    label_key     : key that holds the label in each row.
-    label_sub     : name of a perl sub that calculates the label for each row. will be called with a hashref.
-    DATA          : the actual data, expected to be arrayref of hashrefs, usually what's returned by the all_vc routines.
-    show_empty    : show an empty first line in select boxes. defaults to false
-    style         : additional style information
-    onChange      : java magic on change
-    select        : java function call for a selection popup or other magic
-    allow_textbox : allow to display a textbox instead of a drop down box if there are more entries than 'limit' entries.
-    limit         : defines the limit of entries, after which a textbox is generated. defaults to vclimit, or, failing to find that, 200.
-    select_name   : if a select is displayed, use a different name. ex.: department for textinput, but department_id for selects
-    readonly      : softly prevents modification
-    class         : CSS class names (optional)
--%]
-[%-
-  Multibox__limit      = limit   != '' ? limit   : vclimit != '' ? vclimit : 200
-  Multibox__show_text  = allow_textbox and DATA.size and Multibox__limit < DATA.size ? 1 : 0
-  Multibox__id         = id      != '' && id * 1 != id ? id      : name
-  Multibox__default    = default != '' ? default : $name
-  Multibox__name       = (select_name != '' and ! Multibox__show_text) ? select_name : name
--%]
-[%- IF Multibox__show_text %]
-<input type="text"
- [%- IF Multibox__name     %] name="[%  Multibox__name    | html %]"[% END -%]
- [%- IF Multibox__id       %] id="[%    Multibox__id      | html %]"[% END -%]
- [%- IF Multibox__default  %] value="[% Multibox__default | html %]"[% END -%]
- [%- IF style              %] style="[% style             | html %]"[% END -%]
- [%- IF class              %] class="[% class             | html %]"[% END -%]
- [%- IF readonly           %] readonly[% END -%]
-[%- -%]>
-[%- IF select -%]
-  <input type="button" onclick="[% select %]" value="?">
-[%- END -%]
-[%- ELSE %]
-<select
- [%- IF Multibox__name     %] name="[%     Multibox__name     | html %]"[% END -%]
- [%- IF Multibox__id       %] id="[%       Multibox__id       | html %]"[% END -%]
- [%- IF style              %] style="[%    style              | html %]"[% END -%]
- [%- IF class              %] class="[%     class             | html %]"[% END -%]
- [%- IF onChange           %] onChange="[% onChange           | html %]"[% END -%]
- [%- IF readonly           %] disabled[% END -%]
-[%- -%]>
-  [%- IF show_empty %]
-  <option value=""></option>
-  [%- END %]
-  [%- FOREACH row = DATA %]
-  [%-
-      Multibox__row_id       = row.$id_key     != ''  ? row.$id_key    : $id_sub(row)
-      Multibox__row_label    = row.$label_key  != ''  ? row.$label_key
-                             : $label_sub(row) != ''  ? $label_sub(row)
-                             :                          Multibox__row_id
-      Multibox__row_selected = Multibox__default == Multibox__row_id
-  %]
-  <option value="[% Multibox__row_id | html %]"[% IF Multibox__row_selected %] selected[% END %]>[% Multibox__row_label | html %]</option>
-  [%- END %]
-</select>
-[%- END %]
index c9fd837a85048b58d9641555c2e245e7b9cf19b1..0be5ac006cce875dadfc9c800210365c45f87382 100644 (file)
@@ -3,6 +3,7 @@
 [%- USE LxERP %]
 [%- USE L %]
 [%- USE P %]
+[% SET style="width: 250px" %]
 <h1>[% title %]</h1>
 
  <form method="post" action="ic.pl">
       </tr>
       <tr>
        <th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
-       <td><input name="partnumber" size="20"></td>
+       <td>[% L.input_tag("partnumber", "", style=style) %]</td>
        <th align="right" nowrap>[% 'EAN' | $T8 %]</th>
-       <td><input name="ean" size="20"></td>
+       <td>[% L.input_tag("ean", "", style=style) %]</td>
       </tr>
       <tr>
        <th align="right" nowrap>[% 'Part Classification' | $T8 %]:</th>
-       <td>[% P.select_classification('classification_id') %]</td>
+       <td>[% P.select_classification('classification_id', style=style) %]</td>
       </tr>
       <tr>
        <th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
-       <td colspan="3"><input name="description" size="40" class="initial_focus"></td>
+       <td colspan="3">[% L.input_tag("description", "", style=style, class="initial_focus") %]</td>
       </tr>
       <tr>
        <th align="right" nowrap>[% 'Partsgroup' | $T8 %]</th>
-       <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         = MYCONFIG.vclimit,
-           allow_textbox = 1
-         -%]
-       </td>
-       <th align="right" nowrap>[% 'Serial Number' | $T8 %]</th> <td><input name="serialnumber" size="20"></td>
+       <td>[% P.select_tag("partsgroup_id", ALL_PARTSGROUPS, with_empty=1, default=partsgroup, title_key="partsgroup", style=style) %]</td>
+       <th align="right" nowrap>[% 'Serial Number' | $T8 %]</th>
+       <td>[% L.input_tag("serialnumber", "", style=style) %]</td>
       </tr>
 
-      [%- UNLESS is_service %]
       <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>
+       <th align="right" nowrap>[% 'Make' | $T8 %]</th>
+       <td>[% L.input_tag("make", "", style=style) %]</td>
+       <th align="right" nowrap>[% 'Model' | $T8 %]</th>
+       <td>[% L.input_tag("model", "", style=style) %]</td>
       </tr>
-      [%- END %]
 
       <tr>
        <th align="right" nowrap>[% 'Drawing' | $T8 %]</th>
-       <td><input name="drawing" size="20"></td>
+       <td>[% L.input_tag("drawing", "", style=style) %]</td>
        <th align="right" nowrap>[% 'Microfiche' | $T8 %]</th>
-       <td><input name="microfiche" size="20"></td>
+       <td>[% L.input_tag("microfiche", "", style=style) %]</td>
       </tr>
 
       <tr>
        <th align="right" nowrap>[% 'Shop article' | $T8 %]</th>
-       <td>[% L.yes_no_tag('shop', shop, default='', with_empty=1, empty_title='---') %]</td>
+       <td>[% L.yes_no_tag('shop', shop, default='', with_empty=1, empty_title='---', style=style) %]</td>
       </tr>
 
       <tr>
        <th align="right">[% 'Insert Date' | $T8 %]</th>
        <td>
-        [% 'From' | $T8 %][% L.date_tag('insertdatefrom') %]
-        [% 'Bis' | $T8 %] [% L.date_tag('insertdateto') %]
+        [% L.date_tag('insertdatefrom') %]
+        [% 'Bis' | $T8 %]
+        [% L.date_tag('insertdateto') %]
        </td>
       </tr>
 
       [% CUSTOM_VARIABLES_FILTER_CODE %]
 
-      [%- IF is_assembly %]
       <tr>
        <td></td>
        <td colspan="3">
         [% L.radio_button_tag('bom', id='bom_1', value=1,            label=LxERP.t8('Individual Items')) %]
        </td>
       </tr>
-      [%- END %]
 
       <tr>
        <td></td>
        <td colspan="3">
         [%- L.radio_button_tag('itemstatus', value='active', id='itemstatus_active', label=LxERP.t8('Active'), checked=1) %]
-      [%- UNLESS is_service %]
         [%- L.radio_button_tag('itemstatus', value='onhand', id='itemstatus_onhand', label=LxERP.t8('On Hand')) %]
         [%- L.radio_button_tag('itemstatus', value='short', id='itemstatus_short', label=LxERP.t8('Short')) %]
         [%- L.radio_button_tag('itemstatus', value='obsolete', id='itemstatus_obsolete', label=LxERP.t8('Obsolete')) %]
-      [%- END %]
         [%- L.radio_button_tag('itemstatus', value='orphaned', id='itemstatus_orphaned', label=LxERP.t8('Orphaned')) %]
         [%- L.radio_button_tag('itemstatus', value='', id='itemstatus_all', label=LxERP.t8('All')) %]
        </td>
           <td>
            <table>
             <tr>
-             [%- UNLESS is_assembly %]
              <td>[%- L.checkbox_tag('bought', label=LxERP.t8('Bought')) %]</td>
-             [%- END %]
              <td>[%- L.checkbox_tag('sold', label=LxERP.t8('Sold')) %]</td>
             </tr>
 
             </tr>
 
             <tr>
-             [%- UNLESS is_assembly %]
              <td>[%- L.checkbox_tag('onorder', label=LxERP.t8('On Order')) %]</td>
-             [%- END %]
              <td>[%- L.checkbox_tag('ordered', label=LxERP.t8('Ordered')) %]</td>
             </tr>
 
             </tr>
 
             <tr>
-             [%- UNLESS is_assembly %]
              <td>[%- L.checkbox_tag('rfq', label=LxERP.t8('RFQ')) %]</td>
-             [%- END %]
              <td>[%- L.checkbox_tag('quoted', label=LxERP.t8('Quoted')) %]</td>
             </tr>
            </table>
          <tr>
           <td>[%- L.checkbox_tag('l_partnumber', label=LxERP.t8('Part Number'), checked=1, value='Y') %]</td>
           <td>[%- L.checkbox_tag('l_description', label=LxERP.t8('Part Description'), checked=1, value='Y') %]</td>
-      [%- UNLESS is_service %]
           <td>[%- L.checkbox_tag('l_serialnumber', label=LxERP.t8('Serial Number'), value='Y') %]</td>
-      [%- END %]
           <td>[%- L.checkbox_tag('l_unit', label=LxERP.t8('Unit of measure'), value='Y', checked=1) %]</td>
          </tr>
 
          <tr>
           <td>[%- L.checkbox_tag('l_priceupdate', label=LxERP.t8('Updated'), value='Y') %]</td>
           <td>[%- L.checkbox_tag('l_deliverydate', label=LxERP.t8('Delivery Date'), value='Y') %]</td>
-      [%- UNLESS is_service %]
           <td>[%- L.checkbox_tag('l_rop', label=LxERP.t8('ROP'), value='Y') %]</td>
           <td>[%- L.checkbox_tag('l_weight', label=LxERP.t8('Weight'), value='Y') %]</td>
-      [%- END %]
          </tr>
 
          <tr>
          </tr>
 
          <tr>
-      [%- UNLESS is_service %]
           <td>[%- L.checkbox_tag('l_onhand', label=LxERP.t8('Stocked Qty'), value='Y') %]</td>
-      [%- END %]
           <td>[%- L.checkbox_tag('l_projectnumber', label=LxERP.t8('Project Number'), value='Y') %]</td>
           <td>[%- L.checkbox_tag('l_projectdescription', label=LxERP.t8('Project Description'), value='Y') %]</td>
           <td>[%- L.checkbox_tag('l_pricegroups', label=LxERP.t8('Pricegroups'), value='Y', checked=1) %]</td>
index 75ffde5d4a4c062d3a5a3cb6b815c377a7450438..f81b2cca7bd9203269dddc0df441140490bef8ec 100644 (file)
@@ -1,15 +1,13 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
 <h1>[% title %]</h1>
 
-[%- SET follow_up_trans_info = invnumber _ ' (' _ vendor_name _ ')' %]
+[%- SET follow_up_trans_info = invnumber _ ' (' _ vendor_obj.name _ ')' %]
 <script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/vendor_selection.js"></script>
 <script type="text/javascript" src="js/calculate_qty.js"></script>
 <script type="text/javascript" src="js/follow_up.js"></script>
-<script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
 
 <form method="post" name="invoice" action="[% script %]">
 
         <tr>
           <th align="right">[% 'Vendor' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 id            = 'vendor',
-                 name          = 'vendor',
-                 style         = 'width: 250px',
-                 class         = 'initial_focus',
-                 DATA          = ALL_VENDORS,
-                 id_sub        = 'vc_keys',
-                 label_key     = 'name',
-                 select        = vc_select,
-                 limit         = vclimit,
-                 allow_textbox = 1,
-                 onChange      = "document.getElementById('update_button').click();" -%]
-            <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% vc | html %]')">
+           [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 250px", class="initial_focus") %]
+           [% P.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
+           [% P.hidden_tag("previous_vendor_id", vendor_id) %]
           </td>
-          <input type="hidden" name="vendor_id" value="[% HTML.escape(vendor_id) %]">
-          <input type="hidden" name="oldvendor" value="[% HTML.escape(oldvendor) %]">
-          <input type="hidden" name="selectvendor" value="[% HTML.escape(selectvendor) %]">
         </tr>
 [%- IF ALL_CONTACTS.size %]
         <tr>
         <tr>
           <th align="right">[% 'Steuersatz' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'taxzone_id'
-                 style      = 'width: 250px'
-                 DATA       = ALL_TAXZONES
-                 id_key     = 'id'
-                 readonly   = (id ? 1 : 0)
-                 label_key  = 'description' -%]
+            [% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES) , default = taxzone_id, title_key = 'description', disabled = (id ? 1 : 0), style='width: 250px', onchange = "document.getElementById('update_button').click();") %]
+  [%- IF id %]
+          <input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
+  [%- END %]
           </td>
   [%- IF id %]
           <input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
   [%- END %]
         </tr>
-[%- IF all_departments %]
+[%- IF ALL_DEPARTMENTS.as_list.size %]
         <tr>
           <th align="right" nowrap>[% 'Department' | $T8 %]</th>
-          <td colspan="3">
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'department_id',
-                 style      = 'width: 250px',
-                 DATA       = all_departments,
-                 id_key     = 'id',
-                 label_sub  = 'department_labels',
-                 show_empty = 1 -%]
-          </td>
+          <td colspan="3">[% P.select_tag("department_id", ALL_DEPARTMENTS, with_empty=1, default=department_id, title_key="description", style="width: 250px") %]</td>
         </tr>
 [%- END %]
 [%- IF currencies %]
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
-          <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'globalproject_id',
-                 DATA       = ALL_PROJECTS,
-                 id_key     = 'id',
-                 label_key  = 'projectnumber',
-                 show_empty = 1,
-                 onChange   = "document.getElementById('update_button').click();" -%]
-          </td>
+          <td>[% P.project_picker('globalproject_id', globalproject_id) %]</td>
         </tr>
       </table>
     </td>
index 28f3f4da43c933d7ac251e8da2fa6c9d1bc9e0a8..4fcc5ace63baa380e9308aa2505e9d5829a4084b 100644 (file)
@@ -1,14 +1,12 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-[%- USE L %]
-[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_name _ ')' %]
+[%- USE L %][%- USE P -%]
+[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_obj.name _ ')' %]
 <script type="text/javascript" src="js/common.js"></script>
 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
-<script type="text/javascript" src="js/vendor_selection.js"></script>
 <script type="text/javascript" src="js/calculate_qty.js"></script>
 <script type="text/javascript" src="js/follow_up.js"></script>
-<script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
 
 <form method="post" name="invoice" action="[% script %]">
 
         <tr>
           <th align="right">[% 'Customer' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 id            = 'customer',
-                 name          = 'customer',
-                 style         = 'width: 250px',
-                 class         = 'initial_focus',
-                 DATA          = ALL_CUSTOMERS,
-                 id_sub        = 'vc_keys',
-                 label_key     = 'name',
-                 select        = vc_select,
-                 limit         = vclimit,
-                 allow_textbox = 1,
-                 onChange      = "document.getElementById('update_button').click();" -%]
-            <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% HTML.escape(vc) %]')">
+           [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus") %]
+           [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
+           [% L.hidden_tag("previous_customer_id", customer_id) %]
           <input type="hidden" name="customer_pricegroup_id" value="[% HTML.escape(customer_pricegroup_id) %]">
-          <input type="hidden" name="customer_id" value="[% HTML.escape(customer_id) %]">
-          <input type="hidden" name="oldcustomer" value="[% HTML.escape(oldcustomer) %]">
-          <input type="hidden" name="selectcustomer" value="[% HTML.escape(selectcustomer) %]">
           </td>
         </tr>
 [%- IF ALL_CONTACTS.size %]
index 497be459fe1f76b95452d7ea92af3717af6d2e7e..953cb1502df2052300c25a13b1a18b0cb663a1cd 100644 (file)
@@ -1,14 +1,12 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
 
   <form method="post" name="oe" action="[% script %]">
 
     <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
-    <script type="text/javascript" src="js/vendor_selection.js"></script>
     <script type="text/javascript" src="js/calculate_qty.js"></script>
-    <script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
     <script type="text/javascript" src="js/follow_up.js"></script>
     [%- IF is_sales_ord %]
      [% L.javascript_tag("js/edit_periodic_invoices_config") %]
                   <tr>
                     <th align="right">[% IF vc == 'customer' %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
                     <td>
-                      [%- INCLUDE 'generic/multibox.html'
-                           name          = vc,
-                           style         = 'width: 250px',
-                           class         = 'initial_focus',
-                           DATA          = vc == 'customer' ? ALL_CUSTOMERS : ALL_VENDORS,
-                           id_sub        = 'vc_keys',
-                           label_key     = 'name',
-                           select        = vc_select,
-                           limit         = vclimit,
-                           allow_textbox = 1,
-                           onChange      = "document.getElementById('update_button').click();" -%]
-                      <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% HTML.escape(vc) %]')">
+                     [%- SET vc_id = vc _ "_id" %]
+                     [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, style="width: 250px", class="initial_focus") %]
+                     [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _  "')", LxERP.t8("Details (one letter abbreviation)")) %]
+                     [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
                     </td>
                   </tr>
 [%- IF ALL_CONTACTS.size %]
                     </td>
                   </tr>
 [%- END %]
-[%- IF currencies %]
                   <tr>
                     <th align="right">[% 'Currency' | $T8 %]</th>
-                    <td>[% currencies %]</td>
+                    <td>[% L.select_tag("currency", ALL_CURRENCIES, value_key="name", default=currency, onchange="document.getElementById('update_button').click();") %]</td>
                   </tr>
-[%- END %]
 [%- IF show_exchangerate %]
                   <tr>
                     <th align="right">[% 'Exchangerate' | $T8 %]</th>
index 1b9d615f68274d7e835452acc4b867a556907215..fe1df7ef15f57f25aea951c58c9229c64e150c5e 100644 (file)
@@ -1,12 +1,14 @@
 [%- USE HTML %]
 [%- USE T8 %]
 [%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
 <h1>[% HTML.escape(title) %]</h1>
 
 [%- SET vclabel = vc == 'customer' ? LxERP.t8('Customer') : LxERP.t8('Vendor') %]
 [%- SET vcnumberlabel = vc == 'customer' ? LxERP.t8('Customer Number') : LxERP.t8('Vendor Number') %]
 [%- SET vctypelabel = vc == 'customer' ? LxERP.t8('Customer type') : LxERP.t8('Vendor type') %]
+[%- SET vcdefault = 'old' _ vc %]
+[%- SET style="width: 250px" %]
 
 <form method="post" action="oe.pl">
 
    <table>
     <tr>
      <th align="right">[% HTML.escape(vclabel) %]</th>
-     <td colspan="3">
-            [%- INCLUDE 'generic/multibox.html'
-                 name          = vc,
-                 default       = vc == 'customer' ? oldcustomer : oldvendor,
-                 style         = 'width: 250px',
-                 DATA          = ALL_VC,
-                 id_sub        = 'vc_keys',
-                 label_key     = 'name',
-                 select        = vc_select,
-                 limit         = MYCONFIG.vclimit,
-                 show_empty    = 1,
-                 allow_textbox = 1,
-                 class         = 'initial_focus',
-                 -%]
-     </td>
+     <td>[% L.input_tag(vc, $vcdefault, style=style, class="initial_focus") %]</td>
     </tr>
     <tr>
      <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
-     <td colspan="3">[% L.input_tag("cp_name", '', style="width: 250px") %]</td>
+     <td>[% L.input_tag("cp_name", '', style=style) %]</td>
     </tr>
 [%- IF ALL_DEPARTMENTS.size %]
     <tr>
      <th align="right" nowrap>[% 'Department' | $T8 %]</th>
-     <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style="width: 250px") %]</td>
+     <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style=style) %]</td>
     </tr>
 [%- END %]
     <tr>
      <th align="right">[% HTML.escape(ordlabel) %]</th>
-     <td colspan="3"><input name="[% HTML.escape(ordnrname) %]" style="width: 250px"></td>
+     <td>[% L.input_tag(ordnrname, "", style=style) %]</td>
     </tr>
 [% IF is_order %]
     <tr>
      <th align="right">[% LxERP.t8("Customer Order Number") %]</th>
-     <td colspan="3">[% L.input_tag("cusordnumber", '', style="width: 250px") %]</td>
+     <td>[% L.input_tag("cusordnumber", '', style=style) %]</td>
     </tr>
 [% END %]
     <tr>
      <th align="right">[% 'Employee' | $T8 %]</th>
-     <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
+     <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style=style) %]</td>
     </tr>
     <tr>
      <th align="right">[% 'Salesman' | $T8 %]</th>
-     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
+     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style=style) %]</td>
     </tr>
     <tr>
      <th align="right">[% 'Steuersatz' | $T8 %]</th>
-     <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style='width: 250px') %]</td>
+     <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style=style) %]</td>
     </tr>
     <tr>
      <th align="right">[% 'Shipping Point' | $T8 %]</th>
-     <td colspan="3">[% L.input_tag('shippingpoint', '', style='width:250px') %]</td>
+     <td>[% L.input_tag('shippingpoint', '', style=style) %]</td>
     </tr>
     <tr>
      <th align="right">[% 'Transaction description' | $T8 %]</th>
-     <td><input name="transaction_description" style="width: 250px"></td>
+     <td>[% L.input_tag("transaction_description", "", style=style) %]</td>
 
      <th align="right">[% 'Part Description' | $T8 %]</th>
-     <td><input name="parts_description" style="width: 250px"></td>
+     <td>[% L.input_tag("parts_description", "", style=style) %]</td>
     </tr>
     <tr>
-     <th align="right">[% 'Project Number' | $T8 %]</th>
-     <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name          =  MYCONFIG.vclimit < ALL_PROJECTS.size ? 'projectnumber' : 'project_id',
-                 style         = "width: 250px",
-                 DATA          =  ALL_PROJECTS,
-                 id_key        = 'id',
-                 label_key     = 'projectnumber',
-                 limit         = MYCONFIG.vclimit,
-                 show_empty    = 1,
-                 allow_textbox = 1,
-            -%]
-     </td>
+     <th align="right">[% 'Project' | $T8 %]</th>
+     <td>[% P.project_picker("project_id", '', style=style) %]</td>
 
      <th align="right">[% 'Part Number' | $T8 %]</th>
-     <td><input name="parts_partnumber" style="width: 250px"></td>
+     <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
     </tr>
     [%- UNLESS ALL_BUSINESS_TYPES.size == 0 %]
     <tr>
      <th align="right" nowrap>[% vctypelabel %]</th>
-     <td colspan="3">
-      [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1, style='width:250px') %]
+     <td>
+      [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1, style=style) %]
      </td>
     </tr>
     [%- END %]
      <th align="right">[% IF is_order %][% 'Order Date' | $T8 %][% ELSE %][% 'Quotation Date' | $T8 %][% END %] [% 'From' | $T8 %]</th>
      <td>
        [% L.date_tag('transdatefrom') %]
-     </td>
-     <th align="right">[% 'Bis' | $T8 %]</th>
-     <td>
+       [% 'Bis' | $T8 %]
       [% L.date_tag('transdateto') %]
      </td>
     </tr>
      <th align="right">[% IF is_order %][% 'Delivery Date' | $T8 %][% ELSE %][% 'Valid until' | $T8 %][% END %] [% 'From' | $T8 %]</th>
      <td>
        [% L.date_tag('reqdatefrom') %]
-     </td>
-     <th align="right">[% 'Bis' | $T8 %]</th>
-     <td>
+       [% 'Bis' | $T8 %]
        [% L.date_tag('reqdateto') %]
      </td>
     </tr>
      <th align="right">[% 'Insert Date' | $T8 %] [% 'From' | $T8 %]</th>
      <td>
        [% L.date_tag('insertdatefrom') %]
-     </td>
-     <th align="right">[% 'Bis' | $T8 %]</th>
-     <td>
+       [% 'Bis' | $T8 %]
        [% L.date_tag('insertdateto') %]
      </td>
     </tr>
      <th align="right">[% 'Expected billing date' | $T8 %] [% 'From' | $T8 %]</th>
      <td>
       [% L.date_tag('expected_billing_date_from', '' 'BL') %]
-     </td>
-     <th align="right">[% 'Expected billing date' | $T8 %] [% 'Bis' | $T8 %]</th>
-     <td>
+      [% 'Bis' | $T8 %]
       [% L.date_tag('expected_billing_date_to', '' 'BL') %]
      </td>
     </tr>
     <tr>
      <th align="right">[% 'Order probability' | $T8 %]</th>
-     <td colspan="3">
+     <td>
       [% L.select_tag('order_probability_op', [[ 'ge', '>=' ], [ 'le', '<=' ]]) %]
       [% L.select_tag('order_probability_value', ORDER_PROBABILITIES, title='title', with_empty=1) %]
      </td>
 
       [% CT_CUSTOM_VARIABLES_INCLUSION_CODE %]
 
-[%- IF type == 'sales_order' %]
-       <tr><td colspan="3"><hr></td></tr>
-[%- END %]
       </table>
      </td>
     </tr>
index f34794f251e8c234125c0ffe096d5108e79e140b..7d5b0eb980d9a161f7fdbceb7a5d48acd6826d3c 100644 (file)
@@ -1,5 +1,5 @@
-[%- USE T8 %]
-[%- USE L %]
+[%- USE T8 %][%- USE L %][%- USE P -%]
+[%- SET style="width: 250px" %]
 <h1>[% title %]</h1>
 
 <form method=post name="search_invoice" action=[% script %]>
 
     <tr>
       <th align=right>[% 'Customer' | $T8 %]</th>
-      <td>
-        [%- 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>[% P.input_tag("customer", "", class="initial_focus", style=style) %]</td>
 
       <th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
-      <td>
-        <input name="customernumber" size="20">
-      </td>
+      <td>[% P.input_tag("customernumber", "", style=style) %]</td>
     </tr>
 
     <tr>
                          ALL_DEPARTMENTS,
                          title_key  = 'description',
                          with_empty = 1,
-                         style      = 'width: 250px')
+                         style      = style)
       -%]
       </td>
 
       <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>[% P.project_picker("project_id", "", style=style) %]</td>
     </tr>
 
     <tr>
       <th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
-      <td><input name="partnumber" size="20"></td>
+      <td>[% P.input_tag("partnumber", "", style=style) %]</td>
     </tr>
 
     <tr>
       <th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
-      <td>
-        <input name="description" size="40">
-      </td>
+      <td>[% P.input_tag("description", "", style=style) %]</td>
     </tr>
 
     <tr>
       <th align="right">[% 'Partsgroup' | $T8 %]</th>
-      <td>
-        [%- INCLUDE 'generic/multibox.html'
-          name          = 'partsgroup_id',
-          style         = 'width: 250px',
-          DATA          =  ALL_PARTSGROUPS,
-          id_key        = 'id',
-          label_key     = 'partsgroup',
-          show_empty    = 1,
-          allow_textbox = 0,
-        -%]
-      </td>
-
+      <td>[% P.select_tag("partsgroupd_id", ALL_PARTSGROUPS, title_key="partsgroup", with_empty=1, style=style) %]</td>
       <td align="right" nowrap>[% 'Country' | $T8 %]</td>
-      <td><input name="country" size="20"></td>
+      <td>[% P.input_tag("country", "", style=style) %]</td>
     </tr>
 
     <tr>
       <th align="right">[% 'Employee' | $T8 %]</th>
-      <td>
-        [%- INCLUDE 'generic/multibox.html'
-          name          = 'employee_id',
-          style         = 'width: 250px',
-          DATA          =  ALL_EMPLOYEES,
-          id_key        = 'id',
-          label_sub     = 'employee_labels',
-          limit         = vclimit,
-          show_empty    = 1,
-          allow_textbox = 0,
-          default       = ' ',
-        -%]
-      </td>
+      <td>[% L.select_tag("employee_id", ALL_EMPLOYEES, title_key="safe_name", with_empty=1, style=style) %]</td>
 
       <th align="right">[% 'Salesman' | $T8 %]</th>
-      <td>
-        [%- INCLUDE 'generic/multibox.html'
-          name          = 'salesman_id',
-          style         = 'width: 250px',
-          DATA          =  ALL_SALESMEN,
-          id_key        = 'id',
-          label_sub     = 'salesman_labels',
-          limit         = vclimit,
-          show_empty    = 1,
-          allow_textbox = 0,
-        -%]
-      </td>
+      <td>[% L.select_tag("salesman_id", ALL_EMPLOYEES, title_key="safe_name", with_empty=1, style=style) %]</td>
     </tr>
 
     <tr>
       <th align="right">[% 'Customer type' | $T8 %]</th>
-      <td>
-        [%- 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>[% L.select_tag("business_id", ALL_BUSINESS_TYPES, title_key="description", with_empty=1, style=style) %]</td>
     </tr>
 
     <tr>
       <th align=right nowrap>[% 'Invoice Date' | $T8 %] [% 'From' | $T8 %]</th>
       <td>
         [% L.date_tag('transdatefrom') %]
-      </td>
-
-      <th align=right>[% 'Bis' | $T8 %]</th>
-
-      <td>
+        [% 'Bis' | $T8 %]
         [% L.date_tag('transdateto') %]
       </td>
     </tr>