X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=582d2aff8edc33ee04ca949fd389de145558d644;hb=af56ae02cd83ad4fff35a3ef695a9fcf4c074caf;hp=dfff9b4f7bd6444c6d24e0dc965704bad51309d4;hpb=1df2efffbb760f0c7ad5e32e40807beadc227b80;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index dfff9b4f7..582d2aff8 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -640,6 +640,18 @@ sub create_http_response { return $output; } +sub use_stylesheet { + my $self = shift; + + $self->{stylesheet} = [ $self->{stylesheet} ] unless ref $self->{stylesheet} eq 'ARRAY'; + $self->{stylesheet} = [ grep { -f } + map { m:^css/: ? $_ : "css/$_" } + grep { $_ } + (@{ $self->{stylesheet} }, @_) + ]; + + return @{ $self->{stylesheet} }; +} sub header { $::lxdebug->enter_sub; @@ -662,8 +674,7 @@ sub header { push @header, ""; } - push @header, "" - for grep { -f "css/$_" } apply { s|.*/|| } $self->{stylesheet}, $self->{stylesheets}; + push @header, map { qq|| } $self->use_stylesheet; push @header, "" if $self->{landscape}; push @header, "" if -f $self->{favicon}; @@ -1153,7 +1164,7 @@ sub parse_amount { if ( ($myconfig->{numberformat} eq '1.000,00') || ($myconfig->{numberformat} eq '1000,00')) { $amount =~ s/\.//g; - $amount =~ s/,/\./; + $amount =~ s/,/\./g; } if ($myconfig->{numberformat} eq "1'000.00") { @@ -1164,7 +1175,9 @@ sub parse_amount { $main::lxdebug->leave_sub(2); - return ($amount * 1); + # Make sure no code wich is not a math expression ends up in eval(). + return 0 unless $amount =~ /^ [\s \d \( \) \- \+ \* \/ \. ]* $/x; + return scalar(eval($amount)) * 1 ; } sub round_amount { @@ -1638,7 +1651,7 @@ sub date_closed { # Leere Datumseingabe i.O. # SELECT 1 FROM defaults WHERE '' < closedto # normale Zahlungsbuchung über Rechnungsmaske i.O. - # SELECT 1 FROM defaults WHERE '10.05.2011' < closedto + # SELECT 1 FROM defaults WHERE '10.05.2011' < closedto # Testfälle mit definiertem closedto (30.04.2011): # Leere Datumseingabe i.O. # SELECT 1 FROM defaults WHERE '' < closedto @@ -1862,12 +1875,12 @@ sub set_payment_options { my $dbh = $self->get_standard_dbh($myconfig); my $query = - qq|SELECT p.terms_netto, p.terms_skonto, p.percent_skonto, p.description_long | . + qq|SELECT p.terms_netto, p.terms_skonto, p.percent_skonto, p.description_long , p.description | . qq|FROM payment_terms p | . qq|WHERE p.id = ?|; ($self->{terms_netto}, $self->{terms_skonto}, $self->{percent_skonto}, - $self->{payment_terms}) = + $self->{payment_terms}, $self->{payment_description}) = selectrow_query($self, $dbh, $query, $self->{payment_id}); if ($transdate eq "") { @@ -3812,7 +3825,7 @@ Examples: =head2 C
Generates a general purpose http/html header and includes most of the scripts -ans stylesheets needed. +and stylesheets needed. Stylesheets can be added with L. Only one header will be generated. If the method was already called in this request it will not output anything and return undef. Also if no @@ -3832,9 +3845,8 @@ default to 3 seconds and the refering url. =item stylesheet -=item stylesheets - -If these are arrayrefs the contents will be inlined into the header. +Either a scalar or an array ref. Will be inlined into the header. Add +stylesheets with the L function. =item landscape