X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcommon.pl;h=dfa7d0f788517128b98c86b4dabe6bfbb08dacf4;hb=470a8fa1710b22e2b381eef4cacb01bebaeff725;hp=6729d16a2301d96d63aa1cb664c12ed1b98f9817;hpb=4b937d1a3839d8235a650172a59998c1b7126e22;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 6729d16a2..dfa7d0f78 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -11,9 +11,11 @@ use Carp; use SL::Common; +use SL::DB::Helper::Mappings; use SL::DBUtils; use SL::Form; use SL::MoreCommon; +use SL::Helper::Flash; use strict; @@ -385,100 +387,11 @@ sub NTI { } sub format_dates { - $main::lxdebug->enter_sub(); - - my ($dateformat, $longformat, @indices) = @_; - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $dateformat = $myconfig{"dateformat"} unless ($dateformat); - - foreach my $idx (@indices) { - if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { - for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { - $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = - $locale->reformat_date(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], - $dateformat, $longformat); - } - } - - next unless (defined($form->{$idx})); - - if (!ref($form->{$idx})) { - $form->{$idx} = $locale->reformat_date(\%myconfig, $form->{$idx}, - $dateformat, $longformat); - - } elsif (ref($form->{$idx}) eq "ARRAY") { - for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { - $form->{$idx}->[$i] = - $locale->reformat_date(\%myconfig, $form->{$idx}->[$i], - $dateformat, $longformat); - } - } - } - - $main::lxdebug->leave_sub(); + return $::form->format_dates(@_); } sub reformat_numbers { - $main::lxdebug->enter_sub(); - - my ($numberformat, $places, @indices) = @_; - - my $form = $main::form; - my %myconfig = %main::myconfig; - - return $main::lxdebug->leave_sub() - if (!$numberformat || ($numberformat eq $myconfig{"numberformat"})); - - foreach my $idx (@indices) { - if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { - for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { - $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->parse_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i]); - } - } - - next unless (defined($form->{$idx})); - - if (!ref($form->{$idx})) { - $form->{$idx} = $form->parse_amount(\%myconfig, $form->{$idx}); - - } elsif (ref($form->{$idx}) eq "ARRAY") { - for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { - $form->{$idx}->[$i] = - $form->parse_amount(\%myconfig, $form->{$idx}->[$i]); - } - } - } - - my $saved_numberformat = $myconfig{"numberformat"}; - $myconfig{"numberformat"} = $numberformat; - - foreach my $idx (@indices) { - if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { - for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { - $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->format_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], $places); - } - } - - next unless (defined($form->{$idx})); - - if (!ref($form->{$idx})) { - $form->{$idx} = $form->format_amount(\%myconfig, $form->{$idx}, $places); - - } elsif (ref($form->{$idx}) eq "ARRAY") { - for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { - $form->{$idx}->[$i] = - $form->format_amount(\%myconfig, $form->{$idx}->[$i], $places); - } - } - } - - $myconfig{"numberformat"} = $saved_numberformat; - - $main::lxdebug->leave_sub(); + return $::form->reformat_numbers(@_); } # ------------------------------------------------------------------------- @@ -727,4 +640,8 @@ sub gl_transaction { $main::lxdebug->leave_sub(); } +sub db { + goto &SL::DB::Helper::Mappings::db; +} + 1;