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

SF.net SVN: ledger-smb:[3079] addons/1.3/import_trans/trunk



Revision: 3079
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3079&view=rev
Author:   einhverfr
Date:     2010-10-01 21:04:17 +0000 (Fri, 01 Oct 2010)

Log Message:
-----------
Correcting AP import issues

Modified Paths:
--------------
    addons/1.3/import_trans/trunk/UI/import_trans/import_trans.html
    addons/1.3/import_trans/trunk/scripts/import_trans.pl

Modified: addons/1.3/import_trans/trunk/UI/import_trans/import_trans.html
===================================================================
--- addons/1.3/import_trans/trunk/UI/import_trans/import_trans.html	2010-10-01 18:44:34 UTC (rev 3078)
+++ addons/1.3/import_trans/trunk/UI/import_trans/import_trans.html	2010-10-01 21:04:17 UTC (rev 3079)
@@ -7,6 +7,12 @@
 <div class="listtop"><?lsmb title ?></div>
 <div class="info"><?lsmb info ?></div>
 <form action="<?lsmb script ?>" method="post" enctype="multipart/form-data">
+<?lsmb PROCESS input element_data = {
+    type = "hidden"
+    class = "hidden"
+    name = "type"
+    value = type
+} ?>
 <?lsmb IF !multi ?>
 <div class="inputrow" id = "referencerow">
 <?lsmb PROCESS input element_data = {
@@ -17,12 +23,6 @@
     value = reference
     size  = 15
 } ?>
-<?lsmb PROCESS input element_data = {
-    type = "hidden"
-    class = "hidden"
-    name = "type"
-    value = type
-} ?>
 </div>
 <div class="inputrow" id = "descriptionrow">
 <?lsmb PROCESS input element_data = {

Modified: addons/1.3/import_trans/trunk/scripts/import_trans.pl
===================================================================
--- addons/1.3/import_trans/trunk/scripts/import_trans.pl	2010-10-01 18:44:34 UTC (rev 3078)
+++ addons/1.3/import_trans/trunk/scripts/import_trans.pl	2010-10-01 21:04:17 UTC (rev 3079)
@@ -16,6 +16,7 @@
 use LedgerSMB::Form;
 use strict;
 
+my $default_currency = 'USD';
 our $cols = {
    gl       =>  ['accno', 'debit', 'credit', 'source', 'memo'],
    ap_multi =>  ['vendor', 'amount', 'account', 'ap', 'description', 
@@ -63,13 +64,13 @@
                    for my $ref (@$entries){
                        my $form = Form->new();
                        $form->{dbh} = $request->{dbh};
-                       $form->{rowcount} = 2;
-                       $form->{vendor_id} = shift @$ref;
+                       $form->{rowcount} = 1;
+                       $form->{vendornumber} = shift @$ref;
                        $form->{amount_1} = shift @$ref;
                        next if $form->{amount_1} !~ /\d/;
                        $form->{amount_1} = $form->parse_amount(
                               $request->{_user}, $form->{amount_1}); 
-                       $form->{accno_1} = shift @$ref;
+                       $form->{AP_amount_1} = shift @$ref;
                        $form->{ARAP} = 'AP';
                        $form->{vc} = "vendor";
                        $form->{arap} = 'ap';
@@ -77,6 +78,15 @@
                        $form->{description} = shift @$ref;
                        $form->{invnumber} = shift @$ref;
                        $form->{transdate} = shift @$ref;
+                       $form->{currency} = $default_currency;
+                       $form->{defaultcurrency} = $default_currency;
+                       my $sth = $form->{dbh}->prepare(
+                            "SELECT id FROM entity_credit_account
+                              WHERE entity_class = 1 and meta_number = ?"
+                       );
+                       $sth->execute($form->{vendornumber});
+                       ($form->{vendor_id}) = $sth->fetchrow_array;
+                      
                        AA->post_transaction($request->{_user}, $form);
                    }
                },
@@ -128,4 +138,5 @@
     my ($request) = @_;
     my @entries = parse_file($request);
     $process->{$request->{type}}($request, ..hidden..) || begin_import($request);
+    begin_import($request);
 }


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