+ $self->reformat_numbers($output_numberformat, undef, qw(qty price_factor), grep({ /^qty_\d+$/} keys(%{$self})));
+
+ my ($cvar_date_fields, $cvar_number_fields) = CVar->get_field_format_list('module' => 'CT', 'prefix' => 'vc_');
+
+ if (scalar @{ $cvar_date_fields }) {
+ $self->format_dates($output_dateformat, $output_longdates, @{ $cvar_date_fields });
+ }
+
+ while (my ($precision, $field_list) = each %{ $cvar_number_fields }) {
+ $self->reformat_numbers($output_numberformat, $precision, @{ $field_list });
+ }
+
+ return $self;
+}
+
+sub format_dates {
+ my ($self, $dateformat, $longformat, @indices) = @_;
+
+ $dateformat ||= $::myconfig{dateformat};
+
+ foreach my $idx (@indices) {
+ if ($self->{TEMPLATE_ARRAYS} && (ref($self->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) {
+ for (my $i = 0; $i < scalar(@{ $self->{TEMPLATE_ARRAYS}->{$idx} }); $i++) {
+ $self->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $::locale->reformat_date(\%::myconfig, $self->{TEMPLATE_ARRAYS}->{$idx}->[$i], $dateformat, $longformat);
+ }
+ }
+
+ next unless defined $self->{$idx};
+
+ if (!ref($self->{$idx})) {
+ $self->{$idx} = $::locale->reformat_date(\%::myconfig, $self->{$idx}, $dateformat, $longformat);
+
+ } elsif (ref($self->{$idx}) eq "ARRAY") {
+ for (my $i = 0; $i < scalar(@{ $self->{$idx} }); $i++) {
+ $self->{$idx}->[$i] = $::locale->reformat_date(\%::myconfig, $self->{$idx}->[$i], $dateformat, $longformat);
+ }
+ }
+ }
+}
+
+sub reformat_numbers {
+ my ($self, $numberformat, $places, @indices) = @_;
+
+ return if !$numberformat || ($numberformat eq $::myconfig{numberformat});
+
+ foreach my $idx (@indices) {
+ if ($self->{TEMPLATE_ARRAYS} && (ref($self->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) {
+ for (my $i = 0; $i < scalar(@{ $self->{TEMPLATE_ARRAYS}->{$idx} }); $i++) {
+ $self->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $self->parse_amount(\%::myconfig, $self->{TEMPLATE_ARRAYS}->{$idx}->[$i]);
+ }
+ }