Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 8 Feb 2012 15:54:41 +0000 (16:54 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 8 Feb 2012 15:54:41 +0000 (16:54 +0100)
29 files changed:
SL/Auth.pm
SL/CT.pm
SL/Controller/CustomVariableConfig.pm
SL/Controller/PaymentTerm.pm
SL/Controller/PriceFactor.pm
SL/Controller/Unit.pm
SL/Controller/Warehouse.pm
SL/DN.pm
SL/IR.pm
SL/RP.pm
SL/Request.pm
SL/WH.pm
bin/mozilla/dn.pl
bin/mozilla/io.pl
bin/mozilla/ustva.pl
bin/mozilla/wh.pl
doc/changelog
doc/release_management.txt [new file with mode: 0644]
locale/de/all
locale/en/all
sql/Pg-upgrade2/auth_enable_ct_all_edit.pl [new file with mode: 0644]
templates/print/f-tex/balance_sheet.html [new file with mode: 0644]
templates/print/f-tex/default.tex
templates/print/f-tex/income_statement.html [new file with mode: 0644]
templates/print/f-tex/setup.sh [deleted file]
templates/webpages/dunning/show_dunning_bottom.html
templates/webpages/dunning/show_invoices.html
templates/webpages/report_generator/html_report.html
templates/webpages/wh/report_filter.html

index d361a3d..870ead1 100644 (file)
@@ -947,7 +947,8 @@ sub all_rights_full {
     ["crm_notices",                    $locale->text("CRM notices")],
     ["crm_other",                      $locale->text("CRM other")],
     ["--master_data",                  $locale->text("Master Data")],
-    ["customer_vendor_edit",           $locale->text("Create and edit customers and vendors")],
+    ["customer_vendor_edit",           $locale->text("Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)")],
+    ["customer_vendor_all_edit",       $locale->text("Create customers and vendors. Edit all vendors. Edit all customers")],
     ["part_service_assembly_edit",     $locale->text("Create and edit parts, services, assemblies")],
     ["project_edit",                   $locale->text("Create and edit projects")],
     ["--ar",                           $locale->text("AR")],
index 3be8ce9..b46ee09 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -769,6 +769,13 @@ sub search {
     push(@values, conv_i($form->{business_id}));
   }
 
+  # Nur Kunden finden, bei denen ich selber der Verkäufer bin
+  # Gilt nicht für Lieferanten
+  if ($cv eq 'customer' &&   !$main::auth->assert('customer_vendor_all_edit', 1)) {
+    $where .= qq| AND ct.salesman_id = (select id from employee where login= ?)|;
+    push(@values, $form->{login});
+  }
+
   my ($cvar_where, @cvar_values) = CVar->build_filter_query('module'         => 'CT',
                                                             'trans_id_field' => 'ct.id',
                                                             'filter'         => $form);
index 0c47799..a2842a0 100644 (file)
@@ -22,7 +22,7 @@ sub action_reorder {
     }
   });
 
-  $self->render(type => 'js', inline => '1;');
+  $self->render('1;', { type => 'js', inline => 1 });
 }
 
 #
index 295b44b..3a768a2 100644 (file)
@@ -75,7 +75,7 @@ sub action_reorder {
     }
   });
 
-  $self->render(type => 'js', inline => '1;');
+  $self->render('1;', { type => 'js', inline => 1 });
 }
 
 #
index 31f0e46..31b376d 100644 (file)
@@ -22,7 +22,7 @@ sub action_reorder {
     }
   });
 
-  $self->render(type => 'js', inline => '1;');
+  $self->render('1;', { type => 'js', inline => 1 });
 }
 
 #
index 018a7b3..72cd5ce 100644 (file)
@@ -22,7 +22,7 @@ sub action_reorder {
     }
   });
 
-  $self->render(type => 'js', inline => '1;');
+  $self->render('1;', { type => 'js', inline => 1 });
 }
 
 #
index a7b059c..cfc84a6 100644 (file)
@@ -22,7 +22,7 @@ sub action_reorder {
     }
   });
 
-  $self->render(type => 'js', inline => '1;');
+  $self->render('1;', { type => 'js', inline => 1 });
 }
 
 #
index 797588a..6d00f43 100644 (file)
--- a/SL/DN.pm
+++ b/SL/DN.pm
@@ -41,6 +41,8 @@ use SL::IS;
 use SL::Mailer;
 use SL::MoreCommon;
 use SL::Template;
+use SL::DB::Printer;
+use SL::DB::Language;
 
 use strict;
 
@@ -403,15 +405,54 @@ sub set_template_options {
     $form->{printer_code} = "_" . $form->{printer_code};
   }
 
-  $form->{IN}  = "$form->{formname}$form->{language}$form->{printer_code}.html";
-  $form->{pdf} = 1;
+  my $extension = 'html';
+  if ($form->{format} eq 'postscript') {
+    $form->{postscript}   = 1;
+    $extension            = 'tex';
 
-  if ($form->{"format"} =~ /opendocument/) {
-    $form->{IN} =~ s/html$/odt/;
-  } else {
-    $form->{IN} =~ s/html$/tex/;
+  } elsif ($form->{"format"} =~ /pdf/) {
+    $form->{pdf}          = 1;
+    $extension            = $form->{'format'} =~ m/opendocument/i ? 'odt' : 'tex';
+
+  } elsif ($form->{"format"} =~ /opendocument/) {
+    $form->{opendocument} = 1;
+    $extension            = 'odt';
+  } elsif ($form->{"format"} =~ /excel/) {
+    $form->{excel} = 1;
+    $extension            = 'xls';
+  }
+
+
+  # search for the template
+  my @template_files;
+  push @template_files, "$form->{formname}_email$form->{language}$form->{printer_code}.$extension" if $form->{media} eq 'email';
+  push @template_files, "$form->{formname}$form->{language}$form->{printer_code}.$extension";
+  push @template_files, "$form->{formname}.$extension";
+  push @template_files, "default.$extension";
+
+  $form->{IN} = undef;
+  for my $filename (@template_files) {
+    if (-f "$form->{templates}/$filename") {
+      $form->{IN} = $filename;
+      last;
+    }
   }
 
+  if (!defined $form->{IN}) {
+    $::form->error($::locale->text('Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.', join ', ', map { "'$_'"} @template_files));
+  }
+
+  # prepare meta information for template introspection
+  $form->{template_meta} = {
+    formname  => $form->{formname},
+    language  => SL::DB::Manager::Language->find_by_or_create(id => $form->{language_id}),
+    format    => $form->{format},
+    media     => $form->{media},
+    extension => $extension,
+    printer   => SL::DB::Manager::Printer->find_by_or_create(id => $form->{printer_id}),
+    today     => DateTime->today,
+  };
+
   $main::lxdebug->leave_sub();
 }
 
