]> wagnertech.de Git - mfinanz.git/commitdiff
Merge branch 'currency'
authorNiclas Zimmermann <niclas@kivitendo-premium.de>
Fri, 24 May 2013 09:49:46 +0000 (11:49 +0200)
committerNiclas Zimmermann <niclas@kivitendo-premium.de>
Fri, 24 May 2013 09:49:46 +0000 (11:49 +0200)
1  2 
SL/AP.pm
SL/AR.pm
SL/CT.pm
SL/DO.pm
SL/Form.pm
SL/IR.pm
SL/IS.pm
SL/User.pm
locale/de/all

diff --combined SL/AP.pm
index 53c1d2f5df4a742d79b7828c6f71575e8fa165c3,04e1ade073ae66ee694223e419f116b5113f1ec9..bc5a362025ce9373a039afe6b8383763de5e85e8
+++ b/SL/AP.pm
@@@ -55,7 -55,6 +55,6 @@@ sub post_transaction 
    my $exchangerate = 0;
  
    $form->{defaultcurrency} = $form->get_default_currency($myconfig);
-   delete $form->{currency} unless $form->{defaultcurrency};
  
    ($null, $form->{department_id}) = split(/--/, $form->{department});
  
      $query = qq|UPDATE ap SET
                  invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?,
                  amount = ?, duedate = ?, paid = ?, netamount = ?,
-                 curr = ?, notes = ?, department_id = ?, storno = ?, storno_id = ?,
+                 currency_id = (SELECT id FROM currencies WHERE name = ?), notes = ?, department_id = ?, storno = ?, storno_id = ?,
                  globalproject_id = ?, direct_debit = ?
                 WHERE id = ?|;
      @values = ($form->{invnumber}, conv_date($form->{transdate}),
        dbh        => $dbh,
        from       => $transdate,
        to         => $transdate,
 +      trans_id   => $form->{id},
      );
  
      $datev->export;
@@@ -666,7 -664,6 +665,6 @@@ sub post_payment 
  
    $form->{exchangerate}    = $form->format_amount($myconfig, $form->{exchangerate});
    $form->{defaultcurrency} = $form->get_default_currency($myconfig);
-   delete $form->{currency} unless $form->{defaultcurrency};
  
    # Get the AP accno.
    $query =
diff --combined SL/AR.pm
index 5ec2b1850a5e861d3cb054f1e04a9a756a2c630d,212b2b894bc1ed17f1c03defc6d3850098ecbdfa..b6a7376e1409740fb29e51a109aa642a0b9b88c2
+++ b/SL/AR.pm
@@@ -56,7 -56,6 +56,6 @@@ sub post_transaction 
  
    my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
    $form->{defaultcurrency} = $form->get_default_currency($myconfig);
-   delete $form->{currency} unless $form->{defaultcurrency};
  
    # set exchangerate
    $form->{exchangerate} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 :
      } else {
        $query = qq|SELECT nextval('glid')|;
        ($form->{id}) = selectrow_query($form, $dbh, $query);
-       $query = qq|INSERT INTO ar (id, invnumber, employee_id) VALUES (?, 'dummy', ?)|;
-       do_query($form, $dbh, $query, $form->{id}, $form->{employee_id});
+       $query = qq|INSERT INTO ar (id, invnumber, employee_id, currency_id) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE name=?))|;
+       do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency});
        $form->{invnumber} = $form->update_defaults($myconfig, "invnumber", $dbh) unless $form->{invnumber};
      }
    }
        qq|UPDATE ar set
             invnumber = ?, ordnumber = ?, transdate = ?, customer_id = ?,
             taxincluded = ?, amount = ?, duedate = ?, paid = ?,
-            netamount = ?, curr = ?, notes = ?, department_id = ?,
+            netamount = ?, notes = ?, department_id = ?,
             employee_id = ?, storno = ?, storno_id = ?, globalproject_id = ?,
             direct_debit = ?
           WHERE id = ?|;
      my @values = ($form->{invnumber}, $form->{ordnumber}, conv_date($form->{transdate}), conv_i($form->{customer_id}), $form->{taxincluded} ? 't' : 'f', $form->{amount},
-                   conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}),
+                   conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{notes}, conv_i($form->{department_id}),
                    conv_i($form->{employee_id}), $form->{storno} ? 't' : 'f', $form->{storno_id},
                    conv_i($form->{globalproject_id}), $form->{direct_debit} ? 't' : 'f', conv_i($form->{id}));
      do_query($form, $dbh, $query, @values);
        dbh        => $dbh,
        from       => $transdate,
        to         => $transdate,
 +      trans_id   => $form->{id},
      );
  
      $datev->export;
@@@ -427,7 -425,6 +426,6 @@@ sub post_payment 
  
    $form->{exchangerate}    = $form->format_amount($myconfig, $form->{exchangerate});
    $form->{defaultcurrency} = $form->get_default_currency($myconfig);
-   delete $form->{currency} unless $form->{defaultcurrency};
  
    # Get the AR accno (which is normally done by Form::create_links()).
    $query =
diff --combined SL/CT.pm
index 02a5522f656fc0d2651aa156fb00317dc6fe63eb,39c29b0651b1f3788eb69be8422a1f4fe8ae6ca8..66b3e25b7042f09e368fb9d9e4ab9a3a98d7fa45
+++ b/SL/CT.pm
@@@ -68,11 -68,12 +68,12 @@@ sub get_tuple 
    my $ref = $sth->fetchrow_hashref("NAME_lc");
  
    map { $form->{$_} = $ref->{$_} } keys %$ref;
+   $sth->finish;
  
-   # remove any trailing whitespace
-   $form->{curr} =~ s/\s*$//;
+   #get name of currency instead of id:
+   $query = qq|SELECT name AS curr FROM currencies WHERE id=?|;
+   ($form->{curr}) = selectrow_query($form, $dbh, $query, conv_i($form->{currency_id}));
  
-   $sth->finish;
    if ( $form->{salesman_id} ) {
      my $query =
        qq|SELECT ct.name AS salesman | .
@@@ -275,7 -276,7 +276,7 @@@ sub save_customer 
      $query = qq|SELECT nextval('id')|;
      ($form->{id}) = selectrow_query($form, $dbh, $query);
  
-     $query = qq|INSERT INTO customer (id, name) VALUES (?, '')|;
+     $query = qq|INSERT INTO customer (id, name, currency_id) VALUES (?, '', (SELECT currency_id FROM defaults))|;
      do_query($form, $dbh, $query, $form->{id});
    }
  
      qq|user_password = ?, | .
      qq|c_vendor_id = ?, | .
      qq|klass = ?, | .
-     qq|curr = ?, | .
+     qq|currency_id = (SELECT id FROM currencies WHERE name = ?), | .
      qq|taxincluded_checked = ? | .
      qq|WHERE id = ?|;
    my @values = (
      $form->{user_password},
      $form->{c_vendor_id},
      conv_i($form->{klass}),
-     substr($form->{currency}, 0, 3),
+     $form->{currency},
      $form->{taxincluded_checked} ne '' ? $form->{taxincluded_checked} : undef,
      $form->{id}
      );
