}
- function get($k = '',$opts)
+ function get($k = '',$opts=array())
{
$k = strtolower($k);
HTML_FlexyFramework::get()->generateDataobjectsCache(true);
$this->{$dirmethod}($dburl, $this->rootDir. "/Pman/$m/{$dbtype}.initdata");
- $this->{'fixSequences'. $dbtype}();
+ // fixSequences does nto appar to work on postgres anymore
+ //$this->{'fixSequences'. $dbtype}();
}
'taxzone',
'taxtype',
'expcat',
+
+ 'custinfo', // create a base customer based on company.
+ 'location', // default warehouse.
+ 'period', // adds years and months -1 to +10 from now.
+
// accounts - fixme - we need a better 'base set'
// 'costcat' -- fixme - we need to init this..
// 'location', //?? just check hat one exists.
) : array($k);
-
- $core_opts = HTML_FlexyFramework::get()->page->opts;
- if (!empty($core_opts['init'])) {
+ $core_opts = HTML_FlexyFramework::get()->page->opts;
+
+ if (!empty($core_opts['base'])) {
+ DB_DataObject::DebugLevel(1);
+ DB_DataObject::factory('curr_symbol')->importFromArray($this, array($core_opts['base']));
DB_DataObject::factory('curr_symbol')->setBase($this, $core_opts['base']);
}
$this->updateMetricValue();
+ $this->addAccounts();
+
+
+
}
function updateMetricValue()
+
-
-
-
-
-
-
-
-
-
-
- /*
-
- function updateData($k='')
- {
-
- $this->addWarehouse();
- $this->addExtraYears();
- $this->addAccounts();
- $this->addBankAccounts();
- }
- */
-
- function addWarehouse()
- {
- $l = DB_DataObject::Factory('location');
- if ($l->count()) {
- echo "location exists - SKIP\n";
- return;
- }
- $cust = DB_DataObject::Factory('custinfo');
- $cc =$cust->count() ;
- if ($cc != 1) {
- echo "location create - needs 1 custinfo - got $cc\n";
- return;
- }
- $cust->find(true);
-
- $l->setFrom(array(
- 'location_name' => 'Warehouse',
- 'location_descrip' => 'Warehouse',
- 'location_cust_id' => $cust->pid()
- ));
- }
-
-
-
- function addExtraYears()
- {
- $p = DB_DataObject::Factory('period');
- if ($p->count()) {
- echo "SKIP - already have periods\n";
- return;
- }
- $p->initPeriods($this);
- $p->initPeriods($this);
- $p->initPeriods($this);
- $p->initPeriods($this);
-
- }
+
function addAccounts()
{
$ac = DB_DataObject::factory('accnt');
return;
}
+ // this might want to be configurable -- so that we could use different 'base files' for the accounts..
require_once 'File/Convert.php';
$cp = $this->tempName('xls');
copy(dirname(__FILE__).'/Setup/accounts_sample.xls', $cp);
$ia->importCsv($csv);
}
- function addBankAccounts() {
-
- $accnt = DB_DataObject::factory('subaccnt');
- if (!$accnt->get('subaccnt_number', '01')) {
- echo "SKIP Bank account creation - no subaccnt - 01\n";
- return;
- }
-
- $bankaccnt = DB_DataObject::factory('bankaccnt');
-
- $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'
- ));
-
- $bankaccnt->insert();
- }
-
- $bankaccnt = DB_DataObject::factory('bankaccnt');
-
- 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
- ));
-
- 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