public static function loadFixtures(TBGScope $scope) { $activitytypes["Investigation"] = ''; $activitytypes["Documentation"] = ''; $activitytypes["Development"] = ''; $activitytypes["Testing"] = ''; $activitytypes["Deployment"] = ''; foreach ($activitytypes as $name => $itemdata) { $activitytype = new TBGActivityType(); $activitytype->setName($name); $activitytype->setItemdata($itemdata); $activitytype->setScope($scope); $activitytype->save(); } }
public static function loadFixtures(TBGScope $scope) { TBGCategory::loadFixtures($scope); TBGPriority::loadFixtures($scope); TBGReproducability::loadFixtures($scope); TBGResolution::loadFixtures($scope); TBGSeverity::loadFixtures($scope); TBGStatus::loadFixtures($scope); TBGRole::loadFixtures($scope); TBGActivityType::loadFixtures($scope); foreach (self::getTypes() as $type => $class) { TBGContext::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID()); } }
</select> </li> <li> <label for="issue_timespent_<?php echo $entry->getID(); ?> _activitytype"><?php echo __('Activity'); ?> </label> <select id="issue_timespent_<?php echo $entry->getID(); ?> _activitytype" name="activitytype"> <?php foreach (TBGActivityType::getAll() as $activitytype) { ?> <option value="<?php echo $activitytype->getID(); ?> " <?php if ($activitytype->getID() == $entry->getActivityTypeID()) { echo 'selected'; } ?> ><?php echo $activitytype->getName(); ?> </option> <?php }
protected function _upgradeFrom3dot2(TBGRequest $request) { set_time_limit(0); TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.2'); foreach (array('publish', 'mailing') as $module) { TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . $module . DS . 'classes'); TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . $module . DS . 'classes' . DS . 'B2DB'); } TBGMilestonesTable::getTable()->upgrade(TBGMilestonesTable3dot2::getTable()); TBGArticlesTable::getTable()->upgrade(TBGArticlesTable3dot2::getTable()); TBGProjectsTable::getTable()->upgrade(TBGProjectsTable3dot2::getTable()); TBGLogTable::getTable()->upgrade(TBGLogTable3dot2::getTable()); TBGUsersTable::getTable()->upgrade(TBGUsersTable3dot2::getTable()); TBGIssuesTable::getTable()->upgrade(TBGIssuesTable3dot2::getTable()); TBGWorkflowsTable::getTable()->upgrade(TBGWorkflowsTable3dot2::getTable()); TBGIncomingEmailAccountTable::getTable()->upgrade(TBGIncomingEmailAccountTable3dot2::getTable()); TBGIssueSpentTimesTable::getTable()->upgrade(TBGIssueSpentTimesTable3dot2::getTable()); TBGCommentsTable::getTable()->upgrade(TBGCommentsTable3dot2::getTable()); TBGSavedSearchesTable::getTable()->upgrade(TBGSavedSearchesTable3dot2::getTable()); TBGSettingsTable::getTable()->upgrade(TBGSettingsTable3dot2::getTable()); TBGNotificationsTable::getTable()->upgrade(TBGNotificationsTable3dot2::getTable()); TBGPermissionsTable::getTable()->upgrade(TBGPermissionsTable3dot2::getTable()); TBGUserArticlesTable::getTable()->create(); TBGApplicationPasswordsTable::getTable()->create(); TBGUserNotificationSettingsTable::getTable()->create(); $transaction = \b2db\Core::startTransaction(); // Upgrade user passwords switch ($request['upgrade_passwords']) { case 'manual': $password = $request['manul_password']; foreach (TBGUsersTable::getTable()->selectAll() as $user) { $user->setPassword($password); $user->save(); } break; case 'auto': $field = $request['upgrade_passwords_pick'] == 'username' ? 'username' : 'email'; foreach (TBGUsersTable::getTable()->selectAll() as $user) { if ($field == 'username' && trim($user->getUsername())) { $user->setPassword(trim($user->getUsername())); $user->save(); } elseif ($field == 'email' && trim($user->getEmail())) { $user->setPassword(trim($user->getEmail())); $user->save(); } } break; } $adminuser = TBGUsersTable::getTable()->selectById(1); $adminuser->setPassword($request['admin_password']); $adminuser->save(); // Add new settings TBGSettings::saveSetting(TBGSettings::SETTING_SERVER_TIMEZONE, 'core', date_default_timezone_get(), 0, 1); foreach ($request->getParameter('status') as $scope_id => $status_id) { $scope = TBGScopesTable::getTable()->selectById((int) $scope_id); if ($scope instanceof TBGScope) { foreach (TBGWorkflowsTable::getTable()->getAll((int) $scope_id) as $workflow) { $transition = new TBGWorkflowTransition(); $steps = $workflow->getSteps(); $step = array_shift($steps); $step->setLinkedStatusID((int) $status_id); $step->save(); $transition->setOutgoingStep($step); $transition->setName('Issue created'); $transition->setWorkflow($workflow); $transition->setScope($scope); $transition->setDescription('This is the initial transition for issues using this workflow'); $transition->save(); $workflow->setInitialTransition($transition); $workflow->save(); } TBGActivityType::loadFixtures($scope); } } $transaction->commitAndEnd(); TBGContext::finishUpgrading(); TBGContext::getModule('mailing')->upgradeFrom3dot2(); $this->upgrade_complete = true; }