Merge branch 'master' of ssh://lx-office/~/lx-office-erp
authorHolger Lindemann <hli@lx-system.de>
Fri, 1 Oct 2010 20:44:57 +0000 (22:44 +0200)
committerHolger Lindemann <hli@lx-system.de>
Fri, 1 Oct 2010 20:44:57 +0000 (22:44 +0200)
13 files changed:
SL/AR.pm
SL/Printer.pm
bin/mozilla/admin_printer.pl
bin/mozilla/am.pl
bin/mozilla/ar.pl
locale/de/all
locale/de_DE/all
locale/en/all
scripts/locales.pl
templates/webpages/admin_printer/edit.html
templates/webpages/admin_printer/list.html
templates/webpages/ar/search.html
templates/webpages/generic/multibox.html

index 04af973..fe3e443 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -435,7 +435,8 @@ sub ar_transactions {
     qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | .
     qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| .
     qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| .
-    qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|;
+    qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| .
+    qq|LEFT JOIN department d ON (d.id = a.department_id)|;
 
   my $where = "1 = 1";
   if ($form->{customer_id}) {
@@ -445,11 +446,16 @@ sub ar_transactions {
     $where .= " AND c.name ILIKE ?";
     push(@values, $form->like($form->{customer}));
   }
-  if ($form->{department}) {
-    my ($null, $department_id) = split /--/, $form->{department};
+  if ($form->{department_id}) {
+    my $department_id = $form->{department_id};
     $where .= " AND a.department_id = ?";
     push(@values, $department_id);
   }
+  if ($form->{department}) {
+    my $department = "%" . $form->{department} . "%";
+    $where .= " AND d.description ILIKE ?";
+    push(@values, $department);
+  }
   foreach my $column (qw(invnumber ordnumber notes transaction_description)) {
     if ($form->{$column}) {
       $where .= " AND a.$column ILIKE ?";
index 346d734..ed42b01 100644 (file)
@@ -12,6 +12,8 @@ sub all_printers {
   my $query = qq|SELECT * FROM printers ORDER BY printer_description|;
   my @printers = selectall_hashref_query($::form, $dbh, $query);
 
+  $dbh->disconnect;
+
   $::lxdebug->leave_sub;
 
   return wantarray ? @printers : \@printers;
@@ -27,6 +29,8 @@ sub get_printer {
   my $query = qq|SELECT * FROM printers WHERE id = ?|;
   my ($printer) = selectfirst_hashref_query($::form, $dbh, $query, $params{id});
 
+  $dbh->disconnect;
+
   $::lxdebug->leave_sub;
 
   return $printer;
@@ -61,6 +65,7 @@ SQL
   );
 
   $dbh->commit;
+  $dbh->disconnect;
 
   $::lxdebug->leave_sub;
 }
@@ -76,6 +81,7 @@ sub delete_printer {
   do_query($::form, $dbh, $query, $params{id});
 
   $dbh->commit;
+  $dbh->disconnect;
 
   $::lxdebug->leave_sub;
 }
index bc62332..e397868 100644 (file)
@@ -20,10 +20,9 @@ sub get_login_form {
 }
 
 sub printer_dispatcher {
-      $::lxdebug->dump(0,  "testing", $::form);
-  for (qw(get_login_form list_printers add_printer edit_printer save_printer delete_printer list_users)) {
-    if ($::form->{$_}) {
-      ::call_sub($::locale->findsub($_));
+  for my $action (qw(get_login_form list_printers add_printer edit_printer save_printer delete_printer list_users)) {
+    if ($::form->{$action}) {
+      ::call_sub($::locale->findsub($action));
       ::end_of_request()
     }
   }
@@ -31,7 +30,7 @@ sub printer_dispatcher {
 }
 
 sub printer_management {
-  &list_printers;
+  &get_login_form;
 }
 
 sub add_printer {
index d9d4842..ecf4f2b 100644 (file)
@@ -39,6 +39,7 @@ use SL::User;
 use SL::USTVA;
 use SL::Iconv;
 use SL::TODO;
+use SL::Printer;
 use CGI::Ajax;
 use CGI;
 
index 35f23d6..8efd498 100644 (file)
@@ -1398,6 +1398,9 @@ sub ar_transactions {
     my ($department) = split /--/, $form->{department};
     push @options, $locale->text('Department') . " : $department";
   }
+  if ($form->{department_id}) {
+    push @options, $locale->text('Department Id') . " : $form->{department_id}";
+  }
   if ($form->{invnumber}) {
     push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
   }
index 18b6d39..9d78ab9 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# -*- coding: ISO-8859-15; -*-
+# -*- coding: iso-8859-15; -*-
 # vim: fenc=ISO-8859-15
 
 # These are all the texts to build the translations files.
@@ -942,7 +942,6 @@ $self->{texts} = {
   'List Price'                  => 'Listenpreis',
   'List Price Factors'          => 'Preisfaktoren anzeigen',
   'List Pricegroups'            => 'Preisgruppen anzeigen',
-  'List Printer'                => 'Drucker anzeigen',
   'List Tax'                    => 'Bearbeiten',
   'List Transactions'           => 'Buchungsliste',
   'List Warehouses'             => 'Lager anzeigen',
index 5e0ec9d..85789fc 100644 (file)
@@ -942,7 +942,6 @@ $self->{texts} = {
   'List Price'                  => 'Listenpreis',
   'List Price Factors'          => 'Preisfaktoren anzeigen',
   'List Pricegroups'            => 'Preisgruppen anzeigen',
-  'List Printer'                => 'Drucker anzeigen',
   'List Tax'                    => 'Bearbeiten',
   'List Transactions'           => 'Buchungsliste',
   'List Warehouses'             => 'Lager anzeigen',
@@ -1206,6 +1205,7 @@ $self->{texts} = {
   'Please read the file'        => 'Bitte lesen Sie die Datei',
   'Please select a customer from the list below.' => 'Bitte einen Endkunden aus der Liste auswählen',
   'Please select a part from the list below.' => 'Bitte w&auml;hlen Sie einen Artikel aus der Liste aus.',
+  'Please select a user'        => 'Bitte wählen Sie einen Benutzer aus',
   'Please select a vendor from the list below.' => 'Bitte einen Händler aus der Liste auswählen',
   'Please select the chart of accounts this installation is using from the list below.' => 'Bitte w&auml;hlen Sie den Kontenrahmen aus, der bei dieser Installation verwendet wird.',
   'Please select the database you want to backup' => 'Bitte w&auml;hlen Sie die zu sichernde Datenbank gefunden',
@@ -1249,9 +1249,8 @@ $self->{texts} = {
   'Printer'                     => 'Drucker',
   'Printer Command'             => 'Druckbefehl',
   'Printer Command missing!'    => 'Druckbefehl fehlt',
-  'Printer Description'         => 'Druckerbeschreibung',
-  'Printer deleted!'            => 'Drucker gelöscht!',
-  'Printer saved!'              => 'Drucker gespeichert!',
+  'Printer Management'          => 'Druckeradministration',
+  'Printers are created for a user database. Please select a user. The associated database will be edited.' => 'Drucker werden für eine Benutzerdatenbank erzeugt. Bitte wählen Sie einen Benutzer aus. Die Drucker werden in der verknüpften Datenbank angelegt.',
   'Printing ... '               => 'Es wird gedruckt.',
   'Prior to Lx-Office v2.4.0 the user could enter arbitrary strings as units for parts, services and in invoices, sales quotations etc.' => 'Vor Lx-Office 2.4.0 konnte der Benutzer bei Artikeln, Dienstleistungen und Rechnungen, Angeboten etc beliebige Einheiten angeben.',
   'Prior to Lx-Office v2.4.0 the user had to chose the accounts for each part and service.' => 'Vor Lx-Office 2.4.0 musste der Benutzer die Konten bei jeder Ware und jeder Dienstleistung einzeln ausw&auml;hlen.',
index 4e8ae75..0f43a94 100644 (file)
@@ -942,7 +942,6 @@ $self->{texts} = {
   'List Price'                  => '',
   'List Price Factors'          => '',
   'List Pricegroups'            => '',
-  'List Printer'                => '',
   'List Tax'                    => '',
   'List Transactions'           => '',
   'List Warehouses'             => '',
@@ -1206,6 +1205,7 @@ $self->{texts} = {
   'Please read the file'        => '',
   'Please select a customer from the list below.' => '',
   'Please select a part from the list below.' => '',
+  'Please select a user'        => '',
   'Please select a vendor from the list below.' => '',
   'Please select the chart of accounts this installation is using from the list below.' => '',
   'Please select the database you want to backup' => '',
@@ -1249,9 +1249,8 @@ $self->{texts} = {
   'Printer'                     => '',
   'Printer Command'             => '',
   'Printer Command missing!'    => '',
-  'Printer Description'         => '',
-  'Printer deleted!'            => '',
-  'Printer saved!'              => '',
+  'Printer Management'          => '',
+  'Printers are created for a user database. Please select a user. The associated database will be edited.' => '',
   'Printing ... '               => '',
   'Prior to Lx-Office v2.4.0 the user could enter arbitrary strings as units for parts, services and in invoices, sales quotations etc.' => '',
   'Prior to Lx-Office v2.4.0 the user had to chose the accounts for each part and service.' => '',
index 24b0687..fa787a2 100755 (executable)
@@ -576,7 +576,7 @@ sub strip_base {
 
 sub _single_quote {
   my $val = shift;
-  $val =~ s/('|\\$)/\\$1/g;
+  $val =~ s/(\'|\\$)/\\$1/g;
   return  "'" . $val .  "'";
 }
 
@@ -601,7 +601,9 @@ sub generate_file {
 
   open my $fh, '>', $file or die "$! : $file";
 
-  print $fh "#!/usr/bin/perl\n# -*- coding: $charset; -*-\n# vim: fenc=$charset\n\n";
+  my $emacs_charset = lc $charset;
+
+  print $fh "#!/usr/bin/perl\n# -*- coding: $emacs_charset; -*-\n# vim: fenc=$charset\n\n";
   print $fh $header, "\n" if $header;
   print $fh "$data_name = $delim[0]\n" if $data_name;
 
index d158702..c8edd60 100644 (file)
 <table width=100%>
   <tr height="5"></tr>
   <tr>
-    <th align=right>[% 'Printer' | $T8 %]</th>
+    <th align=left>[% 'Printer' | $T8 %]</th>
     <td><input name="printer.printer_description" size=30 value="[% printer.printer_description | html %]"></td>
   <tr>
   <tr>
-    <th align=right>[% 'Printer Command' | $T8 %]</th>
+    <th align=left>[% 'Printer Command' | $T8 %]</th>
     <td><input name="printer.printer_command" size=30 value="[% printer.printer_command | html %]"></td>
   </tr>
   <tr>
-    <th align=right>[% 'Template Code' | $T8 %]</th>
+    <th align=left>[% 'Template Code' | $T8 %]</th>
     <td><input name="printer.template_code" size=5 value="[% printer.template_code | html %]"></td>
   </tr>
   <td colspan=2><hr size=3 noshade></td>
index 6dd2361..92a7095 100644 (file)
@@ -20,8 +20,8 @@
 [%- FOREACH row = all_printers %]
         <tr valign=top class="listrow[% loop.count % 2 %]">
           <td><a href="[% edit_link %][% row.id %]">[% row.printer_description %]</a></td>
-          <td align=right>[% row.printer_command | html %]</td>
-          <td align=right>[% row.template_code | html %]</td>
+          <td align=left>[% row.printer_command | html %]</td>
+          <td align=left>[% row.template_code | html %]</td>
         </tr>
 [%- END %]
 [%- ELSE %]
index cf8c70a..9245d6b 100644 (file)
@@ -31,6 +31,7 @@
       <td>
             [%- INCLUDE 'generic/multibox.html'
                  name          = 'department',
+                 select_name   = 'department_id',
                  style         = 'width: 250px',
                  DATA          = ALL_DEPARTMENTS,
                  id_key        = 'id',
index ccb87cb..b26f86f 100644 (file)
     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
 -%]
 [%- DEFAULT
   limit      = limit   != '' ? limit   : vclimit != '' ? vclimit : 200
+  show_text  = allow_textbox and DATA.size and limit < DATA.size ? 1 : 0
   id         = id      != '' ? id      : name
   default    = default != '' ? default : $name
 -%]
+[%-
+  name       = (select_name != '' and ! show_text) ? select_name : name
+-%]
 [%- FOREACH row = DATA %]
   [%-
        row.id       = row.$id_key     != ''  ? row.$id_key    : $id_sub(row)
@@ -39,7 +44,7 @@
        row.selected = default == row.id
   -%]
 [%- END -%]
-[%- IF allow_textbox and DATA.size and limit < DATA.size %]
+[%- IF show_text %]
 <input type="text"
  [%- IF name     %] name="[%     HTML.escape(name)     %]"[% END -%]
  [%- IF id       %] id="[%       HTML.escape(id)       %]"[% END -%]