[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [2140] trunk



Revision: 2140
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2140&view=rev
Author:   einhverfr
Date:     2008-05-12 17:38:42 -0700 (Mon, 12 May 2008)

Log Message:
-----------
Correcting Customer/vendor name not showing up in certain cases

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Template.pm
    trunk/UI/payments/payments_detail.html

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2008-05-12 19:28:13 UTC (rev 2139)
+++ trunk/LedgerSMB/AA.pm	2008-05-13 00:38:42 UTC (rev 2140)
@@ -308,17 +308,18 @@
         # 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 @@
 		SET invnumber = ?,
 			ordnumber = ?,
 			transdate = ?,
-			entity_credit_account = ?,
 			taxincluded = ?,
 			amount = ?,
 			duedate = ?,
@@ -350,10 +350,10 @@
 			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,

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2008-05-12 19:28:13 UTC (rev 2139)
+++ trunk/LedgerSMB/Form.pm	2008-05-13 00:38:42 UTC (rev 2140)
@@ -1719,9 +1719,15 @@
 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};
 
     my $sth;
@@ -1784,8 +1790,18 @@
 
         $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 /--/,

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2008-05-12 19:28:13 UTC (rev 2139)
+++ trunk/LedgerSMB/Template.pm	2008-05-13 00:38:42 UTC (rev 2140)
@@ -374,8 +374,16 @@
 }
 
 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;

Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html	2008-05-12 19:28:13 UTC (rev 2139)
+++ trunk/UI/payments/payments_detail.html	2008-05-13 00:38:42 UTC (rev 2140)
@@ -177,7 +177,7 @@
 			type = "checkbox"
 			name = "id_$r.contact_id"
 			value = r.contact_id
-			checked = (r.unselected) ? "" : "checked" 
+			# checked = (r.unselected) ? "" : "checked" 
 			
 		} ?>
 		<?lsmb r.account_number ?>


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.