Vorauswahl der Sprache fuer Kunden in defaults
authorBernd Blessmann <bibi@online.de>
Thu, 28 Jul 2011 10:21:28 +0000 (12:21 +0200)
committerG. Richardson <information@lx-office-hosting.de>
Mon, 1 Aug 2011 11:57:16 +0000 (13:57 +0200)
SL/AM.pm
SL/DB/MetaSetup/Default.pm
bin/mozilla/am.pl
bin/mozilla/ct.pl
sql/Pg-upgrade2/defaults_add_language_id.sql [new file with mode: 0644]
templates/webpages/am/edit_defaults.html
templates/webpages/ct/form_header.html

index 1501b22..ab983b7 100644 (file)
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -1065,7 +1065,8 @@ sub save_defaults {
         pdonumber          = ?,
         curr               = ?,
         businessnumber     = ?,
-        weightunit         = ?|;
+        weightunit         = ?,
+        language_id        = ?|;
   my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno},
                 $accnos{fxgain_accno},    $accnos{fxloss_accno}, $accnos{ar_paid_accno},
                 $form->{invnumber},       $form->{cnnumber},
@@ -1075,7 +1076,8 @@ sub save_defaults {
                 $form->{articlenumber},   $form->{servicenumber},
                 $form->{sdonumber},       $form->{pdonumber},
                 $currency,
-                $form->{businessnumber},  $form->{weightunit});
+                $form->{businessnumber},  $form->{weightunit},
+                $form->{language_id});
   do_query($form, $dbh, $query, @values);
 
   $dbh->commit();
index 7406c22..53ecc68 100644 (file)
@@ -46,6 +46,7 @@ __PACKAGE__->meta->setup(
     accounting_method          => { type => 'text' },
     inventory_system           => { type => 'text' },
     profit_determination       => { type => 'text' },
+    language_id                => { type => 'integer' },
   ],
 
   primary_key_columns => [ 'id' ],
index 9abf798..6873140 100644 (file)
@@ -1549,6 +1549,9 @@ sub edit_defaults {
 
   map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
 
+  # default language
+  my @ALL_LANGUAGES = SL::DB::Manager::Language->get_all;
+
 # EÜR = cash, Bilanzierung = accrual 
 
   foreach my $key (keys %{ $form->{IC} }) {
@@ -1568,7 +1571,8 @@ sub edit_defaults {
   $form->{title} = $locale->text('Ranges of numbers and default accounts');
 
   $form->header();
-  print $form->parse_html_template('am/edit_defaults');
+  print $form->parse_html_template('am/edit_defaults',
+                                   { ALL_LANGUAGES => @ALL_LANGUAGES, });
 
   $main::lxdebug->leave_sub();
 }
index cdb0852..284f061 100644 (file)
@@ -50,6 +50,7 @@ use POSIX qw(strftime);
 use SL::CT;
 use SL::CVar;
 use SL::DB::Business;
+use SL::DB::Default;
 use SL::ReportGenerator;
 
 require "bin/mozilla/common.pl";
@@ -336,6 +337,13 @@ sub form_header {
 
   $form->{NOTES} ||= [ ];
 
+  if (!$form->{'language_id'}) {
+    my $l_id = SL::DB::Default->get->{'language_id'};
+    if ($l_id) {
+      $form->{'default_language_id'} = $l_id;
+    }
+  }
+
   $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'CT', 'trans_id' => $form->{id});
 
   CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
diff --git a/sql/Pg-upgrade2/defaults_add_language_id.sql b/sql/Pg-upgrade2/defaults_add_language_id.sql
new file mode 100644 (file)
index 0000000..7376a4e
--- /dev/null
@@ -0,0 +1,5 @@
+-- @tag: defaults_add_language_id
+-- @description: Id der Standardsprache in defaults speichern
+-- @depends: release_2_6_2
+-- @charset: utf-8
+ALTER TABLE defaults ADD COLUMN language_id integer;
index 8829ba6..d8aee75 100644 (file)
       </td>
     </tr>
 
+    <tr>
+     <th align="right">[% 'Language' | $T8 %]</th>
+     <td>
+      [%- INCLUDE 'generic/multibox.html'
+           name          = 'language_id',
+           default       = defaults_language_id,
+           style         = 'size:20; maxength:5',
+           DATA          = ALL_LANGUAGES,
+           id_key        = 'id',
+           label_key     = 'description',
+           -%]
+      </td>
+    </tr>
+
     <tr class="listheading">
      <th colspan="4">[% 'Configuration' | $T8 %]</th>
     </tr>
index 91d8636..796f2a3 100644 (file)
       <td>
        [%- INCLUDE generic/multibox.html
              name       = 'language_id',
+             default    = default_language_id,
              DATA       = languages,
              show_empty = 1,
              id_key     = 'id',