$bankaccnt->whereAdd("
bankaccnt_name != ''
");
-
- if(!$bankaccnt->count()){
- $bankaccnt = DB_DataObject::factory('bankaccnt');
-
- if(!$bankaccnt->get('bankaccnt_name', 'Current Account')){
- $accnt = DB_DataObject::factory('accnt');
- $accnt->setFrom(array(
- 'accnt_number' => '131',
- 'accnt_descrip' => 'Current Account',
- 'accnt_comments' => '',
- 'accnt_profit' => '01',
- 'accnt_sub' => '01',
- 'accnt_type' => 'A',
- 'accnt_extref' => '',
- 'accnt_closedpost' => false,
- 'accnt_forwardupdate' => false,
- 'accnt_subaccnttype_code' => 'CA',
- 'accnt_curr_id' => $accnt->sqlValue("baseCurrId()"),
- 'accnt_active' => true
- ));
-
- if(!$accnt->find(true)){
- $accnt->insert();
- }
-
- $bankaccnt->setFrom(array(
- 'bankaccnt_name' => 'Current Account',
- 'bankaccnt_descrip' => 'Current Account',
- 'bankaccnt_bankname' => 'Current Account',
- 'bankaccnt_accntnumber' => 'N/A',
- 'bankaccnt_ar' => true,
- 'bankaccnt_ap' => true,
- 'bankaccnt_nextchknum' => 5000,
- 'bankaccnt_type' => 'K',
- 'bankaccnt_accnt_id' => $accnt->pid(),
- 'bankaccnt_curr_id' => $bankaccnt->sqlValue("baseCurrId()"),
- 'bankaccnt_notes' => '',
- 'bankaccnt_routing' => '',
- 'bankaccnt_ach_enabled' => false,
- 'bankaccnt_ach_origintype' => 'I'
- ));
+ // do we have any bank accounts..
+ if($bankaccnt->count()){
+ return;
+ }
+ $bankaccnt = DB_DataObject::factory('bankaccnt');
+
+ if(!$bankaccnt->get('bankaccnt_name', 'Current Account')){
+ $accnt = DB_DataObject::factory('accnt');
+ $accnt->setFrom(array(
+ 'accnt_number' => '131',
+ 'accnt_descrip' => 'Current Account',
+ 'accnt_comments' => '',
+ 'accnt_profit' => '01',
+ 'accnt_sub' => '01',
+ 'accnt_type' => 'A',
+ 'accnt_extref' => '',
+ 'accnt_closedpost' => false,
+ 'accnt_forwardupdate' => false,
+ 'accnt_subaccnttype_code' => 'CA',
+ 'accnt_curr_id' => $accnt->sqlValue("baseCurrId()"),
+ 'accnt_active' => true
+ ));
- $bankaccnt->insert();
+ if(!$accnt->find(true)){
+ $accnt->insert();
}
- $bankaccnt = DB_DataObject::factory('bankaccnt');
+ $bankaccnt->setFrom(array(
+ 'bankaccnt_name' => 'Current Account',
+ 'bankaccnt_descrip' => 'Current Account',
+ 'bankaccnt_bankname' => 'Current Account',
+ 'bankaccnt_accntnumber' => 'N/A',
+ 'bankaccnt_ar' => true,
+ 'bankaccnt_ap' => true,
+ 'bankaccnt_nextchknum' => 5000,
+ 'bankaccnt_type' => 'K',
+ 'bankaccnt_accnt_id' => $accnt->pid(),
+ 'bankaccnt_curr_id' => $bankaccnt->sqlValue("baseCurrId()"),
+ 'bankaccnt_notes' => '',
+ 'bankaccnt_routing' => '',
+ 'bankaccnt_ach_enabled' => false,
+ 'bankaccnt_ach_origintype' => 'I'
+ ));
- if(!$bankaccnt->get('bankaccnt_name', 'Savings Account')){
- $accnt = DB_DataObject::factory('accnt');
- $accnt->setFrom(array(
- 'accnt_number' => '404',
- 'accnt_descrip' => 'Savings Account',
- 'accnt_comments' => '',
- 'accnt_profit' => '01',
- 'accnt_sub' => '01',
- 'accnt_type' => 'A',
- 'accnt_extref' => '',
- 'accnt_closedpost' => false,
- 'accnt_forwardupdate' => false,
- 'accnt_subaccnttype_code' => 'CA',
- 'accnt_curr_id' => $accnt->sqlValue("baseCurrId()"),
- 'accnt_active' => true
- ));
+ $bankaccnt->insert();
+ }
- if(!$accnt->find(true)){
- $accnt->insert();
- }
+ $bankaccnt = DB_DataObject::factory('bankaccnt');
- $bankaccnt->setFrom(array(
- 'bankaccnt_name' => 'Savings Account',
- 'bankaccnt_descrip' => 'Savings Account',
- 'bankaccnt_bankname' => 'Savings Account',
- 'bankaccnt_accntnumber' => 'N/A',
- 'bankaccnt_ar' => true,
- 'bankaccnt_ap' => true,
- 'bankaccnt_nextchknum' => 5000,
- 'bankaccnt_type' => 'K',
- 'bankaccnt_accnt_id' => $accnt->pid(),
- 'bankaccnt_curr_id' => $bankaccnt->sqlValue("baseCurrId()"),
- 'bankaccnt_notes' => '',
- 'bankaccnt_routing' => '',
- 'bankaccnt_ach_enabled' => false,
- 'bankaccnt_ach_origintype' => 'I'
- ));
+ if(!$bankaccnt->get('bankaccnt_name', 'Savings Account')){
+ $accnt = DB_DataObject::factory('accnt');
+ $accnt->setFrom(array(
+ 'accnt_number' => '404',
+ 'accnt_descrip' => 'Savings Account',
+ 'accnt_comments' => '',
+ 'accnt_profit' => '01',
+ 'accnt_sub' => '01',
+ 'accnt_type' => 'A',
+ 'accnt_extref' => '',
+ 'accnt_closedpost' => false,
+ 'accnt_forwardupdate' => false,
+ 'accnt_subaccnttype_code' => 'CA',
+ 'accnt_curr_id' => $accnt->sqlValue("baseCurrId()"),
+ 'accnt_active' => true
+ ));
- $bankaccnt->insert();
+ if(!$accnt->find(true)){
+ $accnt->insert();
}
+
+ $bankaccnt->setFrom(array(
+ 'bankaccnt_name' => 'Savings Account',
+ 'bankaccnt_descrip' => 'Savings Account',
+ 'bankaccnt_bankname' => 'Savings Account',
+ 'bankaccnt_accntnumber' => 'N/A',
+ 'bankaccnt_ar' => true,
+ 'bankaccnt_ap' => true,
+ 'bankaccnt_nextchknum' => 5000,
+ 'bankaccnt_type' => 'K',
+ 'bankaccnt_accnt_id' => $accnt->pid(),
+ 'bankaccnt_curr_id' => $bankaccnt->sqlValue("baseCurrId()"),
+ 'bankaccnt_notes' => '',
+ 'bankaccnt_routing' => '',
+ 'bankaccnt_ach_enabled' => false,
+ 'bankaccnt_ach_origintype' => 'I'
+ ));
+
+ $bankaccnt->insert();
}
-
+ }
+
}
}
\ No newline at end of file