Import/Accounts.php
authorAlan Knowles <alan@roojs.com>
Wed, 25 Feb 2015 08:46:09 +0000 (16:46 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 25 Feb 2015 08:46:09 +0000 (16:46 +0800)
Import/Accounts.php

index 9e93010..5fa4c68 100644 (file)
@@ -196,38 +196,26 @@ class Pman_Xtuple_Import_Accounts extends Pman_Roo
             if (!empty($r['accnt_bankaccnt_type'])) {
                 // bank account.
                 $ba = DB_DataObject::factory('bankaccnt');
-                 $bankaccnt->setFrom($ba->defaults());
-                 $bankaccnt->setFrom(array(
-                    'bankaccnt_name' =>  $acc->accnt_descrip,
-                    'bankaccnt_descrip' => $acc->accnt_descrip,
-                    'bankaccnt_bankname' => 'BANK NAME',
-                    'bankaccnt_accntnumber' => 'N/A',
-                    'bankaccnt_ar' => true,
-                    'bankaccnt_ap' => true,
-                    'bankaccnt_nextchknum' => 5000,
-                    'bankaccnt_type' => 'K',
-                    'bankaccnt_accnt_id' => $accnt->pid(),
-                    'bankaccnt_curr_id' => $r['accnt_curr_id'],
-                    'bankaccnt_notes' => '',
-                    'bankaccnt_routing' => '',
-                    'bankaccnt_ach_enabled' => false,
-                    'bankaccnt_ach_origintype' => 'I'
-                ));
-
-                
-                
                 if (!$ba->get('bankaccnt_accnt_id', $acc->pid())) {
-                    // create a bank account..
                     $ba->setFrom($ba->defaults());
-                    $ba->bankaccnt_bankname = $acc->accnt_descrip;
-                    $ba->bankaccnt_accntnumber = $r['accnt_bankaccnt_accntnumber'];
-                    $ba->bankaccnt_curr_id =  $r['accnt_curr_id'];
-                    $ba->bankaccnt_accnt_id = $acc->pid();
-                    
-                    $ba->bankaccnt_type = $r['accnt_bankaccnt_type'];
+                    $ba->setFrom(array(
+                       'bankaccnt_name' =>  $acc->accnt_descrip,
+                       'bankaccnt_descrip' => $acc->accnt_descrip,
+                       'bankaccnt_bankname' => 'BANK NAME',
+                       'bankaccnt_accntnumber' => $r['accnt_bankaccnt_accntnumber'],
+                       'bankaccnt_ar' => true,
+                       'bankaccnt_ap' => true,
+                       'bankaccnt_nextchknum' => 5000,
+                       'bankaccnt_type' =>  $r['accnt_bankaccnt_type'],
+                       'bankaccnt_accnt_id' => $acc->pid(),
+                       'bankaccnt_curr_id' => $r['accnt_curr_id'],
+                       'bankaccnt_notes' => '',
+                       'bankaccnt_routing' => '',
+                       'bankaccnt_ach_enabled' => false,
+                       'bankaccnt_ach_origintype' => 'I'
+                   ));
                     $ba->insert();
                 }
-                
             }
             // tax account.