@@@ -422,7 -423,7 +423,7 @@@ sub save_vendor 
      $query = qq|SELECT nextval('id')|;
      ($form->{id}) = selectrow_query($form, $dbh, $query);
  
-     $query = qq|INSERT INTO vendor (id, name) VALUES (?, '')|;
+     $query = qq|INSERT INTO vendor (id, name, currency_id) VALUES (?, '', (SELECT currency_id FROM defaults))|;
      do_query($form, $dbh, $query, $form->{id});
  
      my $vendornumber      = SL::TransNumber->new(type   => 'vendor',
      qq|  username = ?, | .
      qq|  user_password = ?, | .
      qq|  v_customer_id = ?, | .
-     qq|  curr = ? | .
+     qq|  currency_id = (SELECT id FROM currencies WHERE name = ?) | .
      qq|WHERE id = ?|;
    my @values = (
      $form->{vendornumber},
      $form->{username},
      $form->{user_password},
      $form->{v_customer_id},
-     substr($form->{currency}, 0, 3),
+     $form->{currency},
      $form->{id}
      );
    do_query($form, $dbh, $query, @values);
@@@ -615,24 -616,24 +616,24 @@@ sub search 
    my @values;
  
    my %allowed_sort_columns = (
 -      "id" => "id",
 -      "customernumber" => "customernumber",
 -      "vendornumber" => "vendornumber",
 -      "name" => "ct.name",
 -      "contact" => "contact",
 -      "phone" => "phone",
 -      "fax" => "fax",
 -      "email" => "email",
 -      "street" => "street",
 -      "taxnumber" => "taxnumber",
 -      "business" => "business",
 -      "invnumber" => "invnumber",
 -      "ordnumber" => "ordnumber",
 -      "quonumber" => "quonumber",
 -      "zipcode" => "zipcode",
 -      "city" => "city",
 -      "country" => "country",
 -      "salesman" => "e.name"
 +      "id"                 => "ct.id",
 +      "customernumber"     => "ct.customernumber",
 +      "vendornumber"       => "ct.vendornumber",
 +      "name"               => "ct.name",
 +      "contact"            => "ct.contact",
 +      "phone"              => "ct.phone",
 +      "fax"                => "ct.fax",
 +      "email"              => "ct.email",
 +      "street"             => "ct.street",
 +      "taxnumber"          => "ct.taxnumber",
 +      "business"           => "ct.business",
 +      "invnumber"          => "ct.invnumber",
 +      "ordnumber"          => "ct.ordnumber",
 +      "quonumber"          => "ct.quonumber",
 +      "zipcode"            => "ct.zipcode",
 +      "city"               => "ct.city",
 +      "country"            => "ct.country",
 +      "salesman"           => "e.name"
      );
  
    $form->{sort} ||= "name";
      $where .= " AND ((lower(ct.city) LIKE lower(?))
                       OR
                       (ct.id IN (
 -                        SELECT trans_id
 -                        FROM shipto
 -                        WHERE (module = 'CT')
 -                          AND (lower(shiptocity) LIKE lower(?))
 +                        SELECT sc.trans_id
 +                        FROM shipto sc
 +                        WHERE (sc.module = 'CT')
 +                          AND (lower(sc.shiptocity) LIKE lower(?))
                        ))
                       )";
      push @values, ('%' . $form->{addr_city} . '%') x 2;
      $where .= " AND ((lower(ct.country) LIKE lower(?))
                       OR
                       (ct.id IN (
 -                        SELECT trans_id
 -                        FROM shipto
 -                        WHERE (module = 'CT')
 -                          AND (lower(shiptocountry) LIKE lower(?))
 +                        SELECT so.trans_id
 +                        FROM shipto so
 +                        WHERE (so.module = 'CT')
 +                          AND (lower(so.shiptocountry) LIKE lower(?))
                        ))
                       )";
      push @values, ('%' . $form->{addr_country} . '%') x 2;
    }
  
    if ($form->{obsolete} eq "Y") {
 -    $where .= qq| AND obsolete|;
 +    $where .= qq| AND ct.obsolete|;
    } elsif ($form->{obsolete} eq "N") {
 -    $where .= qq| AND NOT obsolete|;
 +    $where .= qq| AND NOT ct.obsolete|;
    }
  
    if ($form->{business_id}) {
 -    $where .= qq| AND (business_id = ?)|;
 +    $where .= qq| AND (ct.business_id = ?)|;
      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= ?)|;
 +    $where .= qq| AND ct.salesman_id = (select em.id from employee em where em.login = ?)|;
      push(@values, $form->{login});
    }
  
    }
  
    if ($form->{addr_street}) {
 -    $where .= qq| AND (street ILIKE ?)|;
 +    $where .= qq| AND (ct.street ILIKE ?)|;
      push @values, '%' . $form->{addr_street} . '%';
    }
  
    if ($form->{addr_zipcode}) {
 -    $where .= qq| AND (zipcode ILIKE ?)|;
 +    $where .= qq| AND (ct.zipcode ILIKE ?)|;
      push @values, $form->{addr_zipcode} . '%';
    }
  
@@@ -1156,6 -1157,7 +1157,6 @@@ sub search_contacts 
    my %params    = @_;
  
    my $dbh       = $params{dbh} || $::form->get_standard_dbh;
 -  my $vc        = $params{db} eq 'customer' ? 'customer' : 'vendor';
  
    my %sortspecs = (
      'cp_name'   => 'cp_name, cp_givenname',
diff --combined SL/DO.pm
index 8d71fbcda0dfcbc7578f9dbbfb33a9d5e918a275,5d406dc2baac246c10cd53c1a4285cd2420097e1..f3623c922ec6ef05c407c1b621fe86645fa08f2e
+++ b/SL/DO.pm
@@@ -61,8 -61,7 +61,8 @@@ sub transactions 
    my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
  
    my $query =
 -    qq|SELECT dord.id, dord.donumber, dord.ordnumber, dord.transdate,
 +    qq|SELECT dord.id, dord.donumber, dord.ordnumber,
 +         dord.transdate, dord.reqdate,
           ct.${vc}number, ct.name, dord.${vc}_id, dord.globalproject_id,
           dord.closed, dord.delivered, dord.shippingpoint, dord.shipvia,
           dord.transaction_description,
  
    my %allowed_sort_columns = (
      "transdate"               => "dord.transdate",
 +    "reqdate"                 => "dord.reqdate",
      "id"                      => "dord.id",
      "donumber"                => "dord.donumber",
      "ordnumber"               => "dord.ordnumber",
@@@ -229,7 -227,7 +229,7 @@@ sub save 
      $query = qq|SELECT nextval('id')|;
      ($form->{id}) = selectrow_query($form, $dbh, $query);
  
-     $query = qq|INSERT INTO delivery_orders (id, donumber, employee_id) VALUES (?, '', ?)|;
+     $query = qq|INSERT INTO delivery_orders (id, donumber, employee_id, currency_id) VALUES (?, '', ?, (SELECT currency_id FROM defaults LIMIT 1))|;
      do_query($form, $dbh, $query, $form->{id}, conv_i($form->{employee_id}));
    }
  
           shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?,
           delivered = ?, department_id = ?, language_id = ?, shipto_id = ?,
           globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?,
-          is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, curr = ?
+          is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, currency_id = (SELECT id FROM currencies WHERE name = ?)
         WHERE id = ?|;
  
    @values = ($form->{donumber}, $form->{ordnumber},
               conv_i($form->{salesman_id}), conv_i($form->{cp_id}),
               $form->{transaction_description},
               $form->{type} =~ /^sales/ ? 't' : 'f',
-              conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{terms}), substr($form->{currency}, 0, 3),
+              conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{terms}), $form->{currency},
               conv_i($form->{id}));
    do_query($form, $dbh, $query, @values);
  