@@ -468,7 +509,7 @@ sub get_invoices {
 
   $query =
     qq|SELECT
-         a.id, a.ordnumber, a.transdate, a.invnumber, a.amount,
+         a.id, a.ordnumber, a.transdate, a.invnumber, a.amount, a.language_id,
          ct.name AS customername, a.customer_id, a.duedate,
          a.amount - a.paid AS open_amount,
 
@@ -628,7 +669,7 @@ sub get_dunning {
   my $sortorder = join ', ', map { "$_ $sortdir" } @{ $sort_columns{$sortkey} };
 
   my $query =
-    qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount,
+    qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount, a.language_id,
          ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee,
          da.interest, dn.dunning_description, da.transdate AS dunning_date,
          da.duedate AS dunning_duedate, da.dunning_id, da.dunning_config_id,
index 7f4389f..edf55f1 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -207,9 +207,9 @@ sub post_invoice {
 
       next if $payments_only;
 
-      # update parts table
+      # update parts table by setting lastcost to current price, don't allow negative values by using abs
       $query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
-      @values = ($form->{"sellprice_$i"}, conv_i($form->{"id_$i"}));
+      @values = (abs($form->{"sellprice_$i"}), conv_i($form->{"id_$i"}));
       do_query($form, $dbh, $query, @values);
 
       # check if we sold the item already and
index abf95be..072c54b 100644 (file)
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -213,9 +213,9 @@ sub get_accounts {
 
   # if l_ob is selected l_cb is always ignored
   if ( $form->{l_ob} ) {
-    $where .= ' AND ob_transaction is true  ' 
+    $where .= ' AND ac.ob_transaction is true  ' 
   } elsif ( not $form->{l_cb} ) {
-    $where .= ' AND cb_transaction is false ';
+    $where .= ' AND ac.cb_transaction is false ';
   };
 
   if ($fromdate) {
@@ -471,7 +471,7 @@ sub get_accounts_g {
   my $inwhere = "";
   my $item;
 
-  $where .= ' AND cb_transaction is false ' unless $form->{l_cb};
+  $where .= ' AND ac.cb_transaction is false ' unless $form->{l_cb};
 
   if ($fromdate) {
     $fromdate = conv_dateq($fromdate);
@@ -521,7 +521,7 @@ sub get_accounts_g {
                      FROM acc_trans acc
                      INNER JOIN chart c ON (acc.chart_id = c.id AND c.link LIKE '%AR_paid%')
                      WHERE 1=1 $inwhere AND acc.trans_id = ac.trans_id)
-                  / (SELECT amount FROM ar WHERE id = ac.trans_id)
+                  / COALESCE((SELECT amount FROM ar WHERE id = ac.trans_id and amount != 0 ), 1)
                 ) AS amount, c.pos_eur
        FROM acc_trans ac
        LEFT JOIN chart c ON (c.id  = ac.chart_id)
index dab5745..3b8262f 100644 (file)
@@ -51,7 +51,7 @@ sub _input_to_hash {
 
 sub _parse_multipart_formdata {
   my ($target, $temp_target, $input) = @_;
-  my ($name, $filename, $headers_done, $content_type, $boundary_found, $need_cr, $previous, $encoding, $transfer_encoding);
+  my ($name, $filename, $headers_done, $content_type, $boundary_found, $need_cr, $previous, $p_attachment, $encoding, $transfer_encoding);
 
   # We SHOULD honor encodings and transfer-encodings here, but as hard as I
   # looked I couldn't find a reasonably recent webbrowser that makes use of
@@ -103,14 +103,38 @@ sub _parse_multipart_formdata {
           substr $line, $-[0], $+[0] - $-[0], "";
         }
 
-        $previous                = _store_value($filename ? $target : $temp_target, $name, '') if ($name);
-        $temp_target->{FILENAME} = $filename if ($filename);
+        if ($name) {
+          # legacy, some old upload routines expect this to be here
+          $temp_target->{FILENAME} = $filename if defined $filename;
+
+          # name can potentially be both a normal variable or a file upload
+          # a file upload can be identified by its "filename" attribute
+          # the thing is, if a [+] clause vivifies atructur in one of the
+          # branches it must be done in both, or subsequent "[]" will fail
+          my $temp_target_slot = _store_value($temp_target, $name);
+          my $target_slot      = _store_value($target,      $name);
+
+          # set the reference for appending of multiline data to the correct one
+          $previous            = defined $filename ? $target_slot : $temp_target_slot;
+
+          # for multiple uploads: save the attachments in a SL/Mailer like structure
+          if (defined $filename) {
+            my $target_attachment      = _store_value($target,      "ATTACHMENTS.$name", {});
+            my $temp_target_attachment = _store_value($temp_target, "ATTACHMENTS.$name", {});
+
+            $$target_attachment->{data}          = $previous;
+            $$temp_target_attachment->{filename} = $filename;
+
+            $p_attachment = $$temp_target_attachment;
+          }
+        }
 
         next;
       }
 
       if ($line =~ m|^content-type\s*:\s*(.*?)[;\$]|i) {
         $content_type = $1;
+        $p_attachment->{content_type} = $1;
 
         if ($content_type =~ /^text/ && $line =~ m|;\s*charset\s*:\s*("?)(.*?)\1$|i) {
           $encoding = $2;
@@ -124,6 +148,7 @@ sub _parse_multipart_formdata {
         if ($transfer_encoding  && $transfer_encoding !~ /^[78]bit|binary$/) {
           die 'Transfer encodings beyond 7bit/8bit and binary are not implemented.';
         }
+        $p_attachment->{transfer_encoding} = $transfer_encoding;
 
         next;
       }
@@ -151,7 +176,7 @@ sub _recode_recursively {
         # Workaround for a bug: converting $from->{$key} directly
         # leads to 'undef'. I don't know why. Converting a copy works,
         # though.
-        $to->{$key} = $iconv->convert("" . $from->{$key});
+        $to->{$key} = $iconv->convert("" . $from->{$key}) if defined $from->{$key} && !defined $to->{$key};
       } else {
         $to->{$key} ||= {} if 'HASH'  eq ref $from->{$key};
         $to->{$key} ||= [] if 'ARRAY' eq ref $from->{$key};
index eb37626..cc53427 100644 (file)
--- a/SL/WH.pm
+++ b/SL/WH.pm
@@ -626,6 +626,9 @@ sub get_warehouse_report {
     push @filter_ary, "i.itime <= ?";
     push @filter_vars, $filter{date};
   }
+  if (!$filter{include_invalid_warehouses}){
+    push @filter_ary,  "NOT (w.invalid)";
+  }
 
   # prepare qty comparison for later filtering
   my ($f_qty_op, $f_qty, $f_qty_base_unit);
index 6c3492b..4b6210b 100644 (file)
@@ -133,6 +133,10 @@ sub show_invoices {
       map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } };
     }
     map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount open_amount fee interest);
+
+    if ($row->{'language_id'}) {
+      $row->{language} = SL::DB::Manager::Language->find_by('id' => $row->{'language_id'})->{'description'};
+    }
   }
 
   $form->get_lists('printers'  => 'printers',
@@ -150,6 +154,8 @@ sub show_invoices {
                                           'no_opendocument' => 1,);
 
   $form->header();
+  $form->{onload} = "document.getElementsByName('language_id')[0].disabled =
+        !document.getElementsByName('force_lang')[0].checked;";
   print $form->parse_html_template("dunning/show_invoices");
 
   $main::lxdebug->leave_sub();
@@ -199,6 +205,8 @@ sub save_dunning {
   my @rows = ();
   undef($form->{DUNNING_PDFS});
 
+  my $saved_language_id = $form->{language_id};
+
   if ($form->{groupinvoices}) {
     my %dunnings_for;
 
@@ -214,6 +222,7 @@ sub save_dunning {
       push @{ $level }, { "row"                    => $i,
                           "invoice_id"             => $form->{"inv_id_$i"},
                           "customer_id"            => $form->{"customer_id_$i"},
+                          "language_id"            => $form->{"language_id_$i"},
                           "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
                           "email"                  => $form->{"email_$i"}, };
     }
@@ -221,7 +230,9 @@ sub save_dunning {
     foreach my $levels (values %dunnings_for) {
       foreach my $level (values %{ $levels }) {
         next unless scalar @{ $level };
-
+        if (!$form->{force_lang}) {
+          $form->{language_id} = @{$level}[0]->{language_id};
+        }
         DN->save_dunning(\%myconfig, $form, $level);
       }
     }
@@ -233,12 +244,18 @@ sub save_dunning {
       my $level = [ { "row"                    => $i,
                       "invoice_id"             => $form->{"inv_id_$i"},
                       "customer_id"            => $form->{"customer_id_$i"},
+                      "language_id"            => $form->{"language_id_$i"},
                       "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
                       "email"                  => $form->{"email_$i"}, } ];
+      if (!$form->{force_lang}) {
+        $form->{language_id} = @{$level}[0]->{language_id};
+      }
       DN->save_dunning(\%myconfig, $form, $level);
     }
   }
 
+  $form->{language_id} = $saved_language_id;
+
   if($form->{DUNNING_PDFS}) {
     DN->melt_pdfs(\%myconfig, $form, $form->{copies});
   }
@@ -352,6 +369,7 @@ sub show_dunning {
     'checkbox'            => { 'text' => '', 'visible' => 'HTML' },
     'dunning_description' => { 'text' => $locale->text('Dunning Level') },
     'customername'        => { 'text' => $locale->text('Customername') },
+    'language'            => { 'text' => $locale->text('Language') },
     'invnumber'           => { 'text' => $locale->text('Invnumber') },
     'transdate'           => { 'text' => $locale->text('Invdate') },
     'duedate'             => { 'text' => $locale->text('Invoice Duedate') },
@@ -364,12 +382,12 @@ sub show_dunning {
   );
 
   $report->set_columns(%column_defs);
-  $report->set_column_order(qw(checkbox dunning_description customername invnumber transdate
+  $report->set_column_order(qw(checkbox dunning_description customername language invnumber transdate
                                duedate amount dunning_date dunning_duedate fee interest salesman));
   $report->set_sort_indicator($form->{sort}, $form->{sortdir});
 
   my $edit_url  = sub { build_std_url('script=' . ($_[0]->{invoice} ? 'is' : 'ar') . '.pl', 'action=edit', 'callback') . '&id=' . $::form->escape($_[0]->{id}) };
-  my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id=';
+  my $print_url = sub { build_std_url('action=print_dunning', 'format=pdf', 'media=screen', 'dunning_id='.$_[0]->{dunning_id}, 'language_id=' . $_[0]->{language_id}) };
   my $sort_url  = build_std_url('action=show_dunning', grep { $form->{$_} } @filter_field_list);
 
   foreach my $name (qw(dunning_description customername invnumber transdate duedate dunning_date dunning_duedate salesman)) {
@@ -396,6 +414,10 @@ sub show_dunning {
       $first_row_for_dunning = 1;
     }
 
+    if ($ref->{'language_id'}) {
+      $ref->{language} = SL::DB::Manager::Language->find_by('id' => $ref->{'language_id'})->{'description'};
+    }
+
     my $row = { };
     foreach my $column (keys %{ $ref }) {
       $row->{$column} = {
@@ -404,7 +426,7 @@ sub show_dunning {
         'align' => $alignment{$column},
 
         'link'  => (  $column eq 'invnumber'           ? $edit_url->($ref)
-                    : $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id})
+                    : $column eq 'dunning_description' ? $print_url->($ref)
                     :                                    ''),
       };
     }
@@ -416,6 +438,13 @@ sub show_dunning {
       'align'    => 'center',
     };
 
+    if ($first_row_for_dunning) {
+      $row->{language} = {'raw_data' => $cgi->hidden('-name' => "language_id_$i", '-value' => $ref->{language_id})
+                                        . " $ref->{language}" };
+    } else {
+      $row->{language} = { };
+    }
+
     push @{ $current_dunning_rows }, $row;
 
     $previous_dunning_id   = $ref->{dunning_id};
@@ -432,6 +461,8 @@ sub show_dunning {
 
   $report->set_options_from_form();
 
+  $form->{onload} = "document.getElementsByName('language_id')[0].disabled =
+        !document.getElementsByName('force_lang')[0].checked;";
   $report->generate_with_headers();
 
   $main::lxdebug->leave_sub();
@@ -448,6 +479,7 @@ sub print_dunning {
   $form->{rowcount}     = 1;
   $form->{selected_1}   = 1;
   $form->{dunning_id_1} = $form->{dunning_id};
+  $form->{language_id_1} = $form->{language_id};
 
   print_multiple();
 
@@ -466,6 +498,7 @@ sub print_multiple {
   $form->{title} = $locale->text('Print dunnings');
 
   my @dunning_ids = map { $form->{"dunning_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount});
+  my @language_ids = map { $form->{"language_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount});
 
   if (!scalar @dunning_ids) {
     $form->error($locale->text('No dunnings have been selected for printing.'));
@@ -473,10 +506,17 @@ sub print_multiple {
 
   $form->{DUNNING_PDFS} = [];
 
+  my $saved_language_id = $form->{language_id};
+  my $i = 0;
   foreach my $dunning_id (@dunning_ids) {
+    if (!$form->{force_lang}) {
+      $form->{language_id} = $language_ids[$i];
+    }
     DN->print_invoice_for_fees(\%myconfig, $form, $dunning_id);
     DN->print_dunning(\%myconfig, $form, $dunning_id);
+    $i++;
   }
+  $form->{language_id} = $saved_language_id;
 
   if (scalar @{ $form->{DUNNING_PDFS} }) {
     $form->{dunning_id} = strftime("%Y%m%d", localtime time);
index 37a4024..5050e6a 100644 (file)
@@ -1446,7 +1446,7 @@ sub print_form {
   format_dates($output_dateformat, $output_longdates,
                qw(invdate orddate quodate pldate duedate reqdate transdate
                   shippingdate deliverydate validitydate paymentdate
-                  datepaid transdate_oe deliverydate_oe
+                  datepaid transdate_oe deliverydate_oe dodate
                   employee_startdate employee_enddate
                   ),
                grep({ /^datepaid_\d+$/ ||
index 61ed296..89818c9 100644 (file)
@@ -855,9 +855,9 @@ sub generate_ustva {
 
       my $temp_numberformat = $myconfig{numberformat};
 
-      # Numberformat must be '1000.00' for Winston
+      # Numberformat must be '1000,00' for Winston
 
-      $myconfig{numberformat} = '1000.00';
+      $myconfig{numberformat} = '1000,00';
 
       foreach my $number (@category_cent) {
         $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
index 62be1d1..b3550b2 100644 (file)
@@ -824,7 +824,7 @@ sub generate_report {
   my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber bestbefore qty stock_value);
 
   # filter stuff
-  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber bestbefore date);
+  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber bestbefore date include_invalid_warehouses);
 
   $filter{qty_op} = WH->convert_qty_op($form->{qty_op});
   if ($filter{qty_op}) {
@@ -842,7 +842,7 @@ sub generate_report {
 
   my @hidden_variables = map { "l_${_}" } @columns;
   push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit l_warehousedescription l_bindescription);
-  push @hidden_variables, qw(include_empty_bins subtotal);
+  push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses);
 
   my %column_defs = (
     'warehousedescription' => { 'text' => $locale->text('Warehouse'), },
index e85c85e..65b4c23 100644 (file)
 - Mastertemplates für den Ausdruck sind in eigene Unterverzeichnisse gewandert.
   Dadurch wird das Hinzufügen neuer Vorlagensätze einfacher.
 
+- Zwei Rechterweiterung für 'eingeschränktere' Vertriebspartnerfunktion
+   Schreibschutz für Preise in Angebot und Suchfunktion in Stammdaten Kunden nur für Mitarbeiter freigeben, die auch
+   gleichzeitig als Verkäufer für den Kunden eingetragen sind. Rechtebeschreibung im Admin-Menü wie folgt:
+    * Preise und Rabatt in Formularen frei anpassen (falls deaktiviert,
+      wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders umgangen werden).
+    * Kunden und Lieferanten erfassen. Alle Lieferanten bearbeiten. Nur Kunden bearbeiten bei denen der Verkäufer gleich Bearbeiter (login) ist
 
   Kleinere neue Features und Detailverbesserungen:
   - á (LATIN SMALL LETTER A WITH ACUTE) wird in Latex-Vorlagen nicht mehr durch
diff --git a/doc/release_management.txt b/doc/release_management.txt
new file mode 100644 (file)
index 0000000..a31e13a
--- /dev/null
@@ -0,0 +1,180 @@
+Dieses Dokument listet die Arbeiten die für ein Lx-Office Release nötig sind,
+als freundliche Checkliste zum ausdrucken und erweitern.
+
+0. IM VORFELD
+=============
+
+* Etwa zwei Monate vor dem Release gibt es meistens einen Bugsprint.
+
+* Nach dem Bugsprint sollten alle Bugs die noch gefixt werden müssen mit einem
+  Target versehen werden.
+
+* Neue Bugs nach dem Bugsprint werden später separat behandelt.
+
+* Etwa einen Monat vor dem Release wird eine Beta herausgegeben.
+
+* (TODO: Reease Candidates Zeitplan).
+
+
+
+1. KONSISTENZ DES PROGRAMMS
+===========================
+
+* Freeze auf der Mailingliste ansagen.
+
+  - Featurefreeze für beta
+  - Commitfreeze für finales Release
+
+* Status Bugzilla
+
+  - Aus dem Bugsprint sollten keine Bugs mit Target der neuen Version mehr
+    offen sein.
+  - Neue Bugs seit dem Bugsprint müssen bewertet, gegebenenfalls behoben
+    werden.
+  - Sollten noch schwere Probleme existieren, Release verschieben.
+
+* Changelog aktualisieren.
+
+  - Im Changelog sollten sämtliche behobenen Bugs seit der letzten Version
+    aufgeführt sein. (TODO ist mit ein bisschen SQL Magie direkt aus der
+    Bugzilla Datenbank holbar, diese Magie hier möglichst dokumentieren).
+  - Ausserdem einmal durch das git scrollen und sinnvolle grössere Änderungen
+    ins changelog übertragen. Muss nur einmal gemacht werden, möglichst danach
+    nur noch inkrementell.
+
+* Perlabhängigkeiten prüfen
+
+  $ scripts/find-use.pl
+
+  Die Ausgabe zeigt alle "use *", "use parent qw()", require "" etc an, und
+  sucht nach Abhängigkeiten dadrin. Die Farbcodes bedeuten:
+
+  grün: Alles gut, das Modul ist entweder seit Ewigkeiten im perl core, oder
+        ist in modules/* dabei.
+  gelb: Das Modul ist nach 5.8.0 in den core gekommen, oder steht ordnungsgemäß
+        im InstallationCheck.pm
+  rot:  Noch nie gesehen das Modul. muss eingepflegt werden.
+
+  Sollte es nicht dokumentierte Abhängigkeiten geben, muss Folgendes gemacht
+  werden:
+
+  1. Wo kriegt man das Modul her?
+    - debian paket?
+    - cpan paket?
+    - cpan devel version?
+
+  2. Welche Mindestversion funktioniert sicher?
+    - zuindest deine aktuelle. ansonsten auch mal im cpan changelog schauen wie
+      alt die ist, und was alles dazugekommen ist.
+
+  3. Das Modul in SL/InstallationCheck.pm eintragen. Testen.
+
+  4. Das Modul in der Installationsanleitung eintragen.
+
+* doc/UPGRADE doku aktualisieren und auf Vollständigkeit prüfen.
+
+  Upgrade muss mindestens folgende Informationen enthalten:
+  - Neue Pakete und Abhängigkeiten
+  - Alles was nicht in der normalen Updatedoku steht und nötig ist, um eine
+    Version bis zum erfolgreichen Login der neuen Version zu kriegen.
+  - Bekannte Probleme die im testing auftraten dokumentieren.
+
+* doc/Lx-Office-Dokumentation.pdf erstellen
+ (TODO: commands)
+
+* scripts/rose_auto_create_model.pl update machen.
+
+  Das ist nicht ganz einfach, dafür gibt es keinen einfachen Knopf. Folgende
+  Constraints sollten eingehalten werden:
+
+  - Alle Datenbank Upgrades seit der letzten Version müssen eingepflegt werden.
+  - Alle noch nicht normalisierten Tabellen müssen weiterhin ignoriert werden.
+  - Alle Felder die von der crm, von bob, von lx-cars oder sonstwo in die
+    Datenbank gekommen sind, müssen ignoriert werden.
+  - Wenn die Reihenfolge der Spalten in der Datenbank moniert wird, dann sollte
+    das auch ignoriert werden. (Kann passieren, wenn DB Upgrades in
+    verschiedener Reihenfolge eingespielt werden.)
+  - Wenn Metastatements dazukommen, wie zum Beispiel
+    "allow_inline_column_values => 1," dann ist die Ausgabe der neusten
+    Rose::DB::Object Version zu wählen die kompatibel zu älteren Versionen
+    bleibt.
+
+  Zum Prüfen was sich geändert hat eignen sich folgende Befehle:
+
+  # listet alle Dateien in denen sich etwas Ändern würde
+  $ scripts/rose_auto_create_model.pl --user=<login> -n --all
+
+  # listet die entsprechenden Diffs:
+  $ scripts/rose_auto_create_model.pl --user=<login> --diff -n --all
+
+* SL::DB::Helper::ALL auf Vollständigkeit prüfen
+
+  (TODO: Mag da einer ein Script für schreiben?)
+
+* VERSION updaten
+
+  Zu den Versionierungen:
+
+  - Das Programm heißt Lx-Office (großes LO, mit Bindestrich dazwischen)
+  - Das Paket heißt lx-office-erp (klein, plus "-erp")
+  - Der Standardpfad ist lxoffice-erp-<version> (fehlender Bindestrich)
+  - Der git tag ist "release-<version>"
+  - Das DB Ipgradescript ist "release_<snake_case_version>"
+
+* Datenbankupgradescript "release_2_6_1" (mit aktueller Releasenummer)
+  erstellen und alle Leafscripte als Abhängigkeit einsetzen. Leafscripte
+  kriegt man mit
+
+  $ scripts/dbupgrade2_tool.pl --nodeps
+
+* Voraussichtliches finales Releasedatum im changelog eintragen
+
+* Finaler Testlauf:
+
+  t/test.sh
+
+  - Im Moment sind 4 Fehler optimal (die sind noch nicht angegangen):
+    o  bin/mozilla/ar.pl contains at least 190 html tags.
+    o  bin/mozilla/ic.pl contains at least 130 html tags.
+    o  bin/mozilla/ap.pl contains at least 183 html tags.
+    o  bin/mozilla/admin.pl DOES NOT use proper system or exec calls
+  - Einige Tests setzen eine korrekt aufgesetzte Datenbank für tests voraus.
+    TODO: diese Tests korrekt skippen wenn keine DB gefunden wurde.
+    TODO: Dokumeniteren wie der Releasemanager sich so eine DB baut, die
+          sollten vor einem Release zumindest durchlaufen.
+    TODO: Evtl eine Klasse von Releasetests einführen)
+
+* Alle Änderungen einchecken.
+
+
+
+2. RELEASE
+
+* Annotated tag erstellen und pushen
+
+  $ git tag -a release-2.6.1
+  $ git push origin tgs/release-2.6.1
+
+* Tarball erstellen
+
+  $ git archive --format=tar --remote=<master repo>        \
+        --prefix=lxoffice-erp-2.6.1/ release-2.6.1 | gzip  \
+        > lx-office-erp-2.6.1.tar.gz
+
+  (der trailing slash bei prefix ist wichtig)
+
+* Tarball testen, wird das richtig entpackt?
+
+* SHA1 und MD5 von tarball machen und in *.sha1 bzw. *.md5 speichern
+
+* Alles auf Sourceforge hochladen
+
+* Releasemessages schreiben für folgende Ziele:
+
+  - lx-office.org: deutsch, prosa, formell
+  - freshmeat.net: englisch, max 600 zeichen, technische stichpunkte aus dem changelog
+  - mailinglisten: deutsch, freitext, informell
+
+* Alle Releasemessages von mindestens einer Person Korrektur lesen lassen
+
+* Webseite aktualisieren, Releasemessages auf freshmeat und Mailinglisten posten
index 8b5a094..4228c58 100644 (file)
@@ -447,7 +447,6 @@ $self->{texts} = {
   'Create a new payment term'   => 'Neue Zahlungsbedingungen anlegen',
   'Create a standard group'     => 'Eine Standard-Benutzergruppe anlegen',
   'Create and edit RFQs'        => 'Lieferantenanfragen erfassen und bearbeiten',
-  'Create and edit customers and vendors' => 'Kunden und Lieferanten erfassen und bearbeiten',
   'Create and edit dunnings'    => 'Mahnungen erfassen und bearbeiten',
   'Create and edit invoices and credit notes' => 'Rechnungen und Gutschriften erfassen und bearbeiten',
   'Create and edit parts, services, assemblies' => 'Artikel, Dienstleistungen, Erzeugnisse erfassen und bearbeiten',
@@ -462,6 +461,8 @@ $self->{texts} = {
   'Create bank collection via SEPA XML' => 'Bankeinzug via SEPA XML erstellen',
   'Create bank transfer'        => 'Überweisung erstellen',
   'Create bank transfer via SEPA XML' => 'Überweisung via SEPA XML erzeugen',
+  'Create customers and vendors. Edit all vendors. Edit all customers' => 'Kunden und Lieferanten erfassen. Alle Lieferanten bearbeiten. Alle Kunden bearbeiten',
+  'Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)' => 'Kunden und Lieferanten erfassen. Alle Lieferanten bearbeiten. Nur Kunden bearbeiten bei denen der Verkäufer gleich Bearbeiter (login) ist',
   'Create invoice?'             => 'Rechnung erstellen?',
   'Create new'                  => 'Neu erfassen',
   'Create new business'         => 'Kunden-/Lieferantentyp erfassen',
@@ -731,7 +732,7 @@ $self->{texts} = {
   'Edit membership'             => 'Mitgliedschaft bearbeiten',
   'Edit note'                   => 'Notiz bearbeiten',
   'Edit payment term'           => 'Zahlungsbedingungen bearbeiten',
-  'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch gehackt werden).',
+  'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch umgangen werden)',
   'Edit rights'                 => 'Rechte bearbeiten',
   'Edit templates'              => 'Vorlagen bearbeiten',
   'Edit the Delivery Order'     => 'Lieferschein bearbeiten',
@@ -939,6 +940,7 @@ $self->{texts} = {
   'Include empty bins'          => 'Leere Lagerpl&auml;tze anzeigen',
   'Include in Report'           => 'In Bericht aufnehmen',
   'Include in drop-down menus'  => 'In Aufklappmenü aufnehmen',
+  'Include invalid warehouses ' => 'Ungültige Lager berücksichtigen',
   'Includeable in reports'      => 'In Berichten anzeigbar',
   'Including'                   => 'Enthaltene',
   'Income Statement'            => 'GuV',
@@ -1278,6 +1280,7 @@ $self->{texts} = {
   'Output Number Format'        => 'Zahlenformat (Ausgabe)',
   'Outputformat'                => 'Ausgabeformat',
   'Overdue sales quotations and requests for quotations' => 'Überfällige Angebote und Preisanfragen',
+  'Override invoice language'   => 'Diese Sprache verwenden',
   'PAYMENT POSTED'              => 'Rechung gebucht',
   'PDF'                         => 'PDF',
   'PDF (OpenDocument/OASIS)'    => 'PDF (OpenDocument/OASIS)',
index 4fc79c1..91b5d5d 100644 (file)
@@ -1180,6 +1180,7 @@ $self->{texts} = {
   'Output Number Format'        => '',
   'Outputformat'                => '',
   'Overdue sales quotations and requests for quotations' => '',
+  'Override invoice language'   => '',
   'Own Product'                 => '',
   'PAYMENT POSTED'              => '',
   'PDF'                         => '',
diff --git a/sql/Pg-upgrade2/auth_enable_ct_all_edit.pl b/sql/Pg-upgrade2/auth_enable_ct_all_edit.pl
new file mode 100644 (file)
index 0000000..0579675
--- /dev/null
@@ -0,0 +1,51 @@
+# @tag: auth_enable_ct_all_edit
+# @description: Zusätzliches Recht alle Kunden / Lieferanten editieren, war bisher standardmäßig IMMER so und kann jetzt deaktiviert werden
+#               falls es deaktiviert wird, kann ich den Kunden / Lieferanten nur editieren wenn ich selber als Verkäufer eingetragen bin
+# @depends: release_2_6_3
+# @charset: utf-8
+
+use utf8;
+use strict;
+use Data::Dumper;
+die("This script cannot be run from the command line.") unless ($main::form);
+
+sub mydberror {
+  my ($msg) = @_;
+  die($dbup_locale->text("Database update error:") .
+      "<br>$msg<br>" . $DBI::errstr);
+}
+
+sub do_update {
+  my $dbh   = $main::auth->dbconnect();
+  my $query = <<SQL;
+    SELECT id
+    FROM auth."group"
+    WHERE NOT EXISTS(
+      SELECT group_id
+      FROM auth.group_rights
+      WHERE (auth.group_rights.group_id = auth."group".id)
+        AND (auth.group_rights."right"  = 'customer_vendor_all_edit')
+    )
+SQL
+
+  my @group_ids = selectall_array_query($form, $dbh, $query);
+  if (@group_ids) {
+    $query = <<SQL;
+      INSERT INTO auth.group_rights (group_id, "right",          granted)
+      VALUES                        (?,        'customer_vendor_all_edit', TRUE)
+SQL
+    my $sth = prepare_query($form, $dbh, $query);
+
+    foreach my $id (@group_ids) {
+      do_statement($form, $sth, $query, $id);
+    }
+
+    $sth->finish();
+    $dbh->commit();
+  }
+
+  return 1;
+}
+
+return do_update();
+
diff --git a/templates/print/f-tex/balance_sheet.html b/templates/print/f-tex/balance_sheet.html
new file mode 100644 (file)
index 0000000..478caab
--- /dev/null
@@ -0,0 +1,100 @@
+
+<body bgcolor=ffffff>
+
+<h2 align=center>
+<%company%>
+<br><%address%>
+
+<p>BALANCE SHEET
+<br><%period%>
+</h2>
+
+<table border=0>
+<tr>
+  <th align=left width=400 colspan=2>ASSETS<br><hr align=left width=250 size=5 noshade></th>
+  <th><%this_period%></th>
+  <th><%last_period%></th>
+</tr>
+
+<%foreach asset_account%>
+<tr>
+  <td> </td>
+  <td><%asset_account%></td>
+  <td align=right><%asset_this_period%></td>
+  <td align=right><%asset_last_period%></td>
+</tr>
+<%end asset_account%>
+
+<tr>
+  <td colspan=2> </td>
+  <td><hr noshade size=1></td>
+  <td><hr noshade size=1></td>
+</tr>
+
+<tr valign=top>
+  <th align=left colspan=2>TOTAL ASSETS</th>
+  <td align=right><%total_assets_this_period%><hr noshade size=2></td>
+  <td align=right><%total_assets_last_period%><hr noshade size=2></td>
+</tr>
+
+<tr>
+  <th align=left colspan=4>LIABILITIES<b><hr align=left width=250 size=5 noshade></th>
+</tr>
+
+<%foreach liability_account%>
+<tr>
+  <td></td>
+  <td><%liability_account%></td>
+  <td align=right><%liability_this_period%></td>
+  <td align=right><%liability_last_period%></td>
+</tr>
+<%end liability_account%>
+
+<tr>
+  <td colspan=2> </td>
+  <td><hr noshade size=1></td>
+  <td><hr noshade size=1></td>
+</tr>
+
+<tr valign=top>
+  <td></td>
+  <th align=left>Total Liabilities</th>
+  <td align=right><%total_liabilities_this_period%><br><hr noshade size=2</td>
+  <td align=right><%total_liabilities_last_period%><br><hr noshade size=2</td>
+</tr>
+
+<tr>
+  <th align=left colspan=4>SHAREHOLDER'S EQUITY<br><hr align=left width=250 size=5 noshade></th>
+</tr>
+
+<%foreach equity_account%>
+<tr>
+  <td></td>
+  <td><%equity_account%></td>
+  <td align=right><%equity_this_period%></td>
+  <td align=right><%equity_last_period%></td>
+</tr>
+<%end equity_account%>
+
+<tr>
+  <td colspan=2> </td>
+  <td><hr noshade size=1></td>
+  <td><hr noshade size=1></td>
+</tr>
+
+<tr valign=top>
+  <td></td>
+  <th align=left>Total Equity</th>
+  <td align=right><%total_equity_this_period%><br><hr noshade size=2</td>
+  <td align=right><%total_equity_last_period%><br><hr noshade size=2</td>
+</tr>
+
+<tr valign=top>
+  <th align=left colspan=2>TOTAL LIABILITIES & EQUITY</th>
+  <td align=right><%total_this_period%><br><hr noshade size=2></td>
+  <td align=right><%total_last_period%><br><hr noshade size=2></td>
+</tr>
+</table>
+
+
+
index cbaed19..542f486 100644 (file)
 \newcommand{\transdate}{<%transdate%>}                     % Lieferscheindatum
 \newcommand{\terms}{<%terms%>}                             % Zahlungsfrist
 \newcommand{\duedate}{<%duedate%>}                         % Fälligkeitsdatum
-\newcommand{\invtotal}{<%invtotal%>}                       % Gesamtbetrag
-\newcommand{\paid}{<%paid%>}                               % Schon bezahlt
-\newcommand{\total}{<%total%>}                             % Restbetrag
-\newcommand{\subtotal}{<%subtotal NOFORMAT%>}                       % Restbetrag
+\newcommand{\invtotal}{<%invtotal NOFORMAT%>}              % Gesamtbetrag
+\newcommand{\paid}{<%paid NOFORMAT%>}                      % Schon bezahlt
+\newcommand{\total}{<%total NOFORMAT%>}                    % Restbetrag
+\newcommand{\subtotal}{<%subtotal NOFORMAT%>}              % Restbetrag
 \newcommand{\paymentterms}{<%payment_terms%>}              % Zahlungsbedingungen
 \newcommand{\paymentPrivatEnd}{E}                          % Endung bei Privatkunden
 \newcommand{\paymenttype}{<%payment_description%>}         % name der Zahlungs-art - fuer Steuerung brutto/netto
 %======Die eigentliche-Tabelle========================================
 
 % temporaere Datei mit Tabelle anlegen
-\begin{filecontents}{tabelle.tex}
+\begin{filecontents}{<%tmpfile%>.table.tex}
 \mainfont
 \resetlaufsumme
 
   }
 \end{filecontents}  % Ende der Hilfsdatei.
 
-\LTXtable{\textwidth}{tabelle.tex}
+\LTXtable{\textwidth}{<%tmpfile%>.table.tex}
 
 \rule{\textwidth}{0pt}   % Ein (unsichtbarer) Strich quer ueber die Seite
 \vspace{ 5mm}
diff --git a/templates/print/f-tex/income_statement.html b/templates/print/f-tex/income_statement.html
new file mode 100644 (file)
index 0000000..e9d6a40
--- /dev/null
@@ -0,0 +1,82 @@
+
+<body bgcolor=ffffff>
+
+<h2 align=center>
+<%company%>
+<br><%address%>
+
+<p>INCOME STATEMENT
+<br><%period%>
+</h2>
+
+
+<table width=100% border=0>
+<tr>
+  <th width=400 align=left colspan=2>INCOME<br><hr width=300 size=5 align=left noshade></th>
+  <th><%this_period%></th>
+  <th><%last_period%></th>
+</tr>
+
+<%foreach income_account%>
+<tr>
+  <td width=4> </td>
+  <td><%income_account%></td>
+  <td align=right><%income_this_period%></td>
+  <td align=right><%income_last_period%></td>
+</tr>
+<%end income_account%>
+
+<tr>
+  <td colspan=2> </td>
+  <td><hr noshade size=1></td>
+  <td><hr noshade size=1></td>
+</tr>
+
+<tr valign=top>
+  <td> </td>
+  <th align=left>Total Income</th>
+  <td align=right><%total_income_this_period%><hr noshade size=2></td>
+  <td align=right><%total_income_last_period%><hr noshade size=2></td>
+</tr>
+
+<tr>
+  <th align=left colspan=2>EXPENSES<br><hr width=300 size=5 align=left noshade></th>
+</tr>
+
+<%foreach expense_account%>
+<tr>
+  <td> </td>
+  <td><%expense_account%></td>
+  <td align=right><%expenses_this_period%></td>
+  <td align=right><%expenses_last_period%></td>
+</tr>
+<%end expense_account%>
+
+<tr>
+  <td colspan=2> </td>
+  <td><hr noshade size=1></td>
+  <td><hr noshade size=1></td>
+</tr>
+
+<tr valign=top>
+  <td> </td>
+  <th align=left>Total Expenses</th>
+  <td align=right><%total_expenses_this_period%><br><hr noshade size=2</td>
+  <td align=right><%total_expenses_last_period%><br><hr noshade size=2</td>
+</tr>
+
+<tr valign=top>
+  <th align=left colspan=2>INCOME / (LOSS)</th>
+  <td align=right><%total_this_period%><br><hr noshade size=2></td>
+  <td align=right><%total_last_period%><br><hr noshade size=2></td>
+</tr>
+
+</table>
+
+
+
+
+
+
+
+
diff --git a/templates/print/f-tex/setup.sh b/templates/print/f-tex/setup.sh
deleted file mode 100755 (executable)
index b557e80..0000000
+++ /dev/null
@@ -1,1082 +0,0 @@
-#!/bin/bash
-
-
-# Setup script fuer die Nutzung der fancy-LaTeX Umgebung oder
-# der Label-Print erweiterung (lp) in LX-Office-erp.
-# Welches Setup ist von der Position innerhalb des Dateisystems abhaengig.
-# Das Script kann auch nach erfolgtem Setup erneut aufgerufen werden
-
-#   see  ./setup.sh -h
-
-
-
-
-
-# Revision 0.2  (13.02.2011) add lp
-#                            setup add determination of company data
-# Revision 0.1  (19.12.2010) initial script create
-
-
-# config
-
-DB_AUTH='../../config/lx_office.conf'
-
-FILE_LIST_FTEX='
-   letter.tex
-   sample.lco
-   sample_head.pdf
-   translations.tex
-   xstring.sty
-   zwischensumme.sty
-'
-
-FILE_LIST_LP='
-   label_abs_a7_de.tex
-   label_nn_brief_a4_de.tex
-   zweckform_3427.tdf
-   zweckform_3483.tdf
-'
-
-
-DOC_TYPE_FTEX='
-   invoice
-   proforma
-   sales_quotation
-   sales_order
-   sales_delivery_order
-   credit_note
-   pick_list
-   purchase_order
-'
-
-
-LXO_DETERMINE='
-   ../../SL/Form.pm
-   ../../config/lx_office.conf.default
-   ../../doc/changelog
-'
-
-CHK_RAWNUMBER_PATCH='
-   ../../SL/DO.pm
-   ../../SL/IS.pm
-   ../../SL/OE.pm
-'
-
-MY_DATA='
-  employeecountry
-  labelcompanyname
-  labelbankname
-  labelbankcode
-  labelbankaccount
-  MYfromname
-  MYaddrsecrow
-  MYrechtsform
-  MYfromaddress
-  MYfromphone
-  MYfromfax
-  MYfromemail
-  MYsignature
-  MYustid
-  MYfrombank
-'
-
-BASE_DIR=`readlink -f $0 | sed 's/setup\.sh$//'`
-
-MODUL=`basename ${BASE_DIR}`
-export TEXINPUTS=".:${BASE_DIR}:"
-
-OK='...... [ok]'
-MARK='\033[1;34m'
-UNMARK='\033[0m'
-TIME=`date +%s`
-
-USAGE="\n\n  setup LaTeX templates for lx-office erp (www.lx-office.org)
-\n\n  USAGE: ./`basename $0` [OPTION] \n
-\n
-  -h print this Help\n
-\n
-\n
-  OPTIONS for trouble shooting:\n\n
-  -D don't connect to any database\n
-  -C no colored output (don't use any terminal escape character)\n
-\n\n
-  RECOMMENDED USE ./setup.sh
-
-\n
-"
-
-# script control
-
-DATABASE=1
-
-while getopts  "hDC" flag
-do
-  case $flag in
-    h)
-       echo -e ${USAGE}
-       exit
-       ;;
-    D)
-       DATABASE=0
-       ;;
-    C)
-       NO_COLOR=1
-       ;;
-  esac
-done
-
-# Disclaim
-
-cat << EOD
-
-   ##########################################################################
-   #                        Disclaimer                                      #
-   ##########################################################################
-   #                                                                        #
-   # Dies ist ein Script zum Einrichten von LaTeX Templates                 #
-   # (fancy-latex (f-tex)) oder (label-print (lp) fuer                      #
-   #                                                                        #
-   #      lx-office erp (www.lx-erp.org)                                    #
-   #                                                                        #
-   # Obwohl LX-Office sich an deutschsprachige Anwender richtet ist dieses  #
-   # Script in Englisch und soll auch nicht uebersetzt werden.              #
-   #                                                                        #
-   # * es richtet sich an System-Administratoren                            #
-   # * da es das Script nur in einer Sprache gibt, ist es viel leichter     #
-   #   bei Fehlern und Fehlermeldungen aus dem Script selbst, im Internet   #
-   #   nach Loesungen zu suchen.                                            #
-   #                                                                        #
-   ##########################################################################
-   #                                                                        #
-   # This script provides an easy to use setup for the fancy LaTeX          #
-   # environment of lx-office erp (templates/f-tex)                         #
-   #                                                                        #
-   # Normal use is to run ./setup.sh without any parameter. You may also    #
-   # check                                                                  #
-   #   ./setup.sh -h                                                        #
-   # for help.                                                              #
-   #                                                                        #
-   # The script tries to be as save as possible to avoid unwanted file      #
-   # overwriting by being very interactive. It's designed to be invoked     #
-   # multiple times inside the same template directory. So it is possible   #
-   # to rerun the script if there are updates available or after you break  #
-   # your LaTeX templates by any changes.                                   #
-   #                                                                        #
-   # I recommend to backup your installation and database before you run    #
-   # this script.                                                           #
-   #                                                                        #
-   # ANYHOW: I do not take responsibility for any harm initiated by this    #
-   #         script. (Wulf Coulmann -- scripts_at_gpl.coulmann.de)          #
-   #                                                                        #
-   ##########################################################################
-
-
-EOD
-
-QUESTION='  I understand the above warnings [YES/NO/Q]:'
-
-echo -n "${QUESTION} "
-
-
-[ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-read ANSWER
-[ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-
-
-until [ "${ANSWER}" = YES ]\
-        || [ "${ANSWER}" = NO ] \
-        || [ "${ANSWER}" = N ] \
-        || [ "${ANSWER}" = n ] \
-        || [ "${ANSWER}" = q ] \
-        || [ "${ANSWER}" = Q ] ; do
-   echo -n "${QUESTION} "
-   [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-   read ANSWER
-   [ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-done
-
-case ${ANSWER} in
-  YES)
-     echo -n '  accepted'
-  ;;
-  NO|n|N|q|Q)
-     echo
-     echo '  script aborted by user input'
-     exit 72
-  ;;
-esac
-
-
-FEEDBACK='################################\n  # FEEDBACK:\n
-'
-
-
-# load functions
-
-function error {
-  echo '[error]' ...... $1 ...... '[terminate script]'
-  exit 72
-}
-
-function mark {
-  [ "${NO_COLOR}" = 1 ] || echo -ne "${MARK}"
-  echo -n "${1}"
-  [ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-}
-
-
-
-function ask_yn {
-  local QUESTION=$1
-  until [ "${ANSWER}" = y ]\
-          || [ "${ANSWER}" = Y ] \
-          || [ "${ANSWER}" = j ] \
-          || [ "${ANSWER}" = J ] \
-          || [ "${ANSWER}" = n ] \
-          || [ "${ANSWER}" = N ] \
-          || [ "${ANSWER}" = Q ] \
-          || [ "${ANSWER}" = q ] ; do
-     echo -n "${QUESTION}"
-     read ANSWER
-  done
-
-  case ${ANSWER} in
-    y|Y|j|J)
-       return
-    ;;
-    n|N)
-       return
-    ;;
-    q|Q)
-       [ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-       echo
-       echo '  script aborted by user input'
-       exit 72
-    ;;
-  esac
-}
-
-function latex_pack_check {
-  echo '  -> search LaTeX package '$1' '
-  echo -n '    '
-  if [ ! `kpsewhich ${1}.sty` ] ; then
-    echo
-    echo "  can't find package ${1}"
-    echo "  on debian systems you may install apt-file"
-    echo "     aptitude install apt-file"
-    echo "     apt-file update"
-    echo "     apt-file search ${1}.sty"
-    echo "  this will show which package contains the needet LaTeX .sty file"
-    echo "  on other systems, please refer to their documentation on how to "
-    echo "  find matching packages."
-    echo
-    echo "  If you are done, rerun this script"
-    echo " [unsatisfied dependencies]' ...... ${1} ...... [terminate script]"
-    exit 72
-  else
-    echo \ \ ${OK}
-  fi
-
-}
-
-function check_accepted_names {
-  echo '  -> check for suspect characters in '${2}
-  echo -n ${1} | egrep '[^-_\.!A-Za-z0-9]' && echo '  [suspect characters found] in ... '${2}' ... [terminate script]' && exit 72
-}
-
-function check_int {
-  echo '  -> check for suspect characters in '${2}
-  echo -n ${1} | egrep '[^0-9]' && echo '  [suspect characters found] in ... '${2}' ... [terminate script]' && exit 72
-}
-
-function create_file {
-  ANSWER=0
-  if [ "${1}" = ln  ] ;then
-    DO=1
-    echo -n '  -> try to create symbolic link '${3}
-    if [ -e "${3}" ] ; then
-      if [ -L "${3}" ] ; then
-         if [ "`ls -l ${3} | awk '{print $10}'`" = "${2}" ]; then
-           echo ' ...  symbolic link already exists, nothing to do!'
-           DO=0
-         else
-           echo ' ...  symbolic link with different target exist!'
-           ls -lah "${3}"
-           echo '  you may'
-           echo '      [d] delete and replace the current link'
-           echo '      [m] move current link to '${3}.${TIME}.old
-           echo '      [s] skip -- leave it as it is'
-           echo '      [q] abort setup.sh'
-           QUESTION='  what do do? [d/m/s/q]: '
-           echo  -en ${QUESTION}
-           [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-           read ANSWER
-           [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-           until [ "${ANSWER}" = D ] \
-                   || [ "${ANSWER}" = d ] \
-                   || [ "${ANSWER}" = m ] \
-                   || [ "${ANSWER}" = s ] \
-                   || [ "${ANSWER}" = q ] ; do
-              echo -n "${QUESTION}"
-              read ANSWER
-           done
-
-           case ${ANSWER} in
-             d)
-                rm -f ${3}   || error ' unable to delete symbolic link '${3}
-             ;;
-             m)
-                mv -f ${3} ${3}.${TIME}.old   || error ' unable to move symbolic link '${3}
-             ;;
-             s)
-                echo '   as you decide, we leave it as it is!'
-                DO=0
-             ;;
-             q)
-                [ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-                echo
-                echo '  script aborted by user input'
-                exit 72
-             ;;
-           esac
-         fi
-      else
-        echo ' ...  file already exists where I tried to create a symbolic link!'
-          ls -lah "${3}"
-          echo '  you may'
-          echo '      [S] show the file (exit file display with "q")'
-          echo '      [m] move current file to '${3}.${TIME}.old
-          echo '      [d] delete and replace the file with symbolic link'
-          echo '      [s] skip -- leave it as it is'
-          echo '      [q] abort setup.sh'
-          QUESTION='what to do? [S/d/m/s/q]:'
-          echo  -en "  ${QUESTION} "
-          [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-          read ANSWER
-          [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-          until [ "${ANSWER}" = S ] \
-                  || [ "${ANSWER}" = d ] \
-                  || [ "${ANSWER}" = m ] \
-                  || [ "${ANSWER}" = s ] \
-                  || [ "${ANSWER}" = q ] ; do
-             echo -n "  ${QUESTION} "
-             read ANSWER
-          done
-
-          case ${ANSWER} in
-            S)
-              echo
-              echo
-              less "${3}"
-              echo
-              echo
-              create_file "${1}" "${2}" "${3}"
-              return
-            ;;
-            m)
-               mv -f ${3} ${3}.${TIME}.old   || error ' unable to move file '${3}
-            ;;
-            d)
-               rm -f ${3}    || error ' unable to delete file '${3}
-            ;;
-            s)
-               echo '   as you decide, we leave it as it is!'
-               DO=0
-            ;;
-            q)
-               [ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-               echo
-               echo '  script aborted by user input'
-               exit 72
-            ;;
-          esac
-      fi
-    fi
-    if [ "${DO}" = "1" ] ;then  ln -s "${2}" "${3}" || error ' failed to create symbolic link '${3} ; fi
-    [ "${DO}" = "1" ] && echo \ \ ${OK}
-  fi
-
-  if [ "${1}" = cp  ] ;then
-    echo -n '  -> try to copy file '${3}
-       DO=1
-    if [ -e "${3}" ] ; then
-       echo ' ...  file already exists!'
-       diff "${2}" "${3}" >/dev/null
-       if [ "$?" = 0 ] ; then
-         echo '   files are equal, we leave it as it is!'
-         DO=0
-       else
-         ls -lah "${3}"
-         echo '  you may'
-         echo '      [D] show a diff between the new and current file'
-         echo '      [m] move current file to '${3}.${TIME}.old
-         echo '      [d] delete and replace with new file'
-         echo '      [s] skip -- leave it as it is'
-         echo '      [q] abort setup.sh'
-         QUESTION='what to do? [D/m/d/s/q]:'
-         echo  -en "  ${QUESTION} "
-         [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-         read ANSWER
-         [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-         until [ "${ANSWER}" = D ] \
-                 || [ "${ANSWER}" = d ] \
-                 || [ "${ANSWER}" = m ] \
-                 || [ "${ANSWER}" = s ] \
-                 || [ "${ANSWER}" = q ] ; do
-            echo -n "  ${QUESTION} "
-            read ANSWER
-         done
-
-         case ${ANSWER} in
-           D)
-             echo
-             echo
-             [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-             echo '---------------------------------------'
-             [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-             diff -C 3  "${2}" "${3}"
-             [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-             echo '---------------------------------------'
-             [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-             echo
-             echo
-             create_file "${1}" "${2}" "${3}"
-           ;;
-           m)
-              mv -f ${3} ${3}.${TIME}.old   || error ' unable to move file '${3}
-           ;;
-           d)
-              rm -f ${3}    || error ' unable to delete file '${3}
-           ;;
-           s)
-              echo '   as you decide, we leave it as it is!'
-              DO=0
-           ;;
-           q)
-              [ "${NO_COLOR}" = 1 ] || echo -ne "${UNMARK}"
-              echo
-              echo '  script aborted by user input'
-              exit 72
-           ;;
-         esac
-       fi
-    fi
-    if [ "${DO}" = "1" ] ;then  cp  "${2}" "${3}" || error ' failed to copy '${3} ; fi
-    [ "${DO}" = "1" ] && echo \ \ ${OK}
-  fi
-
-}
-
-function create_mydata {
-
-  VALUE=${1}
-  DB=${2}
-  NODATA='  did not get a value corresponding to your template dir'
-
-  SQL="
-    SELECT regexp_replace( u1.cfg_value, E'\n' ,E'\\\\\\\\\\\\' || E'\n')
-    FROM auth.user_config u1, auth.user_config u2
-    WHERE u1.user_id = u2.user_id
-      AND u1.cfg_key = '"${DB}"'
-      AND u2.cfg_key = 'templates'
-      AND u2.cfg_value = 'templates/"${TEMP_DIR}"'
-   ORDER BY u1.cfg_value  DESC
-   LIMIT 1;
-  "
-  case ${DB} in
-    tel)
-      PRE='Tel:'
-      ;;
-    fax)
-      PRE='fax:'
-      ;;
-    co_ustid)
-      if [ ! `psql --pset tuples_only -h "${PGHOST}" -U "${PGUSER}" "${PGDATABASE}" -c "${SQL}"`"" ] ; then
-        SQL="
-          SELECT regexp_replace( u1.cfg_value, E'\n' ,E'\\\\\\\\\\\\' || E'\n')
-          FROM auth.user_config u1, auth.user_config u2
-          WHERE u1.user_id = u2.user_id
-            AND u1.cfg_key = 'taxnumber'
-            AND u2.cfg_key = 'templates'
-            AND u2.cfg_value = 'templates/"${TEMP_DIR}"'
-         ORDER BY u1.cfg_value  DESC
-         LIMIT 1;
-        "
-        PRE='StNr.:'
-      else
-        PRE='UstIdNr:'
-      fi
-      ;;
-    *)
-      PRE=''
-      ;;
-    esac
-
-
-
-  if [ "${2}" ] ; then
-    ANSWER=`psql --pset tuples_only -h "${PGHOST}" -U "${PGUSER}" "${PGDATABASE}" -c "${SQL}"`  || error "unable to connect to auth db"
-    if [ ! "${VALUE}" ] ; then
-      echo '  please fix this later'
-      ANSWER=FIX_ME
-    else
-      echo '  found: '${ANSWER}
-    fi
-  else
-    if [ ! "${2}" ]  && [ ${1} = "employeecountry" ] ; then
-      read ANSWER
-    else
-      echo '  please fix this later'
-      ANSWER=FIX_ME
-    fi
-  fi
-
-  echo -e "\0134"'newcommand{'"\0134"${VALUE}'}{'${PRE}${ANSWER}'}' >> mydata.tex
-
-}
-
-function read_db_conf {
-
-  perl -e 'use Config::Std;
-           read_config "'${DB_AUTH}'.default" => my %config_default;
-           my $val_default = $config_default{"authentication/database"}{'${1}'};
-           read_config "'${DB_AUTH}'" => %config;
-           my $val =  $config{"authentication/database"}{'${1}'} if $config{"authentication/database"}{'${1}'};
-           if ( $val ) {
-              print $val;
-           }else{
-              print $val_default;
-           }'
-
-}
-
-
-
-
-
-# check for dependencies
-echo  -n '  -> search kpsewhich '
-  which kpsewhich >/dev/null
-  [ "$?" = 0 ] || error 'unable find programm "kpsewhich" -- is there a propper installed LaTeX? (on debian: aptitude install texlive-base-bin)'
-  echo \ \ ${OK}
-
-if [ "${MODUL}" = "f-tex" ] ; then
-  echo '  -> search LaTeX documentclass scrlttr2'
-  echo -n '    '
-  if [ ! `kpsewhich scrlttr2.cls` ] ; then
-    echo
-    echo "  can't find documentclass scrlttr2"
-    echo "  on debian systems you may install it by"
-    echo "     aptitude install texlive-latex-recommended"
-    echo "  on other systems, please refer to their documentation how to find"
-    echo "  matching packages."
-    echo
-    echo "  If you are done, rerun this script"
-    echo " [unsatisfied dependencies]' ...... documentclass scrlttr2 ...... [terminate script]"
-    exit 72
-  else
-    echo \ \ ${OK}
-  fi
-elif [ "${MODUL}" = "lp" ] ; then
-  echo '  -> search LaTeX package ticket and check vor needed version '
-  echo -n '    '
-  HOLD_TEXINPUTS=${TEXINPUTS}
-  export TEXINPUTS=''
-  if [ `kpsewhich ticket.sty` ] ; then
-    grep rowmode `kpsewhich ticket.sty` > /dev/null
-    if [ "$?" -gt "0" ] ;then
-      FILE_LIST_LP=${FILE_LIST_LP}" ticket.sty"
-      echo \ \ "your version of LaTeX Package ticket does not support rowmode - we use our own ticket.sty"
-      echo \ \ \ \ \ \ "ticket.sty supports option rowmode from version v0.4b"
-      echo \ \ \ \ \ \ ${OK}
-    fi
-  else
-      FILE_LIST_LP=${FILE_LIST_LP}" ticket.sty"
-      echo \ \ "can't find LaTeX Package ticket, but we use our own ticket.sty because we need version => v0.4b"
-      echo \ \ \ \ \ \ "ticket.sty supports option rowmode from version v0.4b"
-      echo \ \ \ \ \ \ ${OK}
-  fi
-  export TEXINPUTS=${HOLD_TEXINPUTS}
-else
-  error  "no valid install modul - is the install script inside ~/templates/f-tex or ~/templates/lp ?"
-fi
-
-for PACK in `grep usepackage ${BASE_DIR}/*.tex ${BASE_DIR}/*.sty ${BASE_DIR}/*.lco |awk -F '{' '{print $2}'|awk -F '}' '{print $1}'| sort | uniq`; do
-   latex_pack_check ${PACK}
-done
-
-
-# decide the installation target (template directory)
-echo -n '  -> cd to base directory: '${BASE_DIR}' '
-
-  cd ${BASE_DIR} || error  "unable to change directory"
-  echo \ \ ${OK}
-
-
-
-echo '  -> check if we are inside an lxo installation'
-
-if [ ! -e ../../SL/Form.pm ] ; then
-
-  dpkg -l | grep lx-office-erp | egrep '^ii'
-  if [ "$?" = 0 ] ; then
-    echo '   seams like this is a Debian-package'
-    DB_AUTH='/etc/lx-office-erp/lx_office.conf'
-
-    LXO_DETERMINE='
-       /usr/lib/lx-office-erp/SL/Form.pm
-       /etc/lx-office-erp/lx_office.conf.default
-       /usr/share/doc/lx-office-erp/changelog
-    '
-
-    CHK_RAWNUMBER_PATCH='
-       /usr/lib/lx-office-erp/SL/DO.pm
-       /usr/lib/lx-office-erp/SL/IS.pm
-       /usr/lib/lx-office-erp/SL/OE.pm
-    '
-
-  fi
-
-fi
-
-for now in ${LXO_DETERMINE} ; do
-  [ -e ${now} ] || error 'missing '${now}', do not run this script outside an lx-office installation!. Is setup.sh located inside an lxo installation in templates/'${MODUL}'?'
-done
-echo \ \ ${OK}
-
-if [ "${MODUL}" = "f-tex" ] ; then
-  echo   '  -> search raw numbers patch '
-     RAW_NUM=`egrep -oh '\{[^{]*_nofmt\}' ${CHK_RAWNUMBER_PATCH} |wc -l`
-
-     if [ "${RAW_NUM}" -lt 20 ] ; then
-       echo '  did not find the raw_number values'
-       echo
-       egrep -oh '\{[^{]*_nofmt\}' ${CHK_RAWNUMBER_PATCH}
-       echo '  seems like you added fancy LaTeX separate and needed raw_number values are missing'
-       echo '  this is already part of the dev-source code.'
-       echo '  please use this script in the environment you got it from'
-       error 'missing raw_number values'
-     fi
-    echo \ \ ${OK}
-fi
-
-
-if [ ${DATABASE} = 1 ] ; then
-
-  echo  '  -> request Auth-DB '
-    [ -r ${DB_AUTH} ] || [ -r ${DB_AUTH}.default ]  || error "unable to read ${DB_AUTH} or ${DB_AUTH}.default -- you must be able to read db credentials"
-
-    export PGDATABASE=`read_db_conf db`
-    check_accepted_names ${PGDATABASE} database_name
-    export PGPASSWORD=`read_db_conf password`
-    check_accepted_names ${PGPASSWORD} database_pw
-    export PGUSER=`read_db_conf user`
-    check_accepted_names ${PGUSER} database_user
-    export PGPORT=`read_db_conf port`
-    [ "${#PGPORT}" -lt 1 ] && PGPORT=5432
-    check_int ${PGPORT} database_port
-    export PGHOST=`read_db_conf host`
-    [ "${#PGHOST}" -lt 1 ] && PGHOST=localhost
-    check_accepted_names ${PGHOST} database_host
-
-    SQL="
-         SELECT
-           substring(cfg_value from E'[^/]*$') as template_dir
-         FROM auth.user_config
-         WHERE cfg_key = 'templates'
-         GROUP BY cfg_value ;
-    "
-
-
-  echo  '  -> search active template dirs '
-  echo
-  [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-
-    psql --pset tuples_only -h "${PGHOST}" -U "${PGUSER}" "${PGDATABASE}" -c "${SQL}"  || error "unable to connect to auth db"
-
-  [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-  echo  '  I found the above listed template directorys in '`mark '[lxo-home]/templates'`' by requesting your user configuration.'
-  echo  '  in database '`mark "${PGDATABASE}"`'.'
-fi
-
-echo  '  Type in which template directory to use (by typing in a name)'
-echo  '  * if template_dir does not exist, it will be created'
-echo  '  * template_dir must also be configured in your user administration'
-echo  '    to make it active.'
-echo
-echo  -en '  type name of template dirctory: '
-[ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-read TEMP_DIR
-[ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-
-
-[ "${#TEMP_DIR}" -gt 0 ] || error 'no value for template dir provided '
-
-
-if [ -d "../${TEMP_DIR}" ] ; then
-  MV_DIR=${TEMP_DIR}.${TIME}.old
-  echo
-  [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-  ls -lah ../${TEMP_DIR}
-  [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-  echo
-  echo '  the directory already exists and contains the above listed files'
-  echo '  you can:'
-  echo -e '    - move the directory to '`mark "templates/${MV_DIR}"`' and create a empty one, or'
-  echo '    - install the templates in the existing directory by interactive overwriting existing files'
-  echo
-  ask_yn '  move templates/'${TEMP_DIR}' to templates/'${MV_DIR}'? [y/n/q]: '
-
-
-
-  if [ "${ANSWER}" = y ] ; then
-     echo  '  -> check for permission to move template directory '
-     mv -i ../${TEMP_DIR} ../${MV_DIR} || error "unable to move directory "
-     echo -n '  -> original directory moved to '${MV_DIR}
-     echo \ \ ${OK}
-  fi
-  if [ "${ANSWER}" = n ] ; then
-     echo  '  -> check for permission to write in template directory [lxo-home]/templates/'${TEMP_DIR}
-     [ -w ../${TEMP_DIR} ] || error "no permission to write directory "
-     echo \ \ ${OK}
-  fi
-  ANSWER=0
-fi
-
-
-if [ ! -d "../${TEMP_DIR}" ] ; then
-  echo -n '  -> check for permission to create new template directory '
-      mkdir "../"${TEMP_DIR} || error "unable to write to `echo ${PWD} | sed 's/\/'${MODUL}'$//'` -- you must be able to write in ~/templates "
-  echo \ \ ${OK}
-  echo -n '  -> '${TEMP_DIR}' created'
-  echo \ \ ${OK}
-fi
-
-echo -n '  -> cd to template directory: '${TEMP_DIR}' '
-
-  cd ../${TEMP_DIR} || error  "unable to change directory"
-  echo \ \ ${OK}
-pwd
-
-
-if [ -e mydata.tex ] ;then
-  echo '  -> check mydata.tex'
-    grep koma ./mydata.tex && FEEDBACK=${FEEDBACK}'   # looks like a DEPRECATED mydata.tex -- please compare to f-tex/mydata.tex.example  \n'
-  for now in ${MY_DATA} ; do
-    grep ${now} ./mydata.tex || FEEDBACK=${FEEDBACK}'   # missing '${now}' in mydata.tex -- please compare to f-tex/mydata.tex.example  \n'
-  done
-
-  echo -e  \ \ "your current mydata.tex looks like"
-  [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-  cat mydata.tex
-  [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-
-else
-  if [ ${DATABASE} = 1 ] ; then
-    # mydata voodooo goes here
-    SQL="
-      SELECT
-       u1.cfg_value as company,
-       u2.cfg_value as address,
-       u3.cfg_value as tel,
-       u4.cfg_value as fax,
-       u5.cfg_value as texnumber,
-       u6.cfg_value as co_ustid
-     FROM
-       auth.user_config u1,
-       auth.user_config u2,
-       auth.user_config u3,
-       auth.user_config u4,
-       auth.user_config u5,
-       auth.user_config u6
-     WHERE
-       u1.user_id = u2.user_id  and
-       u2.user_id = u3.user_id and
-       u3.user_id = u4.user_id and
-       u4.user_id = u5.user_id and
-       u5.user_id = u6.user_id and
-       u1.cfg_key = 'company' and
-       u2.cfg_key = 'address' and
-       u3.cfg_key = 'tel' and
-       u4.cfg_key = 'fax' and
-       u5.cfg_key = 'taxnumber' and
-       u6.cfg_key = 'co_ustid'
-     GROUP BY
-       u1.cfg_value,
-       u2.cfg_value,
-       u3.cfg_value,
-       u4.cfg_value,
-       u5.cfg_value,
-       u6.cfg_value
-     ORDER BY
-       company;
-    "
-#    [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-#
-#      psql -h "${PGHOST}" -U "${PGUSER}" "${PGDATABASE}" -c "${SQL}"  || error "unable to connect to auth db"
-#
-#    [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-    echo  '  There is no mydata.tex, we try to create it'
-    echo  '  please answer the following questions'
-    echo -n '  - country your company is located eg:"Deutschland" : '
-    create_mydata employeecountry
-    echo  '  - owner of the bankaccount for label print'
-    echo  '    used for "pay on delivery (Nachnahme)"'
-    echo -n '    type ~ instead of blanks eg: "Herbert~Wichtig" : '
-    create_mydata labelcompanyname
-    echo  '  - name of the bank for label print'
-    echo  '    used for "pay on delivery (Nachnahme)"'
-    echo -n '    type ~ instad of blanks eg: "Ensifera~Bank" : '
-    create_mydata labelbankname
-    echo  '  - bank account number for label print'
-    echo  '    used for "pay on delivery (Nachnahme)"'
-    echo -n '    no blanks eg: "123456789" : '
-    create_mydata labelbankcode
-    echo  '  - bank code (BLZ) for label print'
-    echo  '    used for "pay on delivery (Nachnahme)'
-    echo -n '    no blanks eg: "10010010" : '
-    create_mydata labelbankaccount
-    echo  '  - company name for dokuments'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo -n '    eg: "Die globalen Problemlöser" : '
-    create_mydata MYfromname company
-    echo  '  - company name second row for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo -n '    eg: "Gesellschaft für anderer Leute Sorgen mbH" : '
-    create_mydata MYaddrsecrow
-    echo  '  - legal form for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo  '    eg: "Handelsregister: HRA 123456789" : '
-    echo -n '    or: "Inhaber Herbert Wichtig" : '
-    create_mydata MYrechtsform
-    echo  '  - company address for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo  '    multirow, type \\ as row dilimiter '
-    echo -n '    eg: "Hauptstraße 5\\12345 Hier" : '
-    create_mydata MYfromaddress address
-    echo  '  - tel for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo -n '    eg: "Tel: +49 (0)12 3456780" : '
-    create_mydata MYfromphone tel
-    echo  '  - fax for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo -n '    eg: "Fax: +49 (0)12 3456781" : '
-    create_mydata MYfromfax fax
-    echo  '  - email for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo -n '    eg: "mail@g-problemloeser.com" : '
-    create_mydata MYfromemail
-    echo  '  - signatur for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo -n '    eg: "Herbert Wichtig - Geschäftsführer" : '
-    create_mydata MYsignature
-    echo  '  - tax number for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo  '    it is common to use ustid but if you have none'
-    echo  '    type in your main tax number'
-    echo  '    eg: "UstID: DE 123 456 789" : '
-    echo -n '    or: "StrNr: 12/345/6789" : '
-    create_mydata MYustid co_ustid
-    echo  '  - bank account for documents'
-    echo  '    used for invoice, sales_quotation, etc.'
-    echo  '    multirow, type \\ as row delimiter '
-    echo -n '    eg: "Bankverbindung\\Ensifera Bank\\Kto 1234567800\\BLZ 123 456 78" : '
-    create_mydata MYfrombank
-
-     # damn escaping -- gnarf
-     perl -pi -e 's/([^\$\{])\\/$1\\\\/g' mydata.tex
-     perl -pi -e 's/([\&\%])/\\$1/g' mydata.tex
-  else
-    cp ../f-tex/mydata.tex.example mydata.tex
-    FEEDBACK=${FEEDBACK}'   # I generate a mydata.tex please edit this file to match to your needs \n'
-  fi
-    FEEDBACK=${FEEDBACK}'   # I generate a mydata.tex please edit this file to match to your needs \n'
-fi
-
-
-if [ "${MODUL}" = "f-tex" ] ; then
-  # search for installed languages
-  if [ ${DATABASE} = 1 ] ; then
-    SQL="
-    SELECT
-      u1.cfg_value || ';' ||
-      u2.cfg_value || ';' ||
-      u3.cfg_value || ';' ||
-      u4.cfg_value || ';' ||
-      u5.cfg_value
-    FROM
-      auth.user_config u1,
-      auth.user_config u2,
-      auth.user_config u3,
-      auth.user_config u4,
-      auth.user_config u5
-    WHERE
-      u1.user_id = u2.user_id  and
-      u2.user_id = u3.user_id and
-      u3.user_id = u4.user_id and
-      u4.user_id = u5.user_id and
-      u1.cfg_key = 'dbname' and
-      u2.cfg_key = 'dbhost' and
-      u3.cfg_key = 'dbport' and
-      u4.cfg_key = 'dbuser' and
-      u5.cfg_key = 'dbpasswd'
-    GROUP BY
-      u1.cfg_value,
-      u2.cfg_value,
-      u3.cfg_value,
-      u4.cfg_value,
-      u5.cfg_value;
-    "
-
-    echo  '  -> try to determine aktive languages ....'
-    echo  '  -> search database '${PGDATABASE}' to find lxo-erp databases ....'
-
-      DBS=`psql --pset tuples_only -h "${PGHOST}" -U "${PGUSER}" "${PGDATABASE}" -c "${SQL}"`  || error "unable to connect to auth db"
-
-    for db in ${DBS} ; do
-
-      PGDATABASE=`echo -n ${db} | awk -F ';' '{print $1}'`
-      echo -e '  -> prepare to request db '`mark ${PGDATABASE}`
-      check_accepted_names ${PGDATABASE} database_name
-      PGHOST=`echo -n ${db} | awk -F ';' '{print $2}'`
-      [ "${#PGHOST}" -lt 1 ] && PGHOST=localhost
-      check_accepted_names ${PGHOST} database_host
-      PGPORT=`echo -n ${db} | awk -F ';' '{print $3}'`
-      [ "${#PGPORT}" -lt 1 ] && PGPORT=5432
-      check_int ${PGPORT} database_port
-      PGUSER=`echo -n ${db} | awk -F ';' '{print $4}'`
-      check_accepted_names ${PGUSER} database_user
-      PGPASSWORD=`echo -n ${db} | awk -F ';' '{print $5}'`
-      check_accepted_names ${PGPASSWORD} database_pw
-      DELCHECK=`echo -n ${db} | awk -F ';' '{print $6}'`
-      [ "${#DELCHECK}" = 0 ] || error 'field delimiter conflict: there may be a ";" in one of your database definitions (db/host/port/user/pw)'
-      SQL="SELECT template_code FROM language ;"
-      echo \ \ ${OK}
-      RES=`psql --pset tuples_only -h "${PGHOST}" -U "${PGUSER}" "${PGDATABASE}" -c "${SQL}"`  || error "unable to connect to db "${PGDATABASE}
-      echo -e '  -> found '`mark "${RES}"`
-      echo \ \ ${OK}
-      LANGS=${LANGS}' '${RES}
-    done
-
-    LANGS=`echo ${LANGS} | sed 's/\ /\n/g'|sort | uniq`
-    echo '  -> join language codes ...'
-    echo
-    echo
-    [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-    echo -e '    '${LANGS}
-    [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-    echo
-    echo  '  I found the above listed language template_codes (see: System -> Languages -> List Languages)'
-    echo  '  - you may add more template_codes by type in a [space] seperated list (e.g.: ru it fr)'
-    echo  '  - or you may replace it with your own values by type in a [space] seperated list (e.g.: ru it fr)'
-    ask_yn '  add template_codes? [y/n/q]: '
-
-    if [ "${ANSWER}" = y ] ; then
-       echo -n '  type [space] seperated template_code list to add to current values: '
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-       read TMP_CO
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-       echo -n '  list of template_codes is now: '
-       LANGS=${LANGS}' '${TMP_CO}
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-       echo -e '    '${LANGS}
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-       echo \ \ ${OK}
-    fi
-    ANSWER=0
-
-    ask_yn '  replace the current template_codes? [y/n/q]: '
-
-    if [ "${ANSWER}" = y ] ; then
-       echo -n '  type [space] seperated template_code list to replace current values: '
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-       read TMP_CO
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-       echo -n '  list of template_codes is now: '
-       LANGS=${TMP_CO}
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-       echo -e '    '${LANGS}
-       [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-       echo \ \ ${OK}
-    fi
-    ANSWER=0
-  else
-     echo -n '  type [space] seperated template_code list (see: System -> Languages -> List Languages eg: de en fr): '
-     [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-     read TMP_CO
-     [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-     echo -n '  list of template_codes is now: '
-     LANGS=${TMP_CO}
-     [ "${NO_COLOR}" = 1 ] || echo -ne ${MARK}
-     echo -e '    '${LANGS}
-     [ "${NO_COLOR}" = 1 ] || echo -ne ${UNMARK}
-     echo \ \ ${OK}
-  fi
-
-  echo
-  echo
-  echo -e '  your current language template_codes are: '`mark "${LANGS}"`
-  echo
-  echo
-
-  # copy files and create links
-
-
-
-  for now in ${FILE_LIST_FTEX} ; do
-    create_file cp ../f-tex/${now} ${now}
-  done
-
-  for now in ${LANGS} ; do
-    echo -n '  -> check if language code '${now}' is present in translations.tex'
-    egrep '^[^%]*\\IfEndWith{\\docname}{_'${now}'}' translations.tex  > /dev/null
-    if [ "$?" -gt 0 ] ;then
-      HINT='  edit '${TEMP_DIR}'/translations.tex -- no representation of template_code '${now}
-      echo '  [warning] '${HINT}
-      FEEDBACK=${FEEDBACK}'   # '${HINT}'\n'
-    fi
-    echo \ \ ${OK}
-  done
-
-
-  for doc in ${DOC_TYPE_FTEX} ; do
-    create_file ln  ./letter.tex ./${doc}.tex
-    for now in ${LANGS} ; do
-      create_file ln ./letter.tex  ./${doc}_${now}.tex
-    done
-  done
-
-  create_file ln  ./sample_head.pdf ./letter_head.pdf
-  create_file ln  ./sample.lco ./letter.lco
-
-fi
-
-
-
-if [ "${MODUL}" = "lp" ] ; then
-
-  for now in ${FILE_LIST_LP} ; do
-    create_file cp ../lp/${now} ${now}
-  done
-
-fi
-
-echo
-echo
-echo -en ' '${FEEDBACK}
-echo -e ' ################################'
-echo
-echo '  If there are warnings listed in the feedback box above'
-echo '  this is totally ok if you know what you do'
-echo
-echo '  done -> enjoy'
-echo '  ### please check "settings" in '`pwd`'letter.lco '
-
-
-# company
-# address
-# co_ustid
-# email
-# taxnumber
-# tel
-# fax
index 0f452a4..f3eca31 100644 (file)
@@ -1,7 +1,11 @@
 [%- USE T8 %]
 [% USE HTML %]  <input type="hidden" name="rowcount" value="[% rowcount %]">
 
-  <p>[% PRINT_OPTIONS %]</p>
+  <p>
+    <input type="checkbox" name="force_lang" size="6" value="1" onclick="document.getElementsByName('language_id')[0].disabled = !document.getElementsByName('force_lang')[0].checked;">
+    [% 'Override invoice language' | T8 %]
+    [% PRINT_OPTIONS %]
+  </p>
 
   <p>
    [% 'Dunnings' | $T8 %]<br>
index cd8c434..2f99cc6 100644 (file)
@@ -4,7 +4,8 @@
 [% L.javascript_tag('jquery.checkall') %]
 [% SET all_active = 1 %][% FOREACH row = DUNNINGS %][% IF !row.active %][% SET all_active = 0 %][% LAST %][% END %][% END %]
 [% SET all_email = 1 %][% FOREACH row = DUNNINGS %][% IF !row.email %][% SET all_email = 0 %][% LAST %][% END %][% END %]
-<body>
+<body [% IF onload %] onload="[% onload %]"[% END %]>
+
  <script type="text/javascript" src="js/common.js"></script>
  <script type="text/javascript" src="js/dunning.js"></script>
 
@@ -28,6 +29,7 @@
    </th>
 
    <th class="listheading">[% 'Customername' | $T8 %]</th>
+   <th class="listheading">[% 'Language' | $T8 %]</th>
    <th class="listheading">[% 'Invno.' | $T8 %]</th>
    <th class="listheading">[% 'Invdate' | $T8 %]</th>
    <th class="listheading">[% 'Inv. Duedate' | $T8 %]</th>
@@ -57,6 +59,7 @@
      <td><input type="checkbox" name="active_[% loop.count %]" value="1" [% IF row.active %]checked[% END %]></td>
      <td><input type="checkbox" name="email_[% loop.count %]" value="1" [% IF row.email %]checked[% END %]></td>
      <td><input type="hidden" name="customername_[% loop.count %]" size="6" value="[% HTML.escape(row.customername) %]">[% HTML.escape(row.customername) %]</td>
+     <td><input type="hidden" name="language_id_[% loop.count %]" size="6" value="[% HTML.escape(row.language_id) %]">[% HTML.escape(row.language) %]</td>
      <td>
       <input type="hidden" name="invnumber_[% loop.count %]" size="6" value="[% HTML.escape(row.invnumber) %]">
       <a href="is.pl?action=edit&type=invoice&id=[% row.id | url %]">[% HTML.escape(row.invnumber) %]</a>
@@ -74,6 +77,8 @@
 
   <hr size=3 noshade>
 
+  <input type="checkbox" name="force_lang" size="6" value="1" onclick="document.getElementsByName('language_id')[0].disabled = !document.getElementsByName('force_lang')[0].checked;">
+  [% 'Override invoice language' | T8 %]
   [% PRINT_OPTIONS %]
 
   <br>
index 8b2d253..8c6250e 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE T8 %]
-[% USE HTML %]<body>
+[% USE HTML %]<body[% IF onload %] onload="[% onload %]"[% END %]>
 
  <style type="text/css">
   <!--
index a5cbe12..53d0842 100644 (file)
         <td nowrap><label for="subtotal">[% 'Subtotal' | $T8 %]</label></td>
         <td align="right"><input name="include_empty_bins" id="include_empty_bins" class="checkbox" type="checkbox" value="Y"></td>
         <td nowrap><label for="include_empty_bins">[% 'Include empty bins' | $T8 %]</label></td>
+        <td align="right"><input name="include_invalid_warehouses" id="include_invalid_warehouses" class="checkbox" type="checkbox" value="Y"></td>
+        <td nowrap><label for="include_invalid_warehouses">[% 'Include invalid warehouses ' | $T8 %]</label></td>
        </tr>
 
        <tr>