Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
fix incorrect types and proper project templates
Browse files Browse the repository at this point in the history
  • Loading branch information
zegenie committed Sep 7, 2018
1 parent c084c29 commit af7dd54
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
14 changes: 7 additions & 7 deletions core/entities/Issuetype.php
Expand Up @@ -64,55 +64,55 @@ public static function loadFixtures(Scope $scope)
$bug_report->setScope($scope);
$bug_report->setDescription('Have you discovered a bug in the application, or is something not working as expected?');
$bug_report->save();
framework\Settings::saveSetting('issuetype_bug_report', $bug_report->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_BUG_REPORT, $bug_report->getID(), 'core', $scope_id);

$feature_request = new Issuetype();
$feature_request->setName('Feature request');
$feature_request->setIcon('feature_request');
$feature_request->setDescription('Are you missing some specific feature, or is your favourite part of the application a bit lacking?');
$feature_request->setScope($scope);
$feature_request->save();
framework\Settings::saveSetting('issuetype_feature_request', $feature_request->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_FEATURE_REQUEST, $feature_request->getID(), 'core', $scope_id);

$enhancement = new Issuetype();
$enhancement->setName('Enhancement');
$enhancement->setIcon('enhancement');
$enhancement->setDescription('Have you found something that is working in a way that could be improved?');
$enhancement->setScope($scope);
$enhancement->save();
framework\Settings::saveSetting('issuetype_enhancement', $enhancement->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_ENHANCEMENT, $enhancement->getID(), 'core', $scope_id);

$task = new Issuetype();
$task->setName('Task');
$task->setIcon('task');
$task->setIsTask();
$task->setScope($scope);
$task->save();
framework\Settings::saveSetting('issuetype_task', $task->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_TASK, $task->getID(), 'core', $scope_id);

$user_story = new Issuetype();
$user_story->setName('User story');
$user_story->setIcon('developer_report');
$user_story->setDescription('Doing it Agile-style. Issue type perfectly suited for entering user stories');
$user_story->setScope($scope);
$user_story->save();
framework\Settings::saveSetting('issuetype_user_story', $user_story->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_USER_STORY, $user_story->getID(), 'core', $scope_id);

$epic = new Issuetype();
$epic->setName('Epic');
$epic->setIcon('epic');
$epic->setDescription('Issue type suited for entering epics');
$epic->setScope($scope);
$epic->save();
framework\Settings::saveSetting('issuetype_epic', $epic->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_EPIC, $epic->getID(), 'core', $scope_id);

$idea = new Issuetype();
$idea->setName('Idea');
$idea->setIcon('idea');
$idea->setDescription('Express yourself - share your ideas with the rest of the team!');
$idea->setScope($scope);
$idea->save();
framework\Settings::saveSetting('issuetype_idea', $idea->getID(), 'core', $scope_id);
framework\Settings::saveSetting(framework\Settings::SETTING_ISSUETYPE_IDEA, $idea->getID(), 'core', $scope_id);

return [$bug_report->getID(), $feature_request->getID(), $enhancement->getID(), $task->getID(), $user_story->getID(), $idea->getID(), $epic->getID()];
}
Expand Down
11 changes: 6 additions & 5 deletions core/entities/Project.php
Expand Up @@ -3481,7 +3481,7 @@ public function applyTemplate($template)
$dashboard_views[DashboardView::VIEW_PROJECT_DOWNLOADS] = ['column' => 1, 'order' => 3];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ACTIVITIES] = ['column' => 1, 'order' => 4];
$dashboard_views[DashboardView::VIEW_PROJECT_UPCOMING] = ['column' => 2, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2, 'subtype' => Settings::get(Settings::SETTING_ISSUETYPE_BUG_REPORT)];
break;
case 'open-source':
$this->setWorkflowSchemeID(Settings::get(Settings::SETTING_BALANCED_WORKFLOW_SCHEME));
Expand All @@ -3508,7 +3508,7 @@ public function applyTemplate($template)
$dashboard_views[DashboardView::VIEW_PROJECT_DOWNLOADS] = ['column' => 1, 'order' => 3];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ACTIVITIES] = ['column' => 1, 'order' => 4];
$dashboard_views[DashboardView::VIEW_PROJECT_UPCOMING] = ['column' => 2, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2, 'subtype' => Settings::get(Settings::SETTING_ISSUETYPE_BUG_REPORT)];
break;
case 'agile':
$this->setWorkflowSchemeID(Settings::get(Settings::SETTING_BALANCED_WORKFLOW_SCHEME));
Expand All @@ -3522,7 +3522,8 @@ public function applyTemplate($template)
$dashboard_views[DashboardView::VIEW_PROJECT_DOWNLOADS] = ['column' => 1, 'order' => 3];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ACTIVITIES] = ['column' => 1, 'order' => 4];
$dashboard_views[DashboardView::VIEW_PROJECT_UPCOMING] = ['column' => 2, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2, 'subtype' => Settings::get(Settings::SETTING_ISSUETYPE_BUG_REPORT)];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 2, 'subtype' => Settings::get(Settings::SETTING_ISSUETYPE_FEATURE_REQUEST)];
break;
case 'service-desk':
$this->setWorkflowSchemeID(Settings::get(Settings::SETTING_SIMPLE_WORKFLOW_SCHEME));
Expand All @@ -3534,7 +3535,7 @@ public function applyTemplate($template)

