summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-05-13 00:38:42 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-05-13 00:38:42 +0000
commit3d717fb381ffaec49a6457badd72b5095a60f1f6 (patch)
tree1918c6a6ecdc76404fb65b66ea42f5c40b8f9a7a /LedgerSMB
parent063d52183edfcd6d2a766bd6c9de0642d1731c13 (diff)
Correcting Customer/vendor name not showing up in certain cases
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2140 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/AA.pm14
-rw-r--r--LedgerSMB/Form.pm20
-rwxr-xr-xLedgerSMB/Template.pm12
3 files changed, 35 insertions, 11 deletions
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm
index 997d893b..ce8679a7 100644
--- a/LedgerSMB/AA.pm
+++ b/LedgerSMB/AA.pm
@@ -308,17 +308,18 @@ sub post_transaction {
# AR/AP Transaction.
# ~A
$query = qq|
- INSERT INTO $table (invnumber, person_id)
- VALUES (?, (select p.id from person p, entity e, users u
+ INSERT INTO $table (invnumber, person_id,
+ entity_credit_account)
+ VALUES (?, (select e.id from person p, entity e, users u
where u.username = ?
AND e.id = u.entity_id
- AND p.entity_id = e.id ))|;
+ AND p.entity_id = e.id ), ?)|;
# the second param is undef, as the DBI api expects a hashref of
# attributes to pass to $dbh->prepare. This is not used here.
# ~A
- $dbh->do($query,undef,$uid,$form->{login}) || $form->dberror($query);
+ $dbh->do($query,undef,$uid,$form->{login}, $form->{"$form->{vc}_id"}) || $form->dberror($query);
$query = qq|
SELECT id FROM $table
@@ -337,7 +338,6 @@ sub post_transaction {
SET invnumber = ?,
ordnumber = ?,
transdate = ?,
- entity_credit_account = ?,
taxincluded = ?,
amount = ?,
duedate = ?,
@@ -350,10 +350,10 @@ sub post_transaction {
ponumber = ?
WHERE id = ?
|;
-
+
my @queryargs = (
$form->{invnumber}, $form->{ordnumber},
- $form->{transdate}, $form->{"$form->{vc}_id"},
+ $form->{transdate},
$form->{taxincluded}, $invamount,
$form->{duedate}, $paid,
$datepaid, $invnetamount,
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index a71d7dca..b33a239a 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -1719,8 +1719,14 @@ $module and $dbh are unused.
sub all_vc {
my ( $self, $myconfig, $vc, $module, $dbh, $transdate, $job ) = @_;
-
my $ref;
+ my $table;
+
+ if ($module eq 'AR'){
+ $table = 'ar';
+ } elsif ($module eq 'AP'){
+ $table = 'ap';
+ }
$dbh = $self->{dbh};
@@ -1784,8 +1790,18 @@ sub all_vc {
$sth->finish;
+ } elsif ($self->{id}) {
+ $query = qq|
+ SELECT ec.id, e.name
+ FROM entity e
+ JOIN entity_credit_account ec ON (ec.entity_id = e.id)
+ WHERE ec.id = (select entity_credit_account FROM $table
+ WHERE id = ?)
+ ORDER BY name|;
+ $sth = $self->{dbh}->prepare($query);
+ $sth->execute($self->{id});
+ ($self->{"${vc}_id"}, $self->{$vc}) = $sth->fetchrow_array();
}
-
# get self
if ( !$self->{employee_id} ) {
( $self->{employee}, $self->{employee_id} ) = split /--/,
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index 0c396ac6..35602cb4 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -374,8 +374,16 @@ sub _email_output {
}
sub _lpr_output {
- my $self = shift;
- #TODO stub
+ my ($self) = shift;
+ my $args = $self->{output_args};
+ if ($self->{format} != /(pdf|ps)/){
+ throw Error::Simple "Invalid Format";
+ }
+ my $lpr = $LedgerSMB::Sysconfig::printer{$args->{printer}};
+
+ open(LPR, '|-', $lpr);
+ print LPR $self->{output};
+ close(LPR);
}
1;