@@@ -618,7 -616,7 +618,7 @@@ sub retrieve 
           d.description AS department, dord.language_id,
           dord.shipto_id,
           dord.globalproject_id, dord.delivered, dord.transaction_description,
-          dord.taxzone_id, dord.taxincluded, dord.terms, dord.curr AS currency
+          dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency
         FROM delivery_orders dord
         JOIN ${vc} cv ON (dord.${vc}_id = cv.id)
         LEFT JOIN employee e ON (dord.employee_id = e.id)
    }
    $sth->finish();
  
-   # remove any trailing whitespace
-   $form->{currency} =~ s/\s*$//;
    $form->{donumber_array} =~ s/\s*$//g;
  
    $form->{saved_donumber} = $form->{donumber};
diff --combined SL/Form.pm
index 018526ac666d6a1abc7a91d89c91313fd3d91666,f7097bda37e0eb81dd067a994de4dce5b7307405..30c8bd425c6615e8be2f8613e11e5a5bc23d3577
@@@ -1361,13 -1361,21 +1361,13 @@@ sub datetonum 
  
  # Database routines used throughout
  
 -sub _dbconnect_options {
 -  my $self    = shift;
 -  my $options = { pg_enable_utf8 => $::locale->is_utf8,
 -                  @_ };
 -
 -  return $options;
 -}
 -
  sub dbconnect {
    $main::lxdebug->enter_sub(2);
  
    my ($self, $myconfig) = @_;
  
    # connect to database
 -  my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
 +  my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, SL::DBConnect->get_options)
      or $self->dberror;
  
    # set db options
@@@ -1386,7 -1394,7 +1386,7 @@@ sub dbconnect_noauto 
    my ($self, $myconfig) = @_;
  
    # connect to database
 -  my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
 +  my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, SL::DBConnect->get_options(AutoCommit => 0))
      or $self->dberror;
  
    # set db options
@@@ -1482,19 -1490,17 +1482,17 @@@ sub update_exchangerate 
      $main::lxdebug->leave_sub();
      return;
    }
-   $query = qq|SELECT curr FROM defaults|;
-   my ($currency) = selectrow_query($self, $dbh, $query);
-   my ($defaultcurrency) = split m/:/, $currency;
+   $query = qq|SELECT name AS curr FROM currencies WHERE id=(SELECT currency_id FROM defaults)|;
  
+   my ($defaultcurrency) = selectrow_query($self, $dbh, $query);
  
    if ($curr eq $defaultcurrency) {
      $main::lxdebug->leave_sub();
      return;
    }
  
-   $query = qq|SELECT e.curr FROM exchangerate e
-                  WHERE e.curr = ? AND e.transdate = ?
+   $query = qq|SELECT e.currency_id FROM exchangerate e
+                  WHERE e.currency_id = (SELECT cu.id FROM currencies cu WHERE cu.name=?) AND e.transdate = ?
                   FOR UPDATE|;
    my $sth = prepare_execute_query($self, $dbh, $query, $curr, $transdate);
  
    if ($sth->fetchrow_array) {
      $query = qq|UPDATE exchangerate
                  SET $set
-                 WHERE curr = ?
+                 WHERE currency_id = (SELECT id FROM currencies WHERE name = ?)
                  AND transdate = ?|;
  
    } else {
-     $query = qq|INSERT INTO exchangerate (curr, buy, sell, transdate)
-                 VALUES (?, $buy, $sell, ?)|;
+     $query = qq|INSERT INTO exchangerate (currency_id, buy, sell, transdate)
+                 VALUES ((SELECT id FROM currencies WHERE name = ?), $buy, $sell, ?)|;
    }
    $sth->finish;
    do_query($self, $dbh, $query, $curr, $transdate);
@@@ -1565,18 -1571,17 +1563,17 @@@ sub get_exchangerate 
      return 1;
    }
  
-   $query = qq|SELECT curr FROM defaults|;
+   $query = qq|SELECT name AS curr FROM currencies WHERE id = (SELECT currency_id FROM defaults)|;
  
-   my ($currency) = selectrow_query($self, $dbh, $query);
-   my ($defaultcurrency) = split m/:/, $currency;
+   my ($defaultcurrency) = selectrow_query($self, $dbh, $query);
  
-   if ($currency eq $defaultcurrency) {
+   if ($curr eq $defaultcurrency) {
      $main::lxdebug->leave_sub();
      return 1;
    }
  
    $query = qq|SELECT e.$fld FROM exchangerate e
-                  WHERE e.curr = ? AND e.transdate = ?|;
+                  WHERE e.currency_id = (SELECT id FROM currencies WHERE name = ?) AND e.transdate = ?|;
    my ($exchangerate) = selectrow_query($self, $dbh, $query, $curr, $transdate);
  
  
@@@ -1609,7 -1614,7 +1606,7 @@@ sub check_exchangerate 
  
    my $dbh   = $self->get_standard_dbh($myconfig);
    my $query = qq|SELECT e.$fld FROM exchangerate e
-                  WHERE e.curr = ? AND e.transdate = ?|;
+                  WHERE e.currency_id = (SELECT id FROM currencies WHERE name = ?) AND e.transdate = ?|;
  
    my ($exchangerate) = selectrow_query($self, $dbh, $query, $currency, $transdate);
  
@@@ -1624,11 -1629,10 +1621,10 @@@ sub get_all_currencies 
    my $self     = shift;
    my $myconfig = shift || \%::myconfig;
    my $dbh      = $self->get_standard_dbh($myconfig);
+   my @currencies =();
  
-   my $query = qq|SELECT curr FROM defaults|;
-   my ($curr)     = selectrow_query($self, $dbh, $query);
-   my @currencies = grep { $_ } map { s/\s//g; $_ } split m/:/, $curr;
+   my $query = qq|SELECT name FROM currencies|;
+   my @currencies = map { $_->{name} } selectall_hashref_query($self, $dbh, $query);
  
    $main::lxdebug->leave_sub();
  
@@@ -1639,11 -1643,14 +1635,14 @@@ sub get_default_currency 
    $main::lxdebug->enter_sub();
  
    my ($self, $myconfig) = @_;
-   my @currencies        = $self->get_all_currencies($myconfig);
+   my $dbh      = $self->get_standard_dbh($myconfig);
+   my $query = qq|SELECT name AS curr FROM currencies WHERE id = (SELECT currency_id FROM defaults)|;
+   my ($defaultcurrency) = selectrow_query($self, $dbh, $query);
  
    $main::lxdebug->leave_sub();
  
-   return $currencies[0];
+   return $defaultcurrency;
  }
  
  sub set_payment_options {
@@@ -2183,9 -2190,7 +2182,7 @@@ $main::lxdebug->enter_sub()
  
    $key = "all_currencies" unless ($key);
  
-   my $query = qq|SELECT curr AS currency FROM defaults|;
-   $self->{$key} = [split(/\:/ , selectfirst_hashref_query($self, $dbh, $query)->{currency})];
+   $self->{$key} = [$self->get_all_currencies()];
  
    $main::lxdebug->leave_sub();
  }
@@@ -2696,7 -2701,7 +2693,7 @@@ sub create_links 
      $query =
        qq|SELECT
             a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid,
-            a.duedate, a.ordnumber, a.taxincluded, a.curr AS currency, a.notes,
+            a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes,
             a.intnotes, a.department_id, a.amount AS oldinvtotal,
             a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type,
             a.globalproject_id, ${extra_columns}
        $self->{$key} = $ref->{$key};
      }
  
