* Fix bug.

This commit is contained in:
leiyong
2021-02-01 08:17:23 +08:00
parent 458b1e09b0
commit 450aa98ce0
10 changed files with 38 additions and 25 deletions
+7 -2
View File
@@ -110,6 +110,9 @@ class program extends control
*/
public function PGMProduct($programID = 0, $browseType = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
{
$program = $this->program->getPGMByID($programID);
if(empty($program) || $program->type != 'program') die(js::error($this->lang->notFound) . js::locate('back'));
$this->lang->navGroup->program = 'program';
$this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true);
$this->lang->program->mainMenuAction = $this->program->getPGMMainAction();
@@ -122,7 +125,6 @@ class program extends control
/* Get the top programID. */
if($programID)
{
$program = $this->program->getPGMByID($programID);
$path = explode(',', $program->path);
$path = array_filter($path);
$programID = current($path);
@@ -763,6 +765,9 @@ class program extends control
*/
public function index($projectID = 0)
{
$project = $this->program->getPRJByID($projectID);
if(empty($project) || $project->type != 'project') die(js::error($this->lang->notFound) . js::locate('back'));
$this->lang->navGroup->program = 'project';
$projectID = $this->program->savePRJState($projectID, $this->program->getPRJPairs());
@@ -771,7 +776,7 @@ class program extends control
$this->view->title = $this->lang->program->common . $this->lang->colon . $this->lang->program->PRJIndex;
$this->view->position[] = $this->lang->program->PRJIndex;
$this->view->project = $this->program->getPRJByID($projectID);
$this->view->project = $project;
$this->display();
}
+4 -4
View File
@@ -102,7 +102,7 @@ class programModel extends model
*/
public function getPGMByID($programID = 0)
{
return $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch();
return $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($programID)->andWhere('`type`')->eq('program')->fetch();
}
/**
@@ -828,7 +828,7 @@ class programModel extends model
$currentProjectName = $this->lang->program->common;
if($projectID)
{
$currentProject = $this->project->getById($projectID);
$currentProject = $this->getPRJById($projectID);
$currentProjectName = $currentProject->name;
}
@@ -919,9 +919,9 @@ class programModel extends model
*/
public function getPRJByID($projectID)
{
if(!$projectID) return false;
$project = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('`type`')->eq('project')->fetch();
if(!$project) return false;
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
if($project->end == '0000-00-00') $project->end = '';
return $project;
}