public function equals(Bug $bug) { if (strcmp($this->title, $bug->getTitle()) == 0 && strcmp($this->description, $bug->getDescription()) == 0 && strcmp($this->getStatus()->getName(), $bug->getStatus()->getName()) == 0 && $this->getUser()->equals($bug->getUser())) { return TRUE; } return FALSE; }
public function Fire() { if ($this->input->do == 'submit') { $bug = new Bug($this->input->bug_id); try { $bug->FetchInto(); } catch (phalanx\data\ModelException $e) { EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND'))); return; } $body = trim($this->input->body); if (empty($body)) { EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('COMMENT_MISSING_BODY'))); return; } $comment = new Comment(); $comment->bug_id = $bug_id; $comment->post_user_id = Bugdar::$auth->current_user(); $comment->post_date = time(); $comment->body = $body; $comment->Insert(); $this->comment_id = $comment->comment_id; $search = new SearchEngine(); $search->IndexBug($bug); EventPump::Pump()->PostEvent(new StandardSuccessEvent('view_bug/' . $bug_id, l10n::S('USER_REGISTER_SUCCESS'))); } }
public function getBugs($from, $many) { $res = $this->db->getValues("bug_id", "bugs", "bugl_id = {$this->bugl_id} ", "", ""); $bugs = array(); for ($i = 0; $i < count($res); $i++) { $bug = new Bug(); $bug->getByID($res[$i][0]); $bugs[$i] = $bug; } return $bugs; }
public function actionBug() { //$this->layout = '//layouts/clean'; $model = new Bug(); $dataProvider = new CActiveDataProvider('Bug'); if (isset($_POST['Bug'])) { $model->attributes = $_POST['Bug']; $url = $model->send(); //$this->redirect(); } $this->render('bug', array('model' => $model, 'dataProvider' => $dataProvider)); }
function testEagerFetchingManyToOne() { $bug = new Bug(); $bug->Title = 'Test Bug'; $project = new Project(); $project->setName('Test Project'); $bug->setProject($project); $outlet = Outlet::getInstance(); $outlet->save($bug); // clear cache because it will be used to check if project was loaded $outlet->clearCache(); $bug = $outlet->from('Bug')->with('Project')->find(); $this->assertEquals(1, count(OutletMapper::$map['Project'])); }
public function Fire() { $bug = new Bug($this->input->_id); try { $bug->FetchInto(); } catch (\phalanx\data\ModelException $e) { EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND'))); return; } $this->bug = $bug; $this->bug_reporter = $bug->FetchReporter(); $this->attributes = $bug->FetchAttributes(); $this->comments = $bug->FetchComments(); }
/** * Try indirectly saving the same project twice * and make sure it only gets inserted once */ function testIndirectSave() { $outlet = Outlet::getInstance(); $p = new Project(); $p->setName('Project 1'); $b1 = new Bug(); $b1->Title = 'Bug 1'; $b1->setProject($p); $outlet->save($p); $b2 = new Bug(); $b2->Title = 'Bug 2'; $b2->setProject($p); $outlet->save($b2); $this->assertEquals(count($outlet->select('Project', 'where {Project.Name} = ?', array('Project 1'))), 1, 'Only one project inserted'); }
function testManyToMany() { $user = new User(); $user->Firstname = 'Alvaro'; $user->LastName = 'Carrasco'; $bug = new Bug(); $bug->Name = 'Test Bug'; $project = new Project(); $project->setName('Test Project'); $bug->setProject($project); $outlet = Outlet::getInstance(); $outlet->save($user); $outlet->save($bug); $user->getBugs()->add($bug); $outlet->save($user); $this->assertTrue(count($user->getBugs()) == 1, 'One project attached to this user'); }
function aside_html() { $bug = new Bug(); $str = ' <h4 class="font-thin">最新反馈</h4> <section class="panel panel-default"> <div class="table-responsive"> <table class="table table-striped b-t b-light"> <!--<thead> <tr> <th>Bug</th> <th>提交人</th> <th>状态</th> </tr> </thead>--> <tbody> '; $result_all = $bug->bug_status(2); foreach ($result_all as $value_all) { if ($value_all['status'] == 0) { $str .= ' <tr><td><span class="label label-info">新发布</span> '; } else { if ($value_all['status'] == 1) { $str .= ' <tr><td><span class="label label-danger">修复中</span> '; } else { if ($value_all['status'] == 2) { $str .= ' <tr><td><span class="label label-success">已修复</span> '; } else { if ($value_all['status'] == 3) { $str .= ' <tr><td><span class="label label-default">已关闭</span> '; } } } } $str .= '<a href="/app/feedback/bug_info.php?bug_name=' . $value_all['bugid'] . '">' . $value_all['title'] . '</a></td></tr> '; } $str .= ' </tbody> </table> </div> </section> '; return $str; }
public function test_create_and_retrieve() { global $entityManager; $bug = new Bug(); $bug->setDescription('test description'); $bug->setStatus('test status'); $entityManager->persist($bug); $entityManager->flush(); $id = $bug->getId(); $this->assertFirstGreaterThanSecond($id, 0); /** @var Bug $bugOut */ $bugOut = $entityManager->find('Bug', $id); $this->assertEqual($bugOut->getId(), $id); $this->assertEqual($bugOut->getDescription(), 'test description'); $this->assertEqual($bugOut->getStatus(), 'test status'); $this->assertEqual(strlen($bugOut->getCreated()), 19, 'created'); $this->assertEqual(strlen($bugOut->getUpdated()), 19, 'created'); }
function setProject(Project $ref) { if (is_null($ref)) { throw new OutletException("You can not set this to NULL since this relationship has not been marked as optional"); return parent::setProject(null); } $this->ProjectID = $ref->ProjectID; return parent::setProject($ref); }
static function select($options) { $result = self::$db->query(self::toSQLselect($options)); $bugs = array(); foreach ($result as $row) { $bugs[] = Bug::fromArray($row); } return $bugs; }
function userSection() { $userId = Session::get('userId'); if (!isset($userId)) { return Redirect::to('/'); } $runningProjects = Project::where('status', '=', 'active')->count(); $closedProjects = Project::where('status', '=', 'closed')->count(); $currentBugs = Bug::where('status', '=', 'active')->count(); $fixedBugs = Bug::where('status', '=', 'fixed')->count(); $unresolvedBugs = Bug::where('status', '=', 'unresolved')->count(); $userBugs = BugUser::where('user_id', '=', $userId)->where('status', '=', 'active')->with('bug')->with('bug.project')->get(); return View::make('users.user-section')->with('runningProjects', $runningProjects)->with('closedProjects', $closedProjects)->with('currentBugs', $currentBugs)->with('fixedBugs', $fixedBugs)->with('unresolvedBugs', $unresolvedBugs)->with('userBugs', $userBugs); }
function removeProject($id) { if (isset($id)) { $project = Project::find($id); if (isset($project)) { $project->status = 'removed'; $project->save(); Bug::where('project_id', '=', $id)->update(array('status' => 'removed')); echo 'done'; } else { echo 'invalid'; } } else { echo 'invalid'; } }
protected function _get_mantis_attr($attr_name) { if ($attr_name == 'bug_id') { return Bug::get_mantis_id_from_url($this->rsrc_data['bug']); } elseif ($attr_name == 'reporter_id') { return User::get_mantis_id_from_url($this->rsrc_data['reporter']); } elseif ($attr_name == 'view_state') { return $this->rsrc_data['private'] ? VS_PRIVATE : VS_PUBLIC; } elseif ($attr_name == 'date_submitted' || $attr_name == 'last_modified') { return date_to_sql_date($this->rsrc_data[$attr_name]); } elseif ($attr_name == 'note') { return $this->rsrc_data['text']; } elseif (in_array($attr_name, Bugnote::$mantis_attrs)) { return $this->rsrc_data[$attr_name]; } }
public function update(Bug $bug) { $query = $this->_db->prepare(' UPDATE t_bug SET bug=:bug, lien=:lien, updated=:updated, updatedBy=:updatedBy WHERE id=:id') or die(print_r($this->_db->errorInfo())); $query->bindValue(':id', $bug->id()); $query->bindValue(':bug', $bug->bug()); $query->bindValue(':lien', $bug->lien()); $query->bindValue(':updated', $bug->updated()); $query->bindValue(':updatedBy', $bug->updatedBy()); $query->execute(); $query->closeCursor(); }
public function createAction() { $view = new ViewModel(); $request = $this->getRequest(); $entityManager = $this->getEntityManager(); if ($request->isPost()) { $strUser = $request->getPost()->user; $strProductIds = $request->getPost()->products; $strDescription = $request->getPost()->description; $reporter = $entityManager->find("User", $strUser); $engineer = $entityManager->find("User", $strUser); if (!$reporter || !$engineer) { echo "No reporter and/or engineer found for the input.\n"; exit(1); } $bug = new \Bug(); $bug->setDescription($strDescription); $bug->setCreated(new \DateTime("now")); $bug->setStatus("OPEN"); foreach ($strProductIds as $productId) { $product = $entityManager->find("Product", $productId); $bug->assignToProduct($product); } $bug->setReporter($reporter); $bug->setEngineer($engineer); $entityManager->persist($bug); $entityManager->flush(); $view->setVariable('bug', $bug); $view->setTemplate('application/bug/create_post'); } else { // If you don't have parameters in the query, you can use the getResult() shortcut $users = $entityManager->getRepository('User')->findAll(); $view->setVariable('users', $users); $products = $entityManager->getRepository('Product')->findAll(); $view->setVariable('products', $products); } return $view; }
/** * This method saves uploaded file to its persistent location. * @throws Exception */ public function saveFileAttachment() { // Set filename attribute $this->filename = basename($this->fileAttachment->getName()); // Set filesize attribute $this->filesize = $this->fileAttachment->getSize(); // Get bug model this attachment belongs to. $bugChange = BugChange::model()->findByPk($this->bug_change_id); $bug = Bug::model()->findByPk($bugChange->bug_id); // Check project quota if ($bug->project->bug_attachment_files_disc_quota > 0) { $totalFileSize = 0; $percentOfDiskQuota = 0; $bug->project->getBugAttachmentCount($totalFileSize, $percentOfDiskQuota); if ($bug->project->bug_attachment_files_disc_quota * 1024 * 1024 - $totalFileSize - $this->filesize < 0) { $this->addError('fileAttachment', 'Bug attachment quota for this project has exceeded.'); throw new Exception('Bug attachment quota constrained.'); } } // Calc md5 hash and save it as model attribute $this->md5 = md5_file($this->fileAttachment->getTempName()); // Create the directory where we will place the uploaded file $subDir1 = substr($this->md5, 0, 3); $subDir2 = substr($this->md5, 3, 3); $dirName = Yii::app()->getBasePath() . "/data/bugAttachments/" . $subDir1 . "/" . $subDir2; if (!@is_dir($dirName)) { if (False == @mkdir($dirName, 0777, TRUE)) { $error = error_get_last(); $this->addError("fileAttachment", "Couldn't make directory for file attachment."); throw new Exception('Could not make directory for file attachment.'); } } // Move uploaded file to an appropriate directory and delete temp file $fileName = $dirName . "/" . $this->md5; if (!$this->fileAttachment->saveAs($fileName, true) && !$this->ignoreFileAttachmentErrors) { $this->addError("fileAttachment", "Couldn't save file attachment"); throw new Exception('Could not save file attachment'); } }
<?php $id = $_GET['id']; echo '<h2 style="text-align:center">Viewing Bug #' . $id . '</h2>'; $bug = new Bug(); $bug->loaddb($id); $bug->show();
public function put($request) { /* * Replaces the bug resource using the representation provided. * * @param $request - The HTTP request we're responding to */ $this->bug_id = Bug::get_mantis_id_from_url($request->url); $this->populate_from_repr($request->body); # Access checks are from Mantis's bug_update.php if (!(access_has_bug_level(access_get_status_threshold($f_new_status, bug_get_field($this->bug_id, 'project_id')), $this->bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $this->bug_id) || bug_get_field($this->bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) { throw new HTTPException(403, "Access denied to update bug"); } bug_update($this->bug_id, $this->to_bugdata(), TRUE); $resp = new Response(); $resp->status = 204; return $resp; }
public function testsave() { $bug = new Bug(); $bug->name = 'test'; $bug->bug_number = '1'; $bug->type = 'Defect'; $bug->priority = 'Urgent'; $bug->status = 'New'; $bug->resolution = 'Accepted'; $bug->save(); //test for record ID to verify that record is saved $this->assertTrue(isset($bug->id)); $this->assertEquals(36, strlen($bug->id)); //mark the record as deleted and verify that this record cannot be retrieved anymore. $bug->mark_deleted($bug->id); $result = $bug->retrieve($bug->id); $this->assertEquals(null, $result); }
$status = $_POST['status']; $user_id = $_POST['user']; if ($title == '') { $title = $bug->getTitle(); } if ($description == '') { $description = $bug->getDescription(); } if ($status == $bug->getStatus()->getNumber() || $status == 99) { $status = $bug->getStatus()->getNumber(); } if ($user_id == $bug->getUser()->getId() || $user_id == -1) { $user_id = $bug->getUser()->getId(); } $user_update = $user_access_object->getUserById($user_id); $updated_bug = new Bug($title, $description, $user_update, $status_access_object->getStatusWhere(array('number' => $status))[0], $bug->getId()); if ($updated_bug->equals($bug)) { echo '<div class="ui visible message blue" style="margin-top: 5%"><div class="header">NOTICE</div> No edits detected.</div>'; } else { if ($bug_access_object->updateBugById($updated_bug, $bug_id)) { echo '<div class="ui success message" style="margin-top: 5%"><div class="header">SUCCESS</div> Bug has been updated.</div>'; $bug = $updated_bug; } else { echo '<div class="ui error message" style="margin-top: 5%"><div class="header">ERROR</div> Failed to update bug.</div>'; } } } ?> <div class="ui one column relaxed grid" style="margin-top: 1%;"> <div class="column">
public function testTwoBugsAreNotEqual() { $newBug = new Bug("Bug title1", "Bug description1", new User("username1", "password", null, null), new Status(null, "OPEN", 1), null); $this->assertNotEquals(TRUE, $newBug->equals($this->bug)); }
<?php $entityManager = (require_once __DIR__ . '/bootstrap.php'); $theReporterId = $argv[1]; $theDefaultEngineerId = $argv[2]; $productIds = explode(",", $argv[3]); /** @var User $reporter */ $reporter = $entityManager->find("User", $theReporterId); /** @var User $engineer */ $engineer = $entityManager->find("User", $theDefaultEngineerId); if (!$reporter || !$engineer) { echo "No reporter and/or engineer found for the input.\n"; exit(1); } $bug = new Bug(); $bug->setDescription("Something does not work again!"); $bug->setCreated(new DateTime("now")); $bug->setStatus("OPEN"); foreach ($productIds as $productId) { /** @var Product $product */ $product = $entityManager->find("Product", $productId); $bug->assignToProduct($product); } $bug->setReporter($reporter); $bug->setEngineer($engineer); $entityManager->persist($bug); $entityManager->flush(); echo "Your new Bug Id: " . $bug->getId() . "\n";
public function get_feed_data_struct($idcat = 0, $name = '') { $querier = PersistenceContext::get_querier(); $lang = LangLoader::get('common', 'bugtracker'); //Configuration load $config = BugtrackerConfig::load(); $types = $config->get_types(); $categories = $config->get_categories(); $severities = $config->get_severities(); $priorities = $config->get_priorities(); $versions = $config->get_versions_detected(); $site_name = GeneralConfig::load()->get_site_name(); $feed_module_name = $idcat == 1 ? $lang['titles.solved'] : $lang['titles.unsolved']; $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('bugtracker', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS); $results = $querier->select("SELECT bugtracker.*, author.*\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . " bugtracker\r\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " author ON author.user_id = bugtracker.author_id\r\n\t\tWHERE " . ($idcat == 1 ? "(status = '" . Bug::FIXED . "' OR status = '" . Bug::REJECTED . "')" : "status <> '" . Bug::FIXED . "' AND status <> '" . Bug::REJECTED . "'") . "\r\n\t\tORDER BY " . ($idcat == 1 ? "fix_date" : "submit_date") . " DESC"); foreach ($results as $row) { $bug = new Bug(); $bug->set_properties($row); $link = BugtrackerUrlBuilder::detail($bug->get_id() . '-' . $bug->get_rewrited_title()); $description = FormatingHelper::second_parse($bug->get_contents()); $description .= '<br /><br />' . $lang['labels.fields.reproductible'] . ' : ' . ($bug->is_reproductible() ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common')); if ($bug->is_reproductible()) { $description .= '<br />' . FormatingHelper::second_parse($bug->get_reproduction_method()) . '<br />'; } if ($types) { $description .= '<br />' . $lang['labels.fields.type'] . ' : ' . (isset($types[$bug->get_type()]) ? stripslashes($types[$bug->get_type()]) : $lang['notice.none']); } if ($categories) { $description .= '<br />' . $lang['labels.fields.category'] . ' : ' . (isset($categories[$bug->get_category()]) ? stripslashes($categories[$bug->get_category()]) : $lang['notice.none_e']); } if ($severities) { $description .= '<br />' . $lang['labels.fields.severity'] . ' : ' . (isset($severities[$bug->get_severity()]) ? stripslashes($severities[$bug->get_severity()]['name']) : $lang['notice.none']); } if ($priorities) { $description .= '<br />' . $lang['labels.fields.priority'] . ' : ' . (isset($priorities[$bug->get_priority()]) ? stripslashes($priorities[$bug->get_priority()]) : $lang['notice.none_e']); } if ($versions) { $description .= '<br />' . $lang['labels.fields.version'] . ' : ' . (isset($versions[$bug->get_detected_in()]) ? stripslashes($versions[$bug->get_detected_in()]['name']) : $lang['notice.not_defined']); } $item = new FeedItem(); $item->set_title($bug->get_title()); $item->set_link($link); $item->set_guid($link); $item->set_desc($description); $item->set_date($bug->get_submit_date()); $item->set_auth(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS); $data->add_item($item); } $results->dispose(); return $data; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Bug::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
* Description: TODO: To be written. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ require_once 'XTemplate/xtpl.php'; require_once 'data/Tracker.php'; require_once 'modules/Bugs/Bug.php'; require_once 'modules/Bugs/Forms.php'; require_once 'modules/Releases/Release.php'; global $app_strings; global $mod_strings; global $mod_strings; global $current_user; global $sugar_version, $sugar_config; $focus = new Bug(); $seedRelease = new Release(); if (isset($_REQUEST['record'])) { $focus->retrieve($_REQUEST['record']); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $focus->id = ""; $focus->bug_number = ""; } $prefillArray = array('priority' => 'priority', 'name' => 'name', 'description' => 'description', 'status' => 'status', 'type' => 'type'); foreach ($prefillArray as $requestKey => $focusVar) { if (isset($_REQUEST[$requestKey]) && is_null($focus->{$focusVar})) { $focus->{$focusVar} = urldecode($_REQUEST[$requestKey]); } } if (is_null($focus->status)) {
$account->industry = array_rand($app_list_strings['industry_dom']); $account->account_type = "Customer"; $account->save(); $account_ids[] = $account->id; $accounts[] = $account; // Create a case for the account $case = new aCase(); $case->account_id = $account->id; $case->priority = array_rand($app_list_strings['case_priority_dom']); $case->status = array_rand($app_list_strings['case_status_dom']); $case->name = $sugar_demodata['case_seed_names'][mt_rand(0, 4)]; $case->assigned_user_id = $account->assigned_user_id; $case->assigned_user_name = $account->assigned_user_name; $case->save(); // Create a bug for the account $bug = new Bug(); $bug->account_id = $account->id; $bug->priority = array_rand($app_list_strings['bug_priority_dom']); $bug->status = array_rand($app_list_strings['bug_status_dom']); $bug->name = $sugar_demodata['bug_seed_names'][mt_rand(0, 4)]; $bug->assigned_user_id = $account->assigned_user_id; $bug->assigned_user_name = $account->assigned_user_name; $bug->save(); $note = new Note(); $note->parent_type = 'Accounts'; $note->parent_id = $account->id; $seed_data_index = mt_rand(0, 3); $note->name = $sugar_demodata['note_seed_names_and_Descriptions'][$seed_data_index][0]; $note->description = $sugar_demodata['note_seed_names_and_Descriptions'][$seed_data_index][1]; $note->assigned_user_id = $account->assigned_user_id; $note->assigned_user_name = $account->assigned_user_name;
function bug_by_search($name, $where = '', $msi_id = '0') { $seed = new Bug(); if (!$seed->ACLAccess('ListView')) { return array(); } if ($where == '') { $where = $seed->build_generic_where_clause($name); } $response = $seed->get_list("name", $where, 0); $list = $response['list']; $output_list = array(); // create a return array of names and email addresses. foreach ($list as $value) { $output_list[] = get_bean_array($value, $msi_id, 'Bug'); } return $output_list; }
* Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * All copies of the Covered Code must include on each user interface screen: * (i) the "Powered by SugarCRM" logo and * (ii) the SugarCRM copyright notice * in the same form as they appear in the distribution. See full license for * requirements. * * The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. ********************************************************************************/ /********************************************************************************* * Description: TODO: To be written. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ require_once 'modules/Bugs/Bug.php'; global $mod_strings; $focus = new Bug(); if (!isset($_REQUEST['record'])) { sugar_die($mod_strings['ERR_DELETE_RECORD']); } $focus->clear_bug_account_relationship($_REQUEST['record']); header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);