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

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



Revision: 5073
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5073&view=rev
Author:   einhverfr
Date:     2012-08-01 08:21:08 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
No more parse errors in payment.pm

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/sql/modules/Company.sql

Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm	2012-07-31 11:44:04 UTC (rev 5072)
+++ trunk/LedgerSMB/Scripts/payment.pm	2012-08-01 08:21:08 UTC (rev 5073)
@@ -50,8 +50,6 @@
 use LedgerSMB::Sysconfig;
 use LedgerSMB::DBObject::Payment;
 use LedgerSMB::DBObject::Date;
-use LedgerSMB::DBObject::Customer;
-use LedgerSMB::DBObject::Vendor;
 use Error::Simple;
 use Error;
 use strict; 
@@ -442,7 +440,6 @@
 =cut
 
 sub print {
-    use LedgerSMB::DBObject::Company;
     use LedgerSMB::Batch;
     my ($request) = @_;
     my $payment =  LedgerSMB::DBObject::Payment->new({'base' => $request});
@@ -469,12 +466,11 @@
         for my $line (1 .. $payment->{contact_count}){
             my $id = $payment->{"contact_$line"};
             next if !defined $payment->{"id_$id"};
-            my $check = LedgerSMB::DBObject::Company->new(
-                                {base => $request, copy => 'base' }
+            my ($check) = $payment->call_procedure(
+                     procname => 'company__get_billing_info', args => [$id]
             );
             $check->{entity_class} = $payment->{account_class};
             $check->{id} = $id;
-            $check->get_billing_info;
             $check->{amount} = $check->parse_amount(amount => '0');
             $check->{invoices} = [];
             $check->{source} = $payment->{"source_$id"};
@@ -971,7 +967,7 @@
  #Now its time to build the link to the invoice :)
  my $uri_module;
  #TODO move following code to sub getModuleForUri() ?
- if($Payment->{account_class} == $LedgerSMB::DBObject::Vendor::ENTITY_CLASS)
+ if($Payment->{account_class} == 1)
  {
   if($array_options[$ref]->{invoice})
   {
@@ -982,7 +978,7 @@
    $uri_module='ap';
   }
  }#account_class 1
- elsif($Payment->{account_class} == $LedgerSMB::DBObject::Customer::ENTITY_CLASS)
+ elsif($Payment->{account_class} == 2)
  {
   if($array_options[$ref]->{invoice})
   {

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2012-07-31 11:44:04 UTC (rev 5072)
+++ trunk/sql/modules/Company.sql	2012-08-01 08:21:08 UTC (rev 5073)
@@ -657,7 +657,7 @@
 
 DROP TYPE IF EXISTS company_billing_info CASCADE;
 CREATE TYPE company_billing_info AS (
-legal_name text,
+name text,
 meta_number text,
 control_code text,
 tax_id text,
@@ -680,7 +680,11 @@
 		e.control_code, c.tax_id, a.line_one, a.line_two, a.line_three, 
 		a.city, a.state, a.mail_code, cc.name
 	into out_var
-	FROM company c
+	FROM (select legal_name, tax_id, entity_id 
+                FROM company
+               UNION ALL
+              SELECT last_name || ', ' || first_name, null, entity_id 
+                FROM person) c
 	JOIN entity e ON (c.entity_id = e.id)
 	JOIN entity_credit_account eca ON (eca.entity_id = e.id)
 	LEFT JOIN eca_to_location cl ON (eca.id = cl.credit_id)

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