40 |
40 |
use HTML::Template;
|
41 |
41 |
|
42 |
42 |
sub _input_to_hash {
|
43 |
|
$main::lxdebug->enter_sub();
|
|
43 |
$main::lxdebug->enter_sub(2);
|
44 |
44 |
|
45 |
45 |
my $input = $_[0];
|
46 |
46 |
my %in = ();
|
... | ... | |
51 |
51 |
$in{$name} = unescape(undef, $value);
|
52 |
52 |
}
|
53 |
53 |
|
54 |
|
$main::lxdebug->leave_sub();
|
|
54 |
$main::lxdebug->leave_sub(2);
|
55 |
55 |
|
56 |
56 |
return %in;
|
57 |
57 |
}
|
58 |
58 |
|
59 |
59 |
sub _request_to_hash {
|
60 |
|
$main::lxdebug->enter_sub();
|
|
60 |
$main::lxdebug->enter_sub(2);
|
61 |
61 |
|
62 |
62 |
my ($input) = @_;
|
63 |
63 |
my ($i, $loc, $key, $val);
|
... | ... | |
108 |
108 |
}
|
109 |
109 |
}
|
110 |
110 |
|
111 |
|
$main::lxdebug->leave_sub();
|
|
111 |
$main::lxdebug->leave_sub(2);
|
112 |
112 |
return %ATTACH;
|
113 |
113 |
|
114 |
114 |
} else {
|
115 |
|
$main::lxdebug->leave_sub();
|
|
115 |
$main::lxdebug->leave_sub(2);
|
116 |
116 |
return _input_to_hash($input);
|
117 |
117 |
}
|
118 |
118 |
}
|
... | ... | |
162 |
162 |
}
|
163 |
163 |
|
164 |
164 |
sub escape {
|
165 |
|
$main::lxdebug->enter_sub();
|
|
165 |
$main::lxdebug->enter_sub(2);
|
166 |
166 |
|
167 |
167 |
my ($self, $str, $beenthere) = @_;
|
168 |
168 |
|
... | ... | |
173 |
173 |
|
174 |
174 |
$str =~ s/([^a-zA-Z0-9_.-])/sprintf("%%%02x", ord($1))/ge;
|
175 |
175 |
|
176 |
|
$main::lxdebug->leave_sub();
|
|
176 |
$main::lxdebug->leave_sub(2);
|
177 |
177 |
|
178 |
178 |
return $str;
|
179 |
179 |
}
|
180 |
180 |
|
181 |
181 |
sub unescape {
|
182 |
|
$main::lxdebug->enter_sub();
|
|
182 |
$main::lxdebug->enter_sub(2);
|
183 |
183 |
|
184 |
184 |
my ($self, $str) = @_;
|
185 |
185 |
|
... | ... | |
188 |
188 |
|
189 |
189 |
$str =~ s/%([0-9a-fA-Z]{2})/pack("c",hex($1))/eg;
|
190 |
190 |
|
191 |
|
$main::lxdebug->leave_sub();
|
|
191 |
$main::lxdebug->leave_sub(2);
|
192 |
192 |
|
193 |
193 |
return $str;
|
194 |
194 |
}
|
... | ... | |
578 |
578 |
}
|
579 |
579 |
|
580 |
580 |
sub format_amount {
|
581 |
|
$main::lxdebug->enter_sub();
|
|
581 |
$main::lxdebug->enter_sub(2);
|
582 |
582 |
|
583 |
583 |
my ($self, $myconfig, $amount, $places, $dash) = @_;
|
584 |
584 |
|
... | ... | |
643 |
643 |
}
|
644 |
644 |
}
|
645 |
645 |
|
646 |
|
$main::lxdebug->leave_sub();
|
|
646 |
$main::lxdebug->leave_sub(2);
|
647 |
647 |
|
648 |
648 |
return $amount;
|
649 |
649 |
}
|
650 |
650 |
|
651 |
651 |
sub parse_amount {
|
652 |
|
$main::lxdebug->enter_sub();
|
|
652 |
$main::lxdebug->enter_sub(2);
|
653 |
653 |
|
654 |
654 |
my ($self, $myconfig, $amount) = @_;
|
655 |
|
$main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount");
|
656 |
655 |
|
657 |
656 |
if ($myconfig->{in_numberformat} == 1) {
|
658 |
|
|
659 |
657 |
# Extra input number format 1000.00 or 1000,00
|
660 |
|
$main::lxdebug->message(LXDebug::DEBUG2,
|
661 |
|
"in_numberformat: " . $main::locale->text('1000,00 or 1000.00'));
|
662 |
658 |
$amount =~ s/,/\./g;
|
663 |
|
|
664 |
|
#$main::lxdebug->message(LXDebug::DEBUG2, "1.Parsed Number: $amount") if ($amount);
|
665 |
659 |
$amount = scalar reverse $amount;
|
666 |
|
|
667 |
|
#$main::lxdebug->message(LXDebug::DEBUG2, "2.Parsed Number: $amount") if ($amount);
|
668 |
660 |
$amount =~ s/\./DOT/;
|
669 |
|
|
670 |
|
#$main::lxdebug->message(LXDebug::DEBUG2, "3.Parsed Number: $amount") if ($amount);
|
671 |
661 |
$amount =~ s/\.//g;
|
672 |
|
|
673 |
|
#$main::lxdebug->message(LXDebug::DEBUG2, "4.Parsed Number: $amount") if ($amount);
|
674 |
662 |
$amount =~ s/DOT/\./;
|
675 |
|
|
676 |
|
#$main::lxdebug->message(LXDebug::DEBUG2, "5.Parsed Number:" . $amount) if ($amount);
|
677 |
663 |
$amount = scalar reverse $amount;
|
678 |
|
$main::lxdebug->message(LXDebug::DEBUG2,
|
679 |
|
"Parsed amount:" . $amount . "\n");
|
680 |
|
|
|
664 |
$main::lxdebug->leave_sub(2);
|
681 |
665 |
return ($amount * 1);
|
682 |
|
|
683 |
666 |
}
|
684 |
|
$main::lxdebug->message(LXDebug::DEBUG2,
|
685 |
|
"in_numberformat: " . $main::locale->text('equal Outputformat'));
|
686 |
|
$main::lxdebug->message(LXDebug::DEBUG2,
|
687 |
|
" = numberformat: $myconfig->{numberformat}");
|
|
667 |
|
688 |
668 |
if ( ($myconfig->{numberformat} eq '1.000,00')
|
689 |
669 |
|| ($myconfig->{numberformat} eq '1000,00')) {
|
690 |
670 |
$amount =~ s/\.//g;
|
... | ... | |
697 |
677 |
|
698 |
678 |
$amount =~ s/,//g;
|
699 |
679 |
|
700 |
|
$main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n")
|
701 |
|
if ($amount);
|
702 |
|
$main::lxdebug->leave_sub();
|
|
680 |
$main::lxdebug->leave_sub(2);
|
703 |
681 |
|
704 |
682 |
return ($amount * 1);
|
705 |
683 |
}
|
706 |
684 |
|
707 |
685 |
sub round_amount {
|
708 |
|
$main::lxdebug->enter_sub();
|
|
686 |
$main::lxdebug->enter_sub(2);
|
709 |
687 |
|
710 |
688 |
my ($self, $amount, $places) = @_;
|
711 |
689 |
my $round_amount;
|
... | ... | |
719 |
697 |
$amount = $amount * (10**($places));
|
720 |
698 |
$round_amount = int($amount + .5 * ($amount <=> 0)) / (10**($places));
|
721 |
699 |
|
722 |
|
$main::lxdebug->leave_sub();
|
|
700 |
$main::lxdebug->leave_sub(2);
|
723 |
701 |
|
724 |
702 |
return $round_amount;
|
725 |
703 |
|
Trace Levels Hack. Wenn es koennen jetzt in den lxdebug->enter_sub und leave_sub Aufrufen Tracelevels uebergeben werden. Ist das global_trace_subs geringer, werden diese in den Traceausgaben ignoriert. Standardmaessig ist das jetzt bei Menu::access_control und Form::unescape der Fall.
Um (derzeit) alle Traceausgaben zu bekommen in der lx-erp.conf $global_trabce_subs = 2; setzen.
Debugausgaben entfernt.
parse_amount, format_amount und round_amount auf tracelevel 2 gesetzt. Trace breaker in parse_amount gefixt.
[Merge der Revisionen 943:945 957 aus dem LINET prog Repo]