$tn = $this->tableName();
//DB_DataObject::debugLevel(1);
- $x = DB_DataObject::factory('Companies');
+ $x = DB_DataObject::factory('core_company');
$x->comptype= 'OWNER';
$x->find(true);
if (!empty($_SESSION[__CLASS__][$sesPrefix .'-auth'])) {
// in session...
$a = unserialize($_SESSION[__CLASS__][$sesPrefix .'-auth']);
- $u = DB_DataObject::factory('Companies');
+ $u = DB_DataObject::factory('core_company');
if ($u->get($a->id)) { //&& strlen($u->passwd)) {
return true;
}
if (!empty($_SESSION[__CLASS__][$sesPrefix .'-auth'])) {
$a = unserialize($_SESSION[__CLASS__][$sesPrefix .'-auth']);
- $u = DB_DataObject::factory('Companies');
+ $u = DB_DataObject::factory('core_company');
if ($u->get($a->id)) { /// && strlen($u->passwd)) {
return clone($u);
}
$img = DB_DataObject::factory('Images');
$img->onid= 0;
- $img->ontable = 'Companies';
+ $img->ontable = $this->tableName();
$img->imgtype = 'LOGO';
// should check uploader!!!
if ($img->find()) {
function beforeUpdate($old, $q,$roo)
{
+ if(!empty($q['_merge_id'])){
+ $this->merge($q['_merge_id'], $roo);
+ }
+
if(!empty($this->is_system) &&
($old->code != $this->code ) // used to be not allowed to change name..
){
$roo->jerr('This company is not allow to delete');
}
$img = DB_DataObject::factory('Images');
- $img->ontable = 'Companies';
+ $img->ontable = $this->tableName();
$img->onid = $this->id;
$img->find();
while ($img->fetch()) {
function initCompanies($roo, $opts)
{
- $companies = DB_DataObject::factory('companies');
+ $companies = DB_DataObject::factory('core_company');
$ctype = empty($opts['add-company-with-type']) ? 'OWNER' : $opts['add-company-with-type'];
$roo->jerr("invalid company type '$ctype'");
}
if ($ctype =='OWNER') {
- $companies = DB_DataObject::factory('companies');
+ $companies = DB_DataObject::factory('core_company');
$companies->comptype_id = $enum;
if ($companies->count()) {
$roo->jerr("Owner company already exists");
}
}
- $companies = DB_DataObject::factory('companies');
+ $companies = DB_DataObject::factory('core_company');
// check that
$companies->setFrom(array(
function lookupOwner()
{
$enum = DB_DataObject::Factory('core_enum')->lookup('COMPTYPE', 'OWNER' );
- $companies = DB_DataObject::factory('companies');
+ $companies = DB_DataObject::factory('core_company');
$companies->comptype_id = $enum;
if ($companies->find(true)) {
return $companies;