diff --git a/module/action/control.php b/module/action/control.php index 0cd4386b3b..4be60a2303 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -170,8 +170,8 @@ class action extends control ->where('id')->ne($oldAction->objectID) ->beginIF($oldAction->objectType == 'program' or $oldAction->objectType == 'project')->andWhere("(name = '{$project->name}' and parent = {$project->parent})", true)->fi() ->beginIF($oldAction->objectType == 'execution')->andWhere("(name = '{$project->name}' and project = {$sprintProject})", true)->fi() - ->beginIF($oldAction->objectType == 'project')->orWhere("(code = '{$project->code}' and model = '$project->model')")->fi() - ->beginIF($oldAction->objectType == 'execution')->orWhere("code = '{$project->code}'")->fi() + ->beginIF($oldAction->objectType == 'project' and $project->code)->orWhere("(code = '{$project->code}' and model = '$project->model')")->fi() + ->beginIF($oldAction->objectType == 'execution' and $project->code)->orWhere("code = '{$project->code}'")->fi() ->markRight(1) ->beginIF($oldAction->objectType == 'program')->andWhere('type')->eq('program')->fi() ->beginIF($oldAction->objectType == 'project')->andWhere('type')->eq('project')->fi() @@ -182,22 +182,27 @@ class action extends control if($repeatObject) { + $result = preg_match('/_(\d+)$/', $repeatObject->name, $nameMatches); + $replaceName = $result ? preg_replace('/_(\d+)$/', '_' . ($nameMatches[1] + 1), $repeatObject->name) : $repeatObject->name . '_1'; + $result = preg_match('/_(\d+)$/', $repeatObject->code, $codeMatches); + $replaceCode = $result ? preg_replace('/_(\d+)$/', '_' . ($codeMatches[1] + 1), $repeatObject->code) : $repeatObject->code . '_1'; + $table = $oldAction->objectType == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; $object = $oldAction->objectType == 'product' ? $product : $project; if($repeatObject->name == $object->name and $repeatObject->code and $repeatObject->code == $object->code) { - if($confirmChange == 'no') return print(js::confirm(sprintf($this->lang->action->repeatChange, $this->lang->{$oldAction->objectType}->common, $repeatObject->name, $repeatObject->code), $this->createLink('action', 'undelete', "action={$actionID}&browseType={$browseType}&confirmChange=yes"))); - if($confirmChange == 'yes') $this->dao->update($table)->set('name')->eq($object->name . '_')->set('code')->eq($object->code . '_')->where('id')->eq($oldAction->objectID)->exec(); + if($confirmChange == 'no') return print(js::confirm(sprintf($this->lang->action->repeatChange, $this->lang->{$oldAction->objectType}->common, $replaceName, $replaceCode), $this->createLink('action', 'undelete', "action={$actionID}&browseType={$browseType}&confirmChange=yes"))); + if($confirmChange == 'yes') $this->dao->update($table)->set('name')->eq($replaceName)->set('code')->eq($replaceCode)->where('id')->eq($oldAction->objectID)->exec(); } elseif($repeatObject->name == $object->name) { - if($confirmChange == 'no') return print(js::confirm(sprintf($this->lang->action->nameRepeatChange, $this->lang->{$oldAction->objectType}->common, $repeatObject->name), $this->createLink('action', 'undelete', "action={$actionID}&browseType={$browseType}&confirmChange=yes"))); - if($confirmChange == 'yes') $this->dao->update($table)->set('name')->eq($object->name . '_')->where('id')->eq($oldAction->objectID)->exec(); + if($confirmChange == 'no') return print(js::confirm(sprintf($this->lang->action->nameRepeatChange, $this->lang->{$oldAction->objectType}->common, $replaceName), $this->createLink('action', 'undelete', "action={$actionID}&browseType={$browseType}&confirmChange=yes"))); + if($confirmChange == 'yes') $this->dao->update($table)->set('name')->eq($replaceName)->where('id')->eq($oldAction->objectID)->exec(); } elseif($repeatObject->code and $repeatObject->code == $object->code) { - if($confirmChange == 'no') return print(js::confirm($this->lang->{$oldAction->objectType}->codeRepeatChange, $this->createLink('action', 'undelete', "action={$actionID}&browseType={$browseType}&confirmChange=yes"))); - if($confirmChange == 'yes') $this->dao->update($table)->set('code')->eq($object->code . '_')->where('id')->eq($oldAction->objectID)->exec(); + if($confirmChange == 'no') return print(js::confirm(sprintf($this->lang->action->codeRepeatChange, $this->lang->{$oldAction->objectType}->common, $replaceCode), $this->createLink('action', 'undelete', "action={$actionID}&browseType={$browseType}&confirmChange=yes"))); + if($confirmChange == 'yes') $this->dao->update($table)->set('code')->eq($replaceCode)->where('id')->eq($oldAction->objectID)->exec(); } } } diff --git a/module/action/lang/de.php b/module/action/lang/de.php index 24cb2ea7f0..38218a2bd1 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -58,9 +58,9 @@ $lang->action->noDynamic = 'Kein Verlauf. '; $lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; $lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; -$lang->action->repeatChange = '%s with the same name and code already exists in the system. After recovery, the name and code are %s_,%s_'; -$lang->action->nameRepeatChange = '%s with the same name already exists in the system. After recovery, the name are %s_'; -$lang->action->codeRepeatChange = '%s with the same code already exists in the system. After recovery, the code are %s_'; +$lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".'; +$lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".'; +$lang->action->codeRepeatChange = '%s with the same code already exists in the system, After recovery, the code are \"%s\".'; $lang->action->history = new stdclass(); $lang->action->history->action = 'Link'; diff --git a/module/action/lang/en.php b/module/action/lang/en.php index d7022b66fd..51cedddc58 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -58,9 +58,9 @@ $lang->action->noDynamic = 'No dynamics. '; $lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; $lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; -$lang->action->repeatChange = '%s with the same name and code already exists in the system. After recovery, the name and code are %s_,%s_'; -$lang->action->nameRepeatChange = '%s with the same name already exists in the system. After recovery, the name are %s_'; -$lang->action->codeRepeatChange = '%s with the same code already exists in the system. After recovery, the code are %s_'; +$lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".'; +$lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".'; +$lang->action->codeRepeatChange = '%s with the same code already exists in the system, After recovery, the code are \"%s\".'; $lang->action->history = new stdclass(); $lang->action->history->action = 'Link'; diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index ca8bfe3ffc..f50eae6e17 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -58,9 +58,9 @@ $lang->action->noDynamic = "Pas d'historique."; $lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; $lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; -$lang->action->repeatChange = '%s with the same name and code already exists in the system. After recovery, the name and code are %s_,%s_'; -$lang->action->nameRepeatChange = '%s with the same name already exists in the system. After recovery, the name are %s_'; -$lang->action->codeRepeatChange = '%s with the same code already exists in the system. After recovery, the code are %s_'; +$lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".'; +$lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".'; +$lang->action->codeRepeatChange = '%s with the same code already exists in the system, After recovery, the code are \"%s\".'; $lang->action->history = new stdclass(); $lang->action->history->action = 'Lien'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 8fd4a43020..eda00b9ed1 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -58,9 +58,9 @@ $lang->action->noDynamic = '暂时没有动态。'; $lang->action->undeletedTips = '该数据在版本升级过程中未参与数据归并流程,不支持还原。'; $lang->action->executionNoProject = '该执行没有所属的项目,请先还原项目再还原执行'; -$lang->action->repeatChange = '系统内已有同名、同代号的%s。恢复后名称和代号为%s_、%s_'; -$lang->action->nameRepeatChange = '系统内已有同名的%s。恢复后名称为%s_'; -$lang->action->codeRepeatChange = '系统内已有同代号的%s。恢复后代号为%s_'; +$lang->action->repeatChange = '系统内已有同名、同代号的%s,恢复后名称为\"%s\"、代号为\"%s\"。'; +$lang->action->nameRepeatChange = '系统内已有同名的%s,恢复后名称为\"%s\"。'; +$lang->action->codeRepeatChange = '系统内已有同代号的%s,恢复后代号为\"%s\"。'; $lang->action->history = new stdclass(); $lang->action->history->action = '关联日志'; diff --git a/module/group/js/managemember.js b/module/group/js/managemember.js index 94465d17d7..2d3988a729 100644 --- a/module/group/js/managemember.js +++ b/module/group/js/managemember.js @@ -6,7 +6,7 @@ $(function() $(this).parents('tr').find('input[type=checkbox]').prop('checked', checked); }); - $('#other,#group,#outside').selectable( + $('.table-members table').selectable( { selector: 'input', listenClick: false, diff --git a/module/program/control.php b/module/program/control.php index 13c9b01234..6c7f8403e6 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -54,6 +54,7 @@ class program extends control { /* Get top programs and projects. */ $topObjects = $this->program->getList($status == 'unclosed' ? 'doing,suspended,wait' : $status, $orderBy, $pager, 'top'); + if(!$topObjects) $topObjects = array(0); $programs = $this->program->getList($status == 'closed' ? 'closed' : 'all', $orderBy, NULL, 'child', array_keys($topObjects)); /* Get summary. */