$dashboard_views[DashboardView::VIEW_PROJECT_INFO] = ['column' => 1, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_TEAM] = ['column' => 1, 'order' => 2];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 1, 'order' => 3];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 1, 'order' => 3, 'subtype' => Settings::get(Settings::SETTING_ISSUETYPE_BUG_REPORT)];
$dashboard_views[DashboardView::VIEW_PROJECT_STATISTICS_PRIORITY] = ['column' => 2, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_STATISTICS_STATUS] = ['column' => 2, 'order' => 2];
break;
Expand All @@ -3549,7 +3550,7 @@ public function applyTemplate($template)

$dashboard_views[DashboardView::VIEW_PROJECT_INFO] = ['column' => 1, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ACTIVITIES] = ['column' => 1, 'order' => 2];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 1];
$dashboard_views[DashboardView::VIEW_PROJECT_RECENT_ISSUES] = ['column' => 2, 'order' => 1, 'subtype' => Settings::get(Settings::SETTING_ISSUETYPE_TASK)];
break;
}

Expand Down
4 changes: 2 additions & 2 deletions core/entities/WorkflowScheme.php
Expand Up @@ -89,14 +89,14 @@ public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
$balanced_workflow_scheme->setName("Balanced workflow scheme");
$balanced_workflow_scheme->setDescription("This is a workflow scheme used to handle medium-sized projects or small-team projects. It uses the balanced workflow for all issue types.");
$balanced_workflow_scheme->save();
Settings::saveSetting(Settings::SETTING_BALANCED_WORKFLOW_SCHEME, $multi_team_workflow_scheme->getID(), 'core', $scope->getID());
Settings::saveSetting(Settings::SETTING_BALANCED_WORKFLOW_SCHEME, $balanced_workflow_scheme->getID(), 'core', $scope->getID());

$simple_workflow_scheme = new WorkflowScheme();
$simple_workflow_scheme->setScope($scope);
$simple_workflow_scheme->setName("Simple workflow scheme");
$simple_workflow_scheme->setDescription("This is a simple workflow scheme for projects with few people, or even just one person. It uses the simple workflow for all issue types.");
$simple_workflow_scheme->save();
Settings::saveSetting(Settings::SETTING_SIMPLE_WORKFLOW_SCHEME, $multi_team_workflow_scheme->getID(), 'core', $scope->getID());
Settings::saveSetting(Settings::SETTING_SIMPLE_WORKFLOW_SCHEME, $simple_workflow_scheme->getID(), 'core', $scope->getID());

return [$multi_team_workflow_scheme, $balanced_workflow_scheme, $simple_workflow_scheme];
}
Expand Down
8 changes: 8 additions & 0 deletions core/framework/Settings.php
Expand Up @@ -113,6 +113,14 @@ final class Settings
const SETTING_UPLOAD_ALLOW_IMAGE_CACHING = 'upload_allow_image_caching';
const SETTING_UPLOAD_DELIVERY_USE_XSEND = 'upload_delivery_use_xsend';

const SETTING_ISSUETYPE_BUG_REPORT = 'issuetype_bug_report';
const SETTING_ISSUETYPE_FEATURE_REQUEST = 'issuetype_feature_request';
const SETTING_ISSUETYPE_ENHANCEMENT = 'issuetype_enhancement';
const SETTING_ISSUETYPE_TASK = 'issuetype_task';
const SETTING_ISSUETYPE_USER_STORY = 'issuetype_user_story';
const SETTING_ISSUETYPE_EPIC = 'issuetype_epic';
const SETTING_ISSUETYPE_IDEA = 'issuetype_idea';

const SETTING_USER_COMMENT_ORDER = 'comment_order';

const SETTING_USER_DISPLAYNAME_FORMAT = 'user_displayname_format';
Expand Down
1 change: 1 addition & 0 deletions core/modules/project/controllers/Main.php
Expand Up @@ -1138,6 +1138,7 @@ public function runConfigureProjectSettings(framework\Request $request)
$this->selected_project->save();
if ($apply_template) {
$this->selected_project->applyTemplate($request['project_type']);
$this->selected_project->save();
}
$response = ['message' => $this->getI18n()->__('Settings saved')];

Expand Down

0 comments on commit af7dd54

Please sign in to comment.