summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-04 23:04:16 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-04 23:04:16 +0000
commit025fd80e331af9a44552efd5be8ae35b4825e7f6 (patch)
tree4ca455281ae646c0174916434429b83331f2db04 /LedgerSMB
parentdb4f7ef7438761c71a7b95cf955f74d3a7f25c1b (diff)
Committing David Mora's single payment updates
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2185 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/AM.pm8
-rw-r--r--LedgerSMB/DBObject/Payment.pm21
-rwxr-xr-xLedgerSMB/Template.pm23
-rwxr-xr-xLedgerSMB/Template/LaTeX.pm6
4 files changed, 45 insertions, 13 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index e1ff4043..d502bc20 100644
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -159,10 +159,10 @@ sub save_account {
$form->{link} = "";
foreach my $item (
$form->{AR}, $form->{AR_amount}, $form->{AR_tax}, $form->{AR_overpayment},
- $form->{AR_paid}, $form->{AP}, $form->{AP_amount}, $form->{AP_overpayment},
- $form->{AP_tax}, $form->{AP_paid}, $form->{IC},
- $form->{IC_income}, $form->{IC_sale}, $form->{IC_expense},
- $form->{IC_cogs}, $form->{IC_taxpart}, $form->{IC_taxservice}
+ $form->{AR_discount}, $form->{AR_paid}, $form->{AP}, $form->{AP_amount},
+ $form->{AP_overpayment}, $form->{AP_discount}, $form->{AP_tax},
+ $form->{AP_paid}, $form->{IC}, $form->{IC_income}, $form->{IC_sale},
+ $form->{IC_expense}, $form->{IC_cogs}, $form->{IC_taxpart}, $form->{IC_taxservice}
)
{
$form->{link} .= "${item}:" if ($item);
diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm
index 02f3aad5..6cc23f2e 100644
--- a/LedgerSMB/DBObject/Payment.pm
+++ b/LedgerSMB/DBObject/Payment.pm
@@ -105,6 +105,16 @@ sub get_open_accounts {
return @{$self->{accounts}};
}
+
+sub get_entity_credit_account{
+ my ($self) = @_;
+ @{$self->{entity_accounts}} =
+ $self->exec_method(funcname => 'payment_get_entity_accounts');
+ return @{$self->{entity_accounts}};
+
+}
+
+
=over
=item $payment->get_all_accounts()
@@ -499,4 +509,15 @@ sub check_job {
($self->{job}) = $self->exec_method(funcname => 'job__status');
}
+=item post_payment
+
+This method uses payment_post to store a payment (not a bulk payment) on the database.
+
+=cut
+
+sub post_payment {
+ my ($self) = @_;
+ $self->exec_method(funcname => 'payment_post');
+ $self->{dbh}->commit();
+}
1;
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index c7386928..e87251fd 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -263,8 +263,8 @@ sub render {
#return $format->can('postprocess')->($self);
my $post = $format->can('postprocess')->($self);
if (!$self->{'noauto'}) {
- $self->output;
# Clean up
+ $self->output;
if ($self->{rendered}) {
unlink($self->{rendered}) or
throw Error::Simple 'Unable to delete output file';
@@ -276,15 +276,17 @@ sub render {
sub output {
my $self = shift;
my %args = @_;
+ $self->{output_args} = \%args;
my $method = $self->{method} || $args{method} || $args{media};
-
if ('email' eq lc $method) {
$self->_email_output;
} elsif ('print' eq lc $method) {
$self->_lpr_output;
- } elsif (defined $self->{output}) {
+ } elsif (defined $self->{output} or $method = 'Screen') {
$self->_http_output;
exit;
+ } elsif (defined $method) {
+ $self->_lpr_output;
} else {
$self->_http_output_file;
}
@@ -376,15 +378,22 @@ sub _email_output {
}
sub _lpr_output {
- my ($self) = shift;
+ my ($self, $in_args) = shift;
my $args = $self->{output_args};
- if ($self->{format} != /(pdf|ps)/){
+ if ($self->{format} ne 'LaTeX') {
throw Error::Simple "Invalid Format";
}
- my $lpr = $LedgerSMB::Sysconfig::printer{$args->{printer}};
+ my $lpr = $LedgerSMB::Sysconfig::printer{$args->{media}};
open(LPR, '|-', $lpr);
- print LPR $self->{output};
+
+ # Output is not defined here. In the future we should consider
+ # changing this to use the system command and hit the file as an arg.
+ # -- CT
+ open (FILE, '<', "$self->{rendered}");
+ while (my $line = <FILE>){
+ print LPR $line;
+ }
close(LPR);
}
diff --git a/LedgerSMB/Template/LaTeX.pm b/LedgerSMB/Template/LaTeX.pm
index 973cb724..ea04bb80 100755
--- a/LedgerSMB/Template/LaTeX.pm
+++ b/LedgerSMB/Template/LaTeX.pm
@@ -77,8 +77,10 @@ sub preprocess {
$vars = $rawvars;
}
#XXX Fix escaping
- $vars =~ s/([&\$\\_<>~^#\%\{\}])/\\$1/g;
- $vars =~ s/"(.*)"/``$1''/gs;
+ if (defined $vars){
+ $vars =~ s/([&\$\\_<>~^#\%\{\}])/\\$1/g;
+ $vars =~ s/"(.*)"/``$1''/gs;
+ }
} else {
for ( keys %{$rawvars} ) {
$vars->{$_} = preprocess($rawvars->{$_});