From: Alan Date: Wed, 28 Dec 2022 07:11:07 +0000 (+0800) Subject: lookup for owner X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=14b3c00cb397652632a3b57813a61f1d8751b7c2 lookup for owner --- diff --git a/DataObjects/Core_company.php b/DataObjects/Core_company.php index 054c0e8d..c9b31eeb 100644 --- a/DataObjects/Core_company.php +++ b/DataObjects/Core_company.php @@ -497,6 +497,26 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject $companies->insert(); $companies->onInsert(array(), $roo); } + + function owner() + { + if (empty($this->owner_id)) { + return false; + } + static $cache = false; + if ($cache !== false && isset($cache[$this->owner_id])) { + return $cache[$this->owner_id]; + } + $o = DB_DataObject::factory('core_company'); + if (!$o->get($this->owner_id)) { + return false; + } + $cache[$this->owner_id] = $o; + return $o; + + } + + /// look up the company which is the system owner... static function lookupOwner() { static $cache = false; diff --git a/Images.php b/Images.php index eff84f5c..e0527a05 100644 --- a/Images.php +++ b/Images.php @@ -126,7 +126,7 @@ class Pman_Core_Images extends Pman } if (strpos($id,':') > 0) { // id format tablename:id:-imgtype - + //DB_DataObject::debugLevel(1); if (!$this->authUser) { $this->imgErr("not-authenticated-using-colon-format",$s); @@ -150,6 +150,7 @@ class Pman_Core_Images extends Pman } $img->limit(1); if (!$img->find(true)) { + die("HERE"); $this->imgErr("no images for that item: " . htmlspecialchars($id),$s); }