-     # remove any trailing whitespace
-     $self->{currency} =~ s/\s*$//;
      my $transdate = "current_date";
      if ($self->{transdate}) {
        $transdate = $dbh->quote($self->{transdate});
      }
  
      $sth->finish;
+     #check das:
      $query =
        qq|SELECT
-            d.curr AS currencies, d.closedto, d.revtrans,
+            d.closedto, d.revtrans,
+            (SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency,
             (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
             (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
           FROM defaults d|;
      # get date
      $query =
         qq|SELECT
-             current_date AS transdate, d.curr AS currencies, d.closedto, d.revtrans,
+             current_date AS transdate, d.closedto, d.revtrans,
+             (SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency,
              (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
              (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
            FROM defaults d|;
      if ($self->{"$self->{vc}_id"}) {
  
        # only setup currency
-       ($self->{currency}) = split(/:/, $self->{currencies}) if !$self->{currency};
+       ($self->{currency}) = $self->{defaultcurrency} if !$self->{currency};
  
      } else {
  
@@@ -2849,19 -2854,17 +2846,17 @@@ sub lastname_used 
    my ($arap, $where);
  
    $table         = $table eq "customer" ? "customer" : "vendor";
-   my %column_map = ("a.curr"                  => "currency",
-                     "a.${table}_id"           => "${table}_id",
+   my %column_map = ("a.${table}_id"           => "${table}_id",
                      "a.department_id"         => "department_id",
                      "d.description"           => "department",
                      "ct.name"                 => $table,
-                     "ct.curr"                 => "cv_curr",
+                     "cu.name"                 => "currency",
                      "current_date + ct.terms" => "duedate",
      );
  
    if ($self->{type} =~ /delivery_order/) {
      $arap  = 'delivery_orders';
-     delete $column_map{"a.curr"};
-     delete $column_map{"ct.curr"};
+     delete $column_map{"cu.currency"};
  
    } elsif ($self->{type} =~ /_order/) {
      $arap  = 'oe';
                          FROM $arap a
                          LEFT JOIN $table     ct ON (a.${table}_id = ct.id)
                          LEFT JOIN department d  ON (a.department_id = d.id)
+                         LEFT JOIN currencies cu ON (cu.id=ct.currency_id)
                          WHERE a.id = ?|;
    my $ref          = selectfirst_hashref_query($self, $dbh, $query, $trans_id);
  
    map { $self->{$_} = $ref->{$_} } values %column_map;
  
-   # remove any trailing whitespace
-   $self->{currency} =~ s/\s*$// if $self->{currency};
-   $self->{cv_curr} =~ s/\s*$// if $self->{cv_curr};
-   # if customer/vendor currency is set use this
-   $self->{currency} = $self->{cv_curr} if $self->{cv_curr};
    $main::lxdebug->leave_sub();
  }
  
diff --combined SL/IR.pm
index 06f84abbcaf7b45fbee07b6ebed67aedd8215948,70a747efa4357ea39e97c2ef15cf727bb3e6c113..5c335ecccbcfecc03be7d1866b27b58860f554de
+++ b/SL/IR.pm
@@@ -57,6 -57,7 +57,7 @@@ sub post_invoice 
    # connect to database, turn off autocommit
    my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
    $form->{defaultcurrency} = $form->get_default_currency($myconfig);
+   my $defaultcurrency = $form->{defaultcurrency};
  
    my $ic_cvar_configs = CVar->get_configs(module => 'IC',
                                            dbh    => $dbh);
  
    my $all_units = AM->retrieve_units($myconfig, $form);
  
+ #markierung
    if (!$payments_only) {
      if ($form->{id}) {
        &reverse_invoice($dbh, $form);
      } else {
        ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|);
-       do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber) VALUES (?, '')|, $form->{id});
+       do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber, currency_id) VALUES (?, '', (SELECT id FROM currencies WHERE name=?))|, $form->{id}, $form->{currency});
      }
    }
  
-   my ($currencies)    = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|);
-   my $defaultcurrency = (split m/:/, $currencies)[0];
    if ($form->{currency} eq $defaultcurrency) {
      $form->{exchangerate} = 1;
    } else {
                  orddate      = ?, quodate     = ?, vendor_id     = ?, amount      = ?,
                  netamount    = ?, paid        = ?, duedate       = ?,
                  invoice      = ?, taxzone_id  = ?, notes         = ?, taxincluded = ?,
-                 intnotes     = ?, curr        = ?, storno_id     = ?, storno      = ?,
+                 intnotes     = ?, storno_id   = ?, storno        = ?,
                  cp_id        = ?, employee_id = ?, department_id = ?,
                  globalproject_id = ?, direct_debit = ?
                WHERE id = ?|;
        conv_date($form->{orddate}), conv_date($form->{quodate}),     conv_i($form->{vendor_id}),               $amount,
                  $netamount,                  $form->{paid},      conv_date($form->{duedate}),
              '1',                             $taxzone_id,                  $form->{notes},          $form->{taxincluded} ? 't' : 'f',
-                 $form->{intnotes},           $form->{currency},     conv_i($form->{storno_id}),     $form->{storno}      ? 't' : 'f',
+                 $form->{intnotes},           conv_i($form->{storno_id}),     $form->{storno}      ? 't' : 'f',
           conv_i($form->{cp_id}),      conv_i($form->{employee_id}), conv_i($form->{department_id}),
           conv_i($form->{globalproject_id}),
                  $form->{direct_debit} ? 't' : 'f',
        dbh        => $dbh,
        from       => $transdate,
        to         => $transdate,
 +      trans_id   => $form->{id},
      );
  
      $datev->export;
@@@ -925,8 -923,7 +924,7 @@@ sub retrieve_invoice 
                 (SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id)    AS income_accno,
                 (SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id)   AS expense_accno,
                 (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id)    AS fxgain_accno,
-                (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno,
-                d.curr AS currencies
+                (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno
                 $q_invdate
                 FROM defaults d|;
    $ref = selectfirst_hashref_query($form, $dbh, $query);
    $query = qq|SELECT cp_id, invnumber, transdate AS invdate, duedate,
                  orddate, quodate, globalproject_id,
                  ordnumber, quonumber, paid, taxincluded, notes, taxzone_id, storno, gldate,
-                 intnotes, curr AS currency, direct_debit
+                 intnotes, (SELECT cu.name FROM currencies cu WHERE cu.id=ap.currency_id) AS currency, direct_debit
                FROM ap
                WHERE id = ?|;
    $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
    map { $form->{$_} = $ref->{$_} } keys %$ref;
  
-   # remove any trailing whitespace
-   $form->{currency} =~ s/\s*$//;
    $form->{exchangerate}  = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "sell");
  
    # get shipto
@@@ -1093,21 -1087,19 +1088,19 @@@ sub get_vendor 
           v.id AS vendor_id, v.name AS vendor, v.discount as vendor_discount,
           v.creditlimit, v.terms, v.notes AS intnotes,
           v.email, v.cc, v.bcc, v.language_id, v.payment_id,
-          v.street, v.zipcode, v.city, v.country, v.taxzone_id, v.curr, v.direct_debit,
+          v.street, v.zipcode, v.city, v.country, v.taxzone_id, cu.name AS curr, v.direct_debit,
           $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
           b.description AS business
         FROM vendor v
         LEFT JOIN business b       ON (b.id = v.business_id)
         LEFT JOIN payment_terms pt ON (v.payment_id = pt.id)
+        LEFT JOIN currencies cu    ON (v.currency_id = cu.id)
         WHERE 1=1 $where|;
    my $ref = selectfirst_hashref_query($form, $dbh, $query, @values);
    map { $params->{$_} = $ref->{$_} } keys %$ref;
  
-   # remove any trailing whitespace
-   $form->{curr} =~ s/\s*$//;
-   # use vendor currency if not empty
-   $form->{currency} = $form->{curr} if $form->{curr};
+   # use vendor currency
+   $form->{currency} = $form->{curr};
  
    $params->{creditremaining} = $params->{creditlimit};
  
    $query = qq|SELECT o.amount,
                  (SELECT e.sell
                   FROM exchangerate e
-                  WHERE (e.curr = o.curr)
+                  WHERE (e.currency_id = o.currency_id)
                     AND (e.transdate = o.transdate)) AS exch
                FROM oe o
                WHERE (o.vendor_id = ?) AND (o.quotation = '0') AND (o.closed = '0')|;
@@@ -1393,9 -1385,10 +1386,10 @@@ sub vendor_details 
    # fax and phone and email as vendor*
    my $query =
      qq|SELECT ct.*, cp.*, ct.notes as vendornotes, phone as vendorphone, fax as vendorfax, email as vendoremail,
-          ct.curr AS currency
+          cu.name AS currency
         FROM vendor ct
         LEFT JOIN contacts cp ON (ct.id = cp.cp_cv_id)
+        LEFT JOIN currencies cu ON (ct.currency_id = cu.id)
         WHERE (ct.id = ?) $contact
         ORDER BY cp.cp_id
         LIMIT 1|;
    }
  
    map { $form->{$_} = $ref->{$_} } keys %$ref;
-   # remove any trailing whitespace
-   $form->{currency} =~ s/\s*$// if ($form->{currency});
  
    my $custom_variables = CVar->get_custom_variables('dbh'      => $dbh,
                                                      'module'   => 'CT',
diff --combined SL/IS.pm
index 9ecc64818c9e3f17dfda5cca8c195aca2e49e394,35c2c4091312ebb7be465a252154a9c81fce6d6a..a844b732707833d5e86b7bf1c0dd447a327abc0c
+++ b/SL/IS.pm
@@@ -458,9 -458,10 +458,10 @@@ sub customer_details 
    my $query =
      qq|SELECT ct.*, cp.*, ct.notes as customernotes,
           ct.phone AS customerphone, ct.fax AS customerfax, ct.email AS customeremail,
-          ct.curr AS currency
+          cu.name AS currency
         FROM customer ct
         LEFT JOIN contacts cp on ct.id = cp.cp_cv_id
+        LEFT JOIN currencies cu ON (ct.currency_id = cu.id)
         WHERE (ct.id = ?) $where
         ORDER BY cp.cp_id
         LIMIT 1|;
  
    map { $form->{$_} = $ref->{$_} } keys %$ref;
  
-   # remove any trailing whitespace
-   $form->{currency} =~ s/\s*$// if ($form->{currency});
    if ($form->{delivery_customer_id}) {
      $query =
        qq|SELECT *, notes as customernotes
@@@ -536,6 -534,8 +534,8 @@@ sub post_invoice 
    }
  
    $form->{defaultcurrency} = $form->get_default_currency($myconfig);
+   my $defaultcurrency = $form->{defaultcurrency};
    # Seit neuestem wird die department_id schon übergeben UND $form->department nicht mehr
    # korrekt zusammengebaut. Sehr wahrscheinlich beim Umstieg auf T8 kaputt gegangen
    # Ich lass den Code von 2005 erstmal noch stehen ;-) jb 03-2011
        $query = qq|SELECT nextval('glid')|;
        ($form->{"id"}) = selectrow_query($form, $dbh, $query);
  
-       $query = qq|INSERT INTO ar (id, invnumber) VALUES (?, ?)|;
-       do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"});
+       $query = qq|INSERT INTO ar (id, invnumber, currency_id) VALUES (?, ?, (SELECT id FROM currencies WHERE name=?))|;
+       do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}, $form->{currency});
  
        if (!$form->{invnumber}) {
          $form->{invnumber} =
    my ($netamount, $invoicediff) = (0, 0);
    my ($amount, $linetotal, $lastincomeaccno);
  
-   my ($currencies)    = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|);
-   my $defaultcurrency = (split m/:/, $currencies)[0];
    if ($form->{currency} eq $defaultcurrency) {
      $form->{exchangerate} = 1;
    } else {
                  amount      = ?, netamount     = ?, paid          = ?,
                  duedate     = ?, deliverydate  = ?, invoice       = ?, shippingpoint = ?,
                  shipvia     = ?, terms         = ?, notes         = ?, intnotes      = ?,
-                 curr        = ?, department_id = ?, payment_id    = ?, taxincluded   = ?,
+                 currency_id = (SELECT id FROM currencies WHERE name = ?),
+                 department_id = ?, payment_id    = ?, taxincluded   = ?,
                  type        = ?, language_id   = ?, taxzone_id    = ?, shipto_id     = ?,
                  employee_id = ?, salesman_id   = ?, storno_id     = ?, storno        = ?,
                  cp_id       = ?, marge_total   = ?, marge_percent = ?,
        dbh        => $dbh,
        from       => $transdate,
        to         => $transdate,
 +      trans_id   => $form->{id},
      );
  
      $datev->export;
@@@ -1559,8 -1556,7 +1557,7 @@@ sub retrieve_invoice 
           (SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id)    AS income_accno,
           (SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id)   AS expense_accno,
           (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id)    AS fxgain_accno,
-          (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno,
-          d.curr AS currencies
+          (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno
           ${query_transdate}
         FROM defaults d|;
  
             a.orddate, a.quodate, a.globalproject_id,
             a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate,
             a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id,
-            a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id,
+            a.duedate, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.shipto_id, a.cp_id,
             a.employee_id, a.salesman_id, a.payment_id,
             a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
             a.transaction_description, a.donumber, a.invnumber_for_credit_note,
      $ref = selectfirst_hashref_query($form, $dbh, $query, $id);
      map { $form->{$_} = $ref->{$_} } keys %{ $ref };
  
-     # remove any trailing whitespace
-     $form->{currency} =~ s/\s*$//;
      $form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy");
  
      # get shipto
@@@ -1758,13 -1751,14 +1752,14 @@@ sub get_customer 
           c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, c.terms,
           c.email, c.cc, c.bcc, c.language_id, c.payment_id,
           c.street, c.zipcode, c.city, c.country,
-          c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, c.curr,
+          c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, cu.name AS curr,
           c.taxincluded_checked, c.direct_debit,
           $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
           b.discount AS tradediscount, b.description AS business
         FROM customer c
         LEFT JOIN business b ON (b.id = c.business_id)
         LEFT JOIN payment_terms pt ON ($payment_id (c.payment_id = pt.id))
+        LEFT JOIN currencies cu ON (c.currency_id=cu.id)
         WHERE c.id = ?|;
    push @values, $cid;
    $ref = selectfirst_hashref_query($form, $dbh, $query, @values);
  
    map { $form->{$_} = $ref->{$_} } keys %$ref;
  
-   # remove any trailing whitespace
-   $form->{curr} =~ s/\s*$//;
-   # use customer currency if not empty
-   $form->{currency} = $form->{curr} if $form->{curr};
+   # use customer currency
+   $form->{currency} = $form->{curr};
  
    $query =
      qq|SELECT sum(amount - paid) AS dunning_amount
    $query =
      qq|SELECT o.amount,
           (SELECT e.buy FROM exchangerate e
-           WHERE e.curr = o.curr
+           WHERE e.currency_id = o.currency_id
              AND e.transdate = o.transdate)
         FROM oe o
         WHERE o.customer_id = ?
diff --combined SL/User.pm
index 46c35bf41c725c9c3482659763fab49db5587038,21c3689f936b029ca68201c1422bfde3d54f0516..e11fda4ce07f5cd68987d20f47126871657c18fb
@@@ -105,7 -105,7 +105,7 @@@ sub login 
      my %myconfig = $main::auth->read_user(login => $self->{login});
  
      # check if database is down
 -    my $dbh = SL::DBConnect->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd})
 +    my $dbh = SL::DBConnect->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd}, SL::DBConnect->get_options)
        or $self->error($DBI::errstr);
  
      # we got a connection, check the version
