{
$db = $this->getDatabaseConnection();
$sesPrefix = $db->dsn['database'];
- @session_start();
+ if (empty($_SERVER['PHP_AUTH_USER'])) {
+ @session_start();
+ }
if (!empty($_SESSION[__CLASS__][$sesPrefix .'-auth'])) {
// in session...
$a = unserialize($_SESSION[__CLASS__][$sesPrefix .'-auth']);
{
// we still use comptype in some old systems...
+ if(!empty($q['comptype']) && empty($q['comptype_id'])) {
+ $en = DB_DataObject::Factory('core_enum');
+ $en->setFrom(array(
+ 'etype' => 'COMPTYPE',
+ 'name' => $q['comptype'],
+ 'active' => 1
+ ));
+ if($en->find(true)) {
+ $this->comptype_id = $en->id;
+ }
+ }
+
if (!empty($q['comptype_id'])) {
$en = DB_DataObject::Factory('core_enum');
$en->get($q['comptype_id']);
{
// we still use comptype in some old systems...
+ if(!empty($q['comptype']) && empty($q['comptype_id'])) {
+ $en = DB_DataObject::Factory('core_enum');
+ $en->setFrom(array(
+ 'etype' => 'COMPTYPE',
+ 'name' => $q['comptype'],
+ 'active' => 1
+ ));
+ if($en->find(true)) {
+ $this->comptype_id = $en->id;
+ }
+ }
+
if (!empty($q['comptype_id'])) {
$en = DB_DataObject::Factory('core_enum');
$en->get($q['comptype_id']);
$this->comptype = $en->name;
}
-
if(!empty($q['_flag_delete'])){
$this->deleted_dt = $this->sqlValue("NOW()");
$this->deleted_by = $roo->getAuthUser()->id;
}
static function lookupOwner()
{
+ static $cache = false;
+ if ($cache !== false) {
+ return clone($cache); // no updating this object..
+ }
+
$enum = DB_DataObject::Factory('core_enum')->lookup('COMPTYPE', 'OWNER' );
$companies = DB_DataObject::factory('core_company');
$companies->comptype_id = $enum;
if ($companies->find(true)) {
+ $cache = clone($companies);
return $companies;
}
return false;