コード例 #1
0
ファイル: company.php プロジェクト: sgh1986915/php-crm
 public static function get_current_logged_in_company_id()
 {
     if (self::$_current_company_id) {
         return self::$_current_company_id;
     }
     if (module_security::is_logged_in()) {
         $company_access = self::get_company_data_access();
         switch ($company_access) {
             case _COMPANY_ACCESS_ALL:
                 break;
             case _COMPANY_ACCESS_ASSIGNED:
             case _COMPANY_ACCESS_CONTACT:
                 // this is a possibility that this user only has access to a single customer
                 $companies = self::get_companys();
                 if (count($companies) == 1) {
                     // only 1 woo! get this id and load in any custom config values.
                     $company = array_shift($companies);
                     if ($company && $company['company_id'] > 0) {
                         self::$_current_company_id = $company['company_id'];
                         return self::$_current_company_id;
                     }
                 }
         }
     }
     return false;
 }