]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Form.pm
Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
[mfinanz.git] / SL / Form.pm
index 48744060fe68b09d85b23b21ee789e20ce46c7a6..6c3b297dbbddf59070dbd899709ccf4d5f7b5981 100644 (file)
@@ -852,6 +852,7 @@ sub format_amount {
   $main::lxdebug->enter_sub(2);
 
   my ($self, $myconfig, $amount, $places, $dash) = @_;
+  $dash ||= '';
 
   if ($amount eq "") {
     $amount = 0;
@@ -868,9 +869,10 @@ sub format_amount {
         $amount *= 1;
         $places *= -1;
 
-        my ($actual_places) = ($amount =~ /\.(\d+)/);
-        $actual_places = length($actual_places);
-        $places = $actual_places > $places ? $actual_places : $places;
+        if ($amount =~ /\.(\d+)/) {
+          my $actual_places = length $1;
+          $places = $actual_places if $actual_places > $places;
+        }
       }
     }
     $amount = $self->round_amount($amount, $places);
@@ -882,7 +884,7 @@ sub format_amount {
   $p[0] =~ s/\B(?=(...)*$)/$d[1]/g if $d[1]; # add 1,000 delimiters
 
   $amount = $p[0];
-  $amount .= $d[0].$p[1].(0 x ($places - length $p[1])) if ($places || $p[1] ne '');
+  $amount .= $d[0].($p[1]||'').(0 x ($places - length ($p[1]||''))) if ($places || $p[1] ne '');
 
   $amount = do {
     ($dash =~ /-/)    ? ($neg ? "($amount)"                            : "$amount" )                              :
@@ -1246,22 +1248,22 @@ sub get_formname_translation {
   $formname ||= $self->{formname};
 
   $self->{recipient_locale} ||=  Locale->lang_to_locale($self->{language});
-  my $recipient_locale = Locale->new($self->{recipient_locale});
+  local $::locale = Locale->new($self->{recipient_locale});
 
   my %formname_translations = (
-    bin_list                => $recipient_locale->text('Bin List'),
-    credit_note             => $recipient_locale->text('Credit Note'),
-    invoice                 => $recipient_locale->text('Invoice'),
-    pick_list               => $recipient_locale->text('Pick List'),
-    proforma                => $recipient_locale->text('Proforma Invoice'),
-    purchase_order          => $recipient_locale->text('Purchase Order'),
-    request_quotation       => $recipient_locale->text('RFQ'),
-    sales_order             => $recipient_locale->text('Confirmation'),
-    sales_quotation         => $recipient_locale->text('Quotation'),
-    storno_invoice          => $recipient_locale->text('Storno Invoice'),
-    sales_delivery_order    => $recipient_locale->text('Delivery Order'),
-    purchase_delivery_order => $recipient_locale->text('Delivery Order'),
-    dunning                 => $recipient_locale->text('Dunning'),
+    bin_list                => $main::locale->text('Bin List'),
+    credit_note             => $main::locale->text('Credit Note'),
+    invoice                 => $main::locale->text('Invoice'),
+    pick_list               => $main::locale->text('Pick List'),
+    proforma                => $main::locale->text('Proforma Invoice'),
+    purchase_order          => $main::locale->text('Purchase Order'),
+    request_quotation       => $main::locale->text('RFQ'),
+    sales_order             => $main::locale->text('Confirmation'),
+    sales_quotation         => $main::locale->text('Quotation'),
+    storno_invoice          => $main::locale->text('Storno Invoice'),
+    sales_delivery_order    => $main::locale->text('Delivery Order'),
+    purchase_delivery_order => $main::locale->text('Delivery Order'),
+    dunning                 => $main::locale->text('Dunning'),
   );
 
   $main::lxdebug->leave_sub();
@@ -1962,7 +1964,7 @@ sub get_employee_data {
   my ($login)  = selectrow_query($self, $dbh, qq|SELECT login FROM employee WHERE id = ?|, conv_i($params{id}));
 
   if ($login) {
-    my $user = User->new($login);
+    my $user = User->new(login => $login);
     map { $self->{$params{prefix} . "_${_}"} = $user->{$_}; } qw(address businessnumber co_ustid company duns email fax name signature taxnumber tel);
 
     $self->{$params{prefix} . '_login'}   = $login;
@@ -2519,7 +2521,7 @@ sub get_name {
   return scalar(@{ $self->{name_list} });
 }
 
-# the selection sub is used in the AR, AP, IS, IR and OE module
+# the selection sub is used in the AR, AP, IS, IR, DO and OE module
 #
 sub all_vc {
   $main::lxdebug->enter_sub();