@@@ -245,7 -245,7 +245,7 @@@ sub dbsources 
    $form->{sid} = $form->{dbdefault};
    &dbconnect_vars($form, $form->{dbdefault});
  
 -  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
 +  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
      or $form->dberror;
  
    if ($form->{dbdriver} eq 'Pg') {
          next if ($db =~ /^template/);
  
          &dbconnect_vars($form, $db);
 -        my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
 +        my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
            or $form->dberror;
  
          $query =
@@@ -317,7 -317,7 +317,7 @@@ sub dbclusterencoding 
  
    dbconnect_vars($form, $form->{dbdefault});
  
 -  my $dbh                = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) || $form->dberror();
 +  my $dbh                = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options) || $form->dberror();
    my $query              = qq|SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'template0'|;
    my ($cluster_encoding) = $dbh->selectrow_array($query);
    $dbh->disconnect();
@@@ -335,7 -335,7 +335,7 @@@ sub dbcreate 
    $form->{sid} = $form->{dbdefault};
    &dbconnect_vars($form, $form->{dbdefault});
    my $dbh =
 -    SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
 +    SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
      or $form->dberror;
    $form->{db} =~ s/\"//g;
    my %dbcreate = (
  
    &dbconnect_vars($form, $form->{db});
  
 -  $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
 +  $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
      or $form->dberror;
  
    my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}};
    do_query($form, $dbh, $query, $form->{profit_determination});
    $query = "UPDATE defaults SET inventory_system = ?";
    do_query($form, $dbh, $query, $form->{inventory_system});
