Revision bc433711
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
3507 | 3507 |
$main::lxdebug->leave_sub(); |
3508 | 3508 |
} |
3509 | 3509 |
|
3510 |
sub format_dates { |
|
3511 |
my ($self, $dateformat, $longformat, @indices) = @_; |
|
3512 |
|
|
3513 |
$dateformat ||= $::myconfig{dateformat}; |
|
3514 |
|
|
3515 |
foreach my $idx (@indices) { |
|
3516 |
if ($self->{TEMPLATE_ARRAYS} && (ref($self->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
3517 |
for (my $i = 0; $i < scalar(@{ $self->{TEMPLATE_ARRAYS}->{$idx} }); $i++) { |
|
3518 |
$self->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $::locale->reformat_date(\%::myconfig, $self->{TEMPLATE_ARRAYS}->{$idx}->[$i], $dateformat, $longformat); |
|
3519 |
} |
|
3520 |
} |
|
3521 |
|
|
3522 |
next unless defined $self->{$idx}; |
|
3523 |
|
|
3524 |
if (!ref($self->{$idx})) { |
|
3525 |
$self->{$idx} = $::locale->reformat_date(\%::myconfig, $self->{$idx}, $dateformat, $longformat); |
|
3526 |
|
|
3527 |
} elsif (ref($self->{$idx}) eq "ARRAY") { |
|
3528 |
for (my $i = 0; $i < scalar(@{ $self->{$idx} }); $i++) { |
|
3529 |
$self->{$idx}->[$i] = $::locale->reformat_date(\%::myconfig, $self->{$idx}->[$i], $dateformat, $longformat); |
|
3530 |
} |
|
3531 |
} |
|
3532 |
} |
|
3533 |
} |
|
3534 |
|
|
3535 |
sub reformat_numbers { |
|
3536 |
my ($self, $numberformat, $places, @indices) = @_; |
|
3537 |
|
|
3538 |
return if !$numberformat || ($numberformat eq $::myconfig{numberformat}); |
|
3539 |
|
|
3540 |
foreach my $idx (@indices) { |
|
3541 |
if ($self->{TEMPLATE_ARRAYS} && (ref($self->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
3542 |
for (my $i = 0; $i < scalar(@{ $self->{TEMPLATE_ARRAYS}->{$idx} }); $i++) { |
|
3543 |
$self->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $self->parse_amount(\%::myconfig, $self->{TEMPLATE_ARRAYS}->{$idx}->[$i]); |
|
3544 |
} |
|
3545 |
} |
|
3546 |
|
|
3547 |
next unless defined $self->{$idx}; |
|
3548 |
|
|
3549 |
if (!ref($self->{$idx})) { |
|
3550 |
$self->{$idx} = $self->parse_amount(\%::myconfig, $self->{$idx}); |
|
3551 |
|
|
3552 |
} elsif (ref($self->{$idx}) eq "ARRAY") { |
|
3553 |
for (my $i = 0; $i < scalar(@{ $self->{$idx} }); $i++) { |
|
3554 |
$self->{$idx}->[$i] = $self->parse_amount(\%::myconfig, $self->{$idx}->[$i]); |
|
3555 |
} |
|
3556 |
} |
|
3557 |
} |
|
3558 |
|
|
3559 |
my $saved_numberformat = $::myconfig{numberformat}; |
|
3560 |
$::myconfig{numberformat} = $numberformat; |
|
3561 |
|
|
3562 |
foreach my $idx (@indices) { |
|
3563 |
if ($self->{TEMPLATE_ARRAYS} && (ref($self->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
3564 |
for (my $i = 0; $i < scalar(@{ $self->{TEMPLATE_ARRAYS}->{$idx} }); $i++) { |
|
3565 |
$self->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $self->format_amount(\%::myconfig, $self->{TEMPLATE_ARRAYS}->{$idx}->[$i], $places); |
|
3566 |
} |
|
3567 |
} |
|
3568 |
|
|
3569 |
next unless defined $self->{$idx}; |
|
3570 |
|
|
3571 |
if (!ref($self->{$idx})) { |
|
3572 |
$self->{$idx} = $self->format_amount(\%::myconfig, $self->{$idx}, $places); |
|
3573 |
|
|
3574 |
} elsif (ref($self->{$idx}) eq "ARRAY") { |
|
3575 |
for (my $i = 0; $i < scalar(@{ $self->{$idx} }); $i++) { |
|
3576 |
$self->{$idx}->[$i] = $self->format_amount(\%::myconfig, $self->{$idx}->[$i], $places); |
|
3577 |
} |
|
3578 |
} |
|
3579 |
} |
|
3580 |
|
|
3581 |
$::myconfig{numberformat} = $saved_numberformat; |
|
3582 |
} |
|
3583 |
|
|
3510 | 3584 |
1; |
3511 | 3585 |
|
3512 | 3586 |
__END__ |
bin/mozilla/common.pl | ||
---|---|---|
386 | 386 |
} |
387 | 387 |
|
388 | 388 |
sub format_dates { |
389 |
$main::lxdebug->enter_sub(); |
|
390 |
|
|
391 |
my ($dateformat, $longformat, @indices) = @_; |
|
392 |
|
|
393 |
my $form = $main::form; |
|
394 |
my %myconfig = %main::myconfig; |
|
395 |
my $locale = $main::locale; |
|
396 |
|
|
397 |
$dateformat = $myconfig{"dateformat"} unless ($dateformat); |
|
398 |
|
|
399 |
foreach my $idx (@indices) { |
|
400 |
if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
401 |
for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { |
|
402 |
$form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = |
|
403 |
$locale->reformat_date(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], |
|
404 |
$dateformat, $longformat); |
|
405 |
} |
|
406 |
} |
|
407 |
|
|
408 |
next unless (defined($form->{$idx})); |
|
409 |
|
|
410 |
if (!ref($form->{$idx})) { |
|
411 |
$form->{$idx} = $locale->reformat_date(\%myconfig, $form->{$idx}, |
|
412 |
$dateformat, $longformat); |
|
413 |
|
|
414 |
} elsif (ref($form->{$idx}) eq "ARRAY") { |
|
415 |
for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { |
|
416 |
$form->{$idx}->[$i] = |
|
417 |
$locale->reformat_date(\%myconfig, $form->{$idx}->[$i], |
|
418 |
$dateformat, $longformat); |
|
419 |
} |
|
420 |
} |
|
421 |
} |
|
422 |
|
|
423 |
$main::lxdebug->leave_sub(); |
|
389 |
return $::form->format_dates(@_); |
|
424 | 390 |
} |
425 | 391 |
|
426 | 392 |
sub reformat_numbers { |
427 |
$main::lxdebug->enter_sub(); |
|
428 |
|
|
429 |
my ($numberformat, $places, @indices) = @_; |
|
430 |
|
|
431 |
my $form = $main::form; |
|
432 |
my %myconfig = %main::myconfig; |
|
433 |
|
|
434 |
return $main::lxdebug->leave_sub() |
|
435 |
if (!$numberformat || ($numberformat eq $myconfig{"numberformat"})); |
|
436 |
|
|
437 |
foreach my $idx (@indices) { |
|
438 |
if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
439 |
for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { |
|
440 |
$form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->parse_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i]); |
|
441 |
} |
|
442 |
} |
|
443 |
|
|
444 |
next unless (defined($form->{$idx})); |
|
445 |
|
|
446 |
if (!ref($form->{$idx})) { |
|
447 |
$form->{$idx} = $form->parse_amount(\%myconfig, $form->{$idx}); |
|
448 |
|
|
449 |
} elsif (ref($form->{$idx}) eq "ARRAY") { |
|
450 |
for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { |
|
451 |
$form->{$idx}->[$i] = |
|
452 |
$form->parse_amount(\%myconfig, $form->{$idx}->[$i]); |
|
453 |
} |
|
454 |
} |
|
455 |
} |
|
456 |
|
|
457 |
my $saved_numberformat = $myconfig{"numberformat"}; |
|
458 |
$myconfig{"numberformat"} = $numberformat; |
|
459 |
|
|
460 |
foreach my $idx (@indices) { |
|
461 |
if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
462 |
for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { |
|
463 |
$form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->format_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], $places); |
|
464 |
} |
|
465 |
} |
|
466 |
|
|
467 |
next unless (defined($form->{$idx})); |
|
468 |
|
|
469 |
if (!ref($form->{$idx})) { |
|
470 |
$form->{$idx} = $form->format_amount(\%myconfig, $form->{$idx}, $places); |
|
471 |
|
|
472 |
} elsif (ref($form->{$idx}) eq "ARRAY") { |
|
473 |
for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { |
|
474 |
$form->{$idx}->[$i] = |
|
475 |
$form->format_amount(\%myconfig, $form->{$idx}->[$i], $places); |
|
476 |
} |
|
477 |
} |
|
478 |
} |
|
479 |
|
|
480 |
$myconfig{"numberformat"} = $saved_numberformat; |
|
481 |
|
|
482 |
$main::lxdebug->leave_sub(); |
|
483 |
} |
|
484 |
|
|
485 |
# ------------------------------------------------------------------------- |
|
486 |
|
|
487 |
sub show_history { |
|
488 |
$main::lxdebug->enter_sub(); |
|
489 |
|
|
490 |
my $form = $main::form; |
|
491 |
my %myconfig = %main::myconfig; |
|
492 |
my $locale = $main::locale; |
|
493 |
|
|
494 |
my $dbh = $form->dbconnect(\%myconfig); |
|
495 |
my ($sort, $sortby) = split(/\-\-/, $form->{order}); |
|
496 |
$sort =~ s/.*\.(.*)/$1/; |
|
497 |
|
|
498 |
$form->{title} = $locale->text("History"); |
|
499 |
$form->header(); |
|
500 |
print $form->parse_html_template( "common/show_history", { |
|
501 |
"DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}), |
|
502 |
"SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), |
|
503 |
uc($sort) => 1, |
|
504 |
uc($sort)."BY" => $sortby |
|
505 |
} ); |
|
506 |
|
|
507 |
$dbh->disconnect(); |
|
508 |
$main::lxdebug->leave_sub(); |
|
393 |
return $::form->format_numbers(@_); |
|
509 | 394 |
} |
510 | 395 |
|
511 | 396 |
# ------------------------------------------------------------------------- |
Auch abrufbar als: Unified diff
Funktionen format_dates und reformat_numbers von common.pl nach Form.pm verschoben