深圳全飞鸿

标题: pmp/pms修改公司名称的方法 [打印本页]

作者: zhgc    时间: 2023-2-1 21:51
标题: pmp/pms修改公司名称的方法
确定公司名称是保存在select * from zt_company表中

修改后没有效果的原因是系统用了session, 先会直接读session里的公司名

在index.php中

$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router');   //这里创建,但没有处理公司名

/* installed or not. */
if(!isset($config->installed) or !$config->installed) die(header('location: install.php'));

/* Run the app. */
$common = $app->loadCommon();   //这里处理了公司名


在framework/base/router.class.php中
    public function loadCommon()
    {
        $this->setModuleName('common');
        $commonModelFile = $this->setModelFile('common');
        if(!file_exists($commonModelFile)) return false;

        helper::import($commonModelFile);

        if($this->config->framework->extensionLevel == 0 and class_exists('commonModel'))    return new commonModel();
        if($this->config->framework->extensionLevel > 0  and class_exists('extCommonModel')) return new extCommonModel();

        if(class_exists('commonModel')) return new commonModel();
        return false;
    }



在module/common/model.php中
    public function setCompany()
    {
        $httpHost = $this->server->http_host;

        if($this->session->company)
        {
            $this->app->company = $this->session->company;
        }
        else
        {
            $company = $this->loadModel('company')->getFirst();
            if(!$company) $this->app->triggerError(sprintf($this->lang->error->companyNotFound, $httpHost), __FILE__, __LINE__, $exit = true);
            $this->session->set('company', $company);
            $this->app->company  = $company;
        }
    }







欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2