+   $query = "UPDATE defaults SET curr = ?";
+   do_query($form, $dbh, $query, $form->{defaultcurrency});
  
    $dbh->disconnect;
  
@@@ -414,7 -416,7 +416,7 @@@ sub dbdelete 
  
    $form->{sid} = $form->{dbdefault};
    &dbconnect_vars($form, $form->{dbdefault});
 -  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
 +  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
      or $form->dberror;
    my $query = $dbdelete{$form->{dbdriver}};
    do_query($form, $dbh, $query);
@@@ -460,7 -462,7 +462,7 @@@ sub dbneedsupdate 
      map { $form->{$_} = $member->{$_} } qw(dbname dbuser dbpasswd dbhost dbport);
      dbconnect_vars($form, $form->{dbname});
  
 -    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd});
 +    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options);
  
      next unless $dbh;
  
@@@ -590,7 -592,7 +592,7 @@@ sub dbupdate 
      $db =~ s/^db//;
      &dbconnect_vars($form, $db);
  
 -    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
 +    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
        or $form->dberror;
  
      $dbh->do($form->{dboptions}) if ($form->{dboptions});
@@@ -654,7 -656,7 +656,7 @@@ sub dbupdate2 
      $db =~ s/^db//;
      &dbconnect_vars($form, $db);
  
 -    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
 +    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options) or $form->dberror;
  
      $dbh->do($form->{dboptions}) if ($form->{dboptions});
  
@@@ -694,7 -696,7 +696,7 @@@ sub save_member 
  
    $main::auth->save_user($self->{login}, map { $_, $self->{$_} } config_vars());
  
 -  my $dbh = SL::DBConnect->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd});
 +  my $dbh = SL::DBConnect->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd}, SL::DBConnect->get_options);
    if ($dbh) {
      $self->create_employee_entry($::form, $dbh, $self, 1);
      $dbh->disconnect();
diff --combined locale/de/all
index dbfe63586878609621c5498a8dbf6049a0bbcced,2e840320d2ff5cc9e62e1bfd18e7f6e119ef0c31..e681137bca9b2d565b9d98c2e6fa9319d43c7ca9
@@@ -18,6 -18,7 +18,7 @@@ $self->{texts} = 
    '#1 h'                        => '#1 h',
    '#1 of #2 importable objects were imported.' => '#1 von #2 importierbaren Objekten wurden importiert.',
    '#1 prices were updated.'     => '#1 Preise wurden aktualisiert.',
+   '(recommended) Insert the used currencies in the system. You can simply change the name of the currencies by editing the textfields above. Do not use a name of a currency that is already in use.' => '(empfohlen) Fügen Sie die verwaisten Währungen in Ihr System ein. Sie können den Namen der Währung einfach ändern, indem Sie die Felder oben bearbeiten. Benutzen Sie keine Namen von Währungen, die Sie bereits benutzen.',
    '* there are restrictions for the perpetual method, look at chapter "Bemerkungen zu Bestandsmethode"  in' => ' für die Bestandsmethode gibt es Einschränkungen, siehe Kapitel "Bemerkungen zu Bestandsmethode"  in',
    '*) Since version 2.7 these parameters ares set in the client database and not in the configuration file, details in chapter:' => '*) Seit 2.7 werden Gewinnermittlungsart, Versteuerungsart und Warenbuchungsmethode in der Mandanten-DB gesteuert und nicht mehr in der Konfigurationsdatei, Umstellungs-Details:',
    '*/'                          => '*/',
    'Batch Printing'              => 'Druck',
    'Bcc'                         => 'Bcc',
    'Bcc E-mail'                  => 'BCC (E-Mail)',
 -  'Because the useability gets worth if one partnumber is used for several parts (for example if you are searching a position for an invoice), partnumbers should be unique.' => 'Da die Benutzerfreundlichkeit durch doppelte Artikelnummern erheblich verschlechtert wird (zum Beispiel, wenn man einen Artikel für eine Rechnung sucht), sollten Artikelnummern eindeutig vergeben sein.',
 +  'Because the useability gets worse if one partnumber is used for several parts (for example if you are searching a position for an invoice), partnumbers should be unique.' => 'Da die Benutzerfreundlichkeit durch doppelte Artikelnummern erheblich verschlechtert wird (zum Beispiel, wenn man einen Artikel für eine Rechnung sucht), sollten Artikelnummern eindeutig vergeben sein.',
    'Belegnummer'                 => 'Buchungsnummer',
    'Beratername'                 => 'Beratername',
    'Beraternummer'               => 'Beraternummer',
    'Billing/shipping address (street)' => 'Rechnungsadresse (Straße)',
    'Billing/shipping address (zipcode)' => 'Rechnungsadresse (PLZ)',
    'Bin'                         => 'Lagerplatz',
 +  'Bin 2'                       => '',
    'Bin From'                    => 'Quelllagerplatz',
    'Bin List'                    => 'Lagerliste',
    'Bin To'                      => 'Ziellagerplatz',
    'Both'                        => 'Beide',
    'Bottom'                      => 'Unten',
    'Bought'                      => 'Gekauft',
+   'Break up the update and contact a service provider.' => 'Diese Option bricht das Update ab. Bitte kontaktieren Sie Ihren Administrator oder beauftragen einen Dienstleister.',
    'Buchungsdatum'               => 'Buchungsdatum',
    'Buchungsgruppe'              => 'Buchungsgruppe',
    'Buchungsgruppe (database ID)' => 'Buchungsgruppe (Datenbank-ID)',
    'Decrease'                    => 'Verringern',
    'Default (no language selected)' => 'Standard (keine Sprache ausgewählt)',
    'Default Accounts'            => 'Standardkonten',
 +  'Default Bin'                 => '',
    'Default Customer/Vendor Language' => 'Standard-Kunden-/Lieferantensprache',
 +  'Default Warehouse'           => '',
    'Default buchungsgruppe'      => 'Standardbuchungsgruppe',
+   'Default currency'            => 'Standardwährung',
+   'Default currency missing!'   => 'Standardwährung fehlt!',
    'Default output medium'       => 'Standardausgabekanal',
    'Default printer'             => 'Standarddrucker',
    'Default template format'     => 'Standardvorlagenformat',
    'End date'                    => 'Enddatum',
    'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung f&uuml;r diesen Entwurf ein.',
    'Enter longdescription'       => 'Langtext eingeben',
-   'Enter the abbreviations separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere Währungen als Abkürzungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)',
    'Enter the requested execution date or leave empty for the quickest possible execution:' => 'Geben Sie das jeweils gewünschte Ausführungsdatum an, oder lassen Sie das Feld leer für die schnellstmögliche Ausführung:',
    'Entries for which automatic conversion failed:' => 'Einträge, für die die automatische Umstellung fehlschlug:',
    'Entries for which automatic conversion succeeded:' => 'Einträge, für die die automatische Umstellung erfolgreich war:',
    'Fristsetzung'                => 'Fristsetzung',
    'From'                        => 'Von',
    'From Date'                   => 'Von',
+   'From this version on it is necessary to name a default value.' => 'Ab dieser Version benötigt kivitendo eine Standardwährung.',
    'From this version on a new feature is available.' => 'Ab dieser Version ist ein neues Feature verfügbar.',
    'From this version on the partnumber of services, articles and assemblies have to be unique.' => 'Ab dieser Version müssen Artikelnummern eindeutig vergeben werden.',
    'From this version on the taxkey 0 must have a tax rate of 0 (for DATEV compatibility).' => 'Ab dieser Version muss der Steuerschlüssel 0 einen Steuersatz von 0% haben (auf Grund der DATEV-Kompatibilität).',
    'ID-Nummer'                   => 'ID-Nummer (intern)',
    'II'                          => 'II',
    'III'                         => 'III',
-   'IMPORTANT NOTE: You cannot safely change currencies, IF you have already booking entries!' => 'WICHTIGER HINWEIS: Falls schon Buchungen im Mandanten vorhanden sind, kann man nicht mehr UNKRITISCH neue oder andere Währungen konfigurieren!',
    'IV'                          => 'IV',
    'If checked the taxkey will not be exported in the DATEV Export, but only IF chart taxkeys differ from general ledger taxkeys' => 'Falls angehakt wird der DATEV-Steuerschlüssel bei Buchungen auf dieses Konto nicht beim DATEV-Export mitexportiert, allerdings nur wenn zusätzlich der Konto-Steuerschlüssel vom Buchungs (Hauptbuch) Steuerschlüssel abweicht',
    'If the article type is set to \'mixed\' then a column called \'type\' must be present.' => 'Falls der Artikeltyp auf \'gemischt\' gestellt wird, muss eine Spalte namens \'type\' vorhanden sein.',
    'No data was found.'          => 'Es wurden keine Daten gefunden.',
    'No databases have been found on this server.' => 'Auf diesem Server wurden keine Datenbanken gefunden.',
    'No datasets have been selected.' => 'Es wurden keine Datenbanken ausgew&auml;hlt.',
+   'No default currency'         => 'Keine Standardwährung',
    'No department has been created yet.' => 'Es wurde noch keine Abteilung erfasst.',
    'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgew&auml;hlt.',
    'No entries were found which had no unit assigned to them.' => 'Es wurden keine Eintr&auml;ge gefunden, denen keine Einheit zugeordnet war.',
    'Orders / Delivery Orders deleteable' => 'Aufträge / Lieferscheine löschbar',
    'Orientation'                 => 'Seitenformat',
    'Orphaned'                    => 'Nie benutzt',
+   'Orphaned currencies'         => 'Verwaiste Währungen',
    'Other users\' follow-ups'    => 'Wiedervorlagen anderer Benutzer',
    'Other values are ignored.'   => 'Andere Eingaben werden ignoriert.',
    'Others'                      => 'Andere',
    'Please contact your administrator.' => 'Bitte wenden Sie sich an Ihren Administrator.',
    'Please define a taxkey for the following taxes and run the update again:' => 'Bitte definieren Sie einen Steuerschlüssel für die folgenden Steuern und starten Sie dann das Update erneut:',
    'Please enter a profile name.' => 'Bitte geben Sie einen Profilnamen an.',
+   'Please enter the currency you are working with.' => 'Bitte geben Sie die Währung an, mit der Sie arbeiten.',
    'Please enter the login for the new user.' => 'Bitte geben Sie das Login für den neuen Benutzer ein.',
    'Please enter the name of the database that will be used as the template for the new database:' => 'Bitte geben Sie den Namen der Datenbank an, die als Vorlage f&uuml;r die neue Datenbank benutzt wird:',
    'Please enter the name of the dataset you want to restore the backup in.' => 'Bitte geben Sie den Namen der Datenbank ein, in der Sie die Sicherung wiederherstellen wollen.',
    'Removed spoolfiles!'         => 'Druckdateien entfernt!',
    'Removing marked entries from queue ...' => 'Markierte Einträge werden von der Warteschlange entfernt ...',
    'Rename the group'            => 'Gruppe umbenennen',
+   'Replace the orphaned currencies by other not orphaned currencies. To do so, please delete the currency in the textfields above and replace it by another currency. You could loose or change unintentionally exchangerates. Go on very carefully since you could destroy transactions.' => 'Ersetze die Währungen durch andere gültige Währungen. Wenn Sie sich hierfür entscheiden, ersetzen Sie bitte alle Währungen, die oben angegeben sind, durch Währungen, die in Ihrem System ordnungsgemäß eingetragen sind. Alle eingetragenen Wechselkurse für die verwaiste Währung werden dabei gelöscht. Bitte gehen Sie sehr vorsichtig vor, denn die betroffenen Buchungen können unter Umständen kaputt gehen.',
    'Report Positions'            => 'Berichte',
    'Report about warehouse contents' => 'Lagerbestand anzeigen',
    'Report about warehouse transactions' => 'Lagerbuchungen anzeigen',
    'Text variables: \'MAXLENGTH=n\' sets the maximum entry length to \'n\'.' => 'Textzeilen: \'MAXLENGTH=n\' setzt eine Maximall&auml;nge von n Zeichen.',
    'Text, text field and number variables: The default value will be used as-is.' => 'Textzeilen, Textfelder und Zahlenvariablen: Der Standardwert wird so wie er ist &uuml;bernommen.',
    'That export does not exist.' => 'Dieser Export existiert nicht.',
+   'That is why kivitendo could not find a default currency.' => 'Daher konnte kivitendo keine Standardwährung finden.',
    'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
    'The AP transaction #1 has been deleted.' => 'Die Kreditorenbuchung #1 wurde gelöscht.',
    'The AR transaction #1 has been deleted.' => 'Die Debitorenbuchung #1 wurde gelöscht.',
    'The follow-up date is missing.' => 'Das Wiedervorlagedatum fehlt.',
    'The following Buchungsgruppen have already been created:' => 'Die folgenden Buchungsgruppen wurden bereits angelegt:',
    'The following Datasets need to be updated' => 'Folgende Datenbanken müssen aktualisiert werden',
+   'The following currencies have been used, but they are not defined:' => 'Die folgenden Währungen wurden benutzt, sind aber nicht ordnungsgemäß in der Datenbank eingetragen:',
    'The following drafts have been saved and can be loaded.' => 'Die folgenden Entw&uuml;rfe wurden gespeichert und k&ouml;nnen geladen werden.',
    'The following old files whose settings have to be merged manually into the new configuration file "config/kivitendo.conf" still exist:' => 'Es existieren noch die folgenden alten Dateien, deren Einstellungen manuell in die neue Konfiguratsdatei "config/kivitendo.conf" migriert werden müssen:',
    'The following transaction contains wrong taxes:' => 'Die folgende Buchung enthält falsche Steuern:',
    'There are no entries in the background job history.' => 'Es gibt keine Einträge im Hintergrund-Job-Verlauf.',
    'There are no items in stock.' => 'Dieser Artikel ist nicht eingelagert.',
    'There are no items on your TODO list at the moment.' => 'Ihre Aufgabenliste enth&auml;lt momentan keine Eintr&auml;ge.',
+   'There are several options you can handle this problem, please select one:' => 'Bitte wählen Sie eine der folgenden Optionen, um mit dem Problem umzugehen:',
    'There are still entries in the database for which no unit has been assigned.' => 'Es gibt noch Eintr&auml;ge in der Datenbank, f&uuml;r die keine Einheit zugeordnet ist.',
    'There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?' => 'Einige der Lagerbewegungen sind nicht vollständig und Lagerbewegungen können nachträglich nicht mehr verändert werden. Wollen Sie wirklich fortfahren?',
+   'There are undefined currencies in your system.' => 'In Ihrer Datenbank wurden Währungen benutzt, die nicht ordnungsgemäß in den Währungen eingetragen wurden.',
    'There are usually three ways to install Perl modules.' => 'Es gibt normalerweise drei Arten, ein Perlmodul zu installieren.',
    'There is already a taxkey 0 with tax rate not 0.' => 'Es existiert bereits ein Steuerschlüssel mit Steuersatz ungleich 0%.',
    'There is an inconsistancy in your database.' => 'In Ihrer Datenbank sind Unstimmigkeiten vorhanden.',
    'Top (Javascript)'            => 'Oben (mit Javascript)',
    'Top 100'                     => 'Top 100',
    'Top 100 hinzufuegen'         => 'Top 100 hinzufügen',
 -  'Top Level'                   => 'Hauptartikelbezeichnung',
 +  'Top Level Designation only'  => 'Nur Hauptartikelbezeichnung',
    'Total'                       => 'Summe',
    'Total Fees'                  => 'Kumulierte Gebühren',
    'Total stock value'           => 'Gesamter Bestandswert',
    'You cannot create an invoice for delivery orders from different vendors.' => 'Sie können keine Rechnung aus Lieferscheinen von verschiedenen Lieferanten erstellen.',
    'You do not have the permissions to access this function.' => 'Sie verf&uuml;gen nicht &uuml;ber die notwendigen Rechte, um auf diese Funktion zuzugreifen.',
    'You have entered or selected the following shipping address for this customer:' => 'Sie haben die folgende Lieferadresse eingegeben oder ausgew&auml;hlt:',
+   'You have never worked with currencies.' => 'Sie haben noch nie  mit Währungen gearbeitet.',
    'You have not added bank accounts yet.' => 'Sie haben noch keine Bankkonten angelegt.',
    'You have not selected any delivery order.' => 'Sie haben keinen Lieferschein ausgewählt.',
    'You have not selected any export.' => 'Sie haben keinen Export ausgewählt.',