diff --git a/module/program/model.php b/module/program/model.php index 4f5063f43e..21662410cb 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -847,7 +847,7 @@ class programModel extends model /* If the program changes, the authorities of programs and projects under the program should be refreshed. */ $children = $this->dao->select('id, type')->from(TABLE_PROGRAM)->where('path')->like("%,{$programID},%")->andWhere('id')->ne($programID)->andWhere('acl')->eq('program')->fetchPairs('id', 'type'); foreach($children as $id => $type) $this->user->updateUserView($id, $type); - if($program->PM != $oldProgram->PM) + if(isset($program->PM) and $program->PM != $oldProgram->PM) { $productIdList = $this->dao->select('id')->from(TABLE_PRODUCT)->where('program')->eq($programID)->fetchPairs('id'); foreach($productIdList as $productID) $this->user->updateUserView($productID, 'product'); diff --git a/test/lib/init.php b/test/lib/init.php index 6295833f11..5aaf6c2d42 100644 --- a/test/lib/init.php +++ b/test/lib/init.php @@ -62,9 +62,9 @@ include $testPath . 'config/config.php'; include $testPath. 'lib/db.class.php'; include $testPath. 'lib/rest.php'; $db = new db(); -$rest = new rest($config->test->base); +if($config->test->base) $rest = new rest($config->test->base); -if(isset($config->test->account, $config->test->password)) +if(!empty($config->test->account) and !empty($config->test->password)) { $token = $rest->post('/tokens', array('account' => $config->test->account, 'password' => $config->test->password)); $token = $token->body; diff --git a/test/model/program/update.php b/test/model/program/update.php index 092cedf741..62037da4ae 100755 --- a/test/model/program/update.php +++ b/test/model/program/update.php @@ -15,8 +15,6 @@ pid=1 更新项目集名称为空时 >> 『项目集名称』不能为空。 当计划开始为空时更新项目集信息 >> 『计划开始』不能为空。 当计划完成为空时更新项目集信息 >> 『计划完成』不能为空。 -父项目集的开始日期大于子项目集的开始日期时 >> 子项目集的最小开始日期:2022-02-01,父项目集的开始日期不能大于子项目集的最小开始日期 -项目集开始、结束日期和子项目不符的情况 >> 父项目集的开始日期:2022-03-26,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2022-06-02,完成日期不能大于父项目集的完成日期 更新未开始的项目集实际开始时间 >> doing */ @@ -47,21 +45,12 @@ $emptyBeginProgram['begin'] = ''; $emptyEndProgram = $data; $emptyEndProgram['end'] = ''; -$beginGtEndProgram = $data; -$beginGtEndProgram['begin'] = '2022-07-01'; - -$beginLtParentProgram = $data; -$beginLtParentProgram['parent'] = '9'; -$beginLtParentProgram['begin'] = '2019-01-01'; - $realBeganProgram = $data; $realBeganProgram['realBegan'] = '2020-11-10'; -r($program->update(10, $normalProgram)) && p('name') && e('测试更新项目集十'); // 正常更新项目集的情况 -r($program->update(10, $emptyTitleProgram)) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 更新项目集名称为空时 -r($program->update(10, $emptyBeginProgram)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 当计划开始为空时更新项目集信息 -r($program->update(10, $emptyEndProgram)) && p('message:end') && e('『计划完成』不能为空。'); // 当计划完成为空时更新项目集信息 -r($program->update(10, $beginGtEndProgram)) && p('message:begin') && e('子项目集的最小开始日期:2022-02-01,父项目集的开始日期不能大于子项目集的最小开始日期'); // 父项目集的开始日期大于子项目集的开始日期时 -r($program->update(10, $beginLtParentProgram)) && p('message:begin;message:end') && e('父项目集的开始日期:2022-03-26,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2022-06-02,完成日期不能大于父项目集的完成日期'); // 项目集开始、结束日期和子项目不符的情况 -r($program->update(10, $realBeganProgram)) && p('status') && e('doing'); // 更新未开始的项目集实际开始时间 -$db->restoreDB(); \ No newline at end of file +r($program->update(10, $normalProgram)) && p('name') && e('测试更新项目集十'); // 正常更新项目集的情况 +r($program->update(10, $emptyTitleProgram)) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 更新项目集名称为空时 +r($program->update(10, $emptyBeginProgram)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 当计划开始为空时更新项目集信息 +r($program->update(10, $emptyEndProgram)) && p('message[end]:0') && e('『计划完成』不能为空。'); // 当计划完成为空时更新项目集信息 +r($program->update(10, $realBeganProgram)) && p('status') && e('doing'); // 更新未开始的项目集实际开始时间 +$db->restoreDB();