diff options
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/DBObject.pm | 4 | ||||
-rw-r--r-- | LedgerSMB/DBObject/Company.pm | 7 | ||||
-rw-r--r-- | LedgerSMB/DBObject/Payment.pm | 9 | ||||
-rwxr-xr-x | LedgerSMB/Template.pm | 13 | ||||
-rwxr-xr-x | LedgerSMB/Template/LaTeX.pm | 3 |
5 files changed, 30 insertions, 6 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 07b2b0a6..d2ce0fbb 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -73,10 +73,10 @@ sub new { my $attr; if (lc($mode) eq 'base'){ - $self->merge($base, 'dbh', '_roles'); + $self->merge($base, keys => ['dbh', '_roles', '_user', '_locale']); } elsif (lc($mode) eq 'list'){ - $self->merge($base, @mergelist); + $self->merge($base, keys => \@mergelist); } else { $self->merge($base); diff --git a/LedgerSMB/DBObject/Company.pm b/LedgerSMB/DBObject/Company.pm index 1e4ca4d5..23a56cec 100644 --- a/LedgerSMB/DBObject/Company.pm +++ b/LedgerSMB/DBObject/Company.pm @@ -183,6 +183,13 @@ sub search { return @{$self->{search_results}}; } +sub get_billing_info { + my $self = shift @_; + $self->set_entity_class(); + my ($ref) = $self->exec_method(funcname => 'company_get_billing_info'); + $self->merge($ref); +} + sub get { my $self = shift @_; diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm index 6cc23f2e..50e7829f 100644 --- a/LedgerSMB/DBObject/Payment.pm +++ b/LedgerSMB/DBObject/Payment.pm @@ -61,6 +61,15 @@ sub __validate__ { ($self->{current_date}) = $self->{dbh}->selectrow_array('select current_date'); } +sub text_amount { + use LedgerSMB::Num2text; + print STDERR "num2text\n"; + my ($self, $value) = @_; + $self->{locale} = $self->{_locale}; + $self->init(); + return $self->num2text($value); +} + sub get_metadata { my ($self) = @_; $self->list_open_projects(); diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm index e87251fd..2d1fd130 100755 --- a/LedgerSMB/Template.pm +++ b/LedgerSMB/Template.pm @@ -181,6 +181,7 @@ sub new { .";$self->{'include_path'}" } } + print STDERR "include path: $self->{'include_path'} \n"; return $self; } @@ -293,12 +294,20 @@ sub output { } sub _http_output { - my $self = shift; - my $data = shift; + my ($self, $data) = @_; $data ||= $self->{output}; if ($self->{format} !~ /^\p{IsAlnum}+$/) { throw Error::Simple "Invalid format"; } + + if (!defined $data and defined $self->{rendered}){ + $data = ""; + open (DATA, '<', $self->{rendered}); + while (my $line = <DATA>){ + $data .= $line; + } + } + my $format = "LedgerSMB::Template::$self->{format}"; my $disposition = ""; my $name = $format->can('postprocess')->($self); diff --git a/LedgerSMB/Template/LaTeX.pm b/LedgerSMB/Template/LaTeX.pm index 71ddfce8..00f283fa 100755 --- a/LedgerSMB/Template/LaTeX.pm +++ b/LedgerSMB/Template/LaTeX.pm @@ -70,7 +70,7 @@ sub preprocess { for (@{$rawvars}) { push @{$vars}, preprocess($_); } - } elsif (!$type or $type eq 'SCALAR') { + } elsif (!$type or $type eq 'SCALAR' or $type eq 'Math::BigInt::GMP') { if ($type eq 'SCALAR' or $type eq 'Math::BigInt::GMP') { $vars = $$rawvars; } else { @@ -120,7 +120,6 @@ sub process { DEBUG => ($parent->{debug})? 'dirs': undef, DEBUG_FORMAT => '', }) || throw Error::Simple Template::Latex->error(); - if (not $template->process( $source, {%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs, |