コード例 #1
0
 /**
  * Edit specific milestone
  *
  * @param void
  * @return null
  */
 function edit()
 {
     $this->wireframe->print_button = false;
     if ($this->active_milestone->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_milestone->canEdit($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     //$this->wireframe->addPageMessage(lang('<a href=":url">Click here</a> if you wish to reschedule this milestone', array('url' => $this->active_milestone->getRescheduleUrl())), 'info');
     $this->wireframe->addPageMessage(lang('<a href=":url">Click here</a> if you wish to reschedule this project', array('url' => $this->active_milestone->getRescheduleUrl())), 'info');
     $milestone_data = $this->request->post('milestone');
     if (!is_array($milestone_data)) {
         $milestone_data = array('name' => $this->active_milestone->getName(), 'body' => $this->active_milestone->getBody(), 'start_on' => $this->active_milestone->getStartOn(), 'due_on' => $this->active_milestone->getDueOn(), 'priority' => $this->active_milestone->getPriority(), 'assignees' => Assignments::findAssignmentDataByObject($this->active_milestone), 'tags' => $this->active_milestone->getTags(), 'project_id' => $this->active_milestone->getProjectId(), 'visibility' => $this->active_milestone->getVisibility());
     }
     // if
     //BOF:mod 20121116
     $options = array();
     $options[] = array('url' => 'javascript:convert_object_to_ticket(\'' . $this->active_milestone->getProjectId() . '\', \'' . $this->active_milestone->getId() . '\', \'' . $this->active_milestone->getType() . '\');', 'text' => 'Ticket');
     $options[] = array('url' => 'javascript:convert_object_to_page(\'' . $this->active_milestone->getProjectId() . '\', \'' . $this->active_milestone->getId() . '\', \'' . $this->active_milestone->getType() . '\');', 'text' => 'Page');
     $this->wireframe->addPageAction(lang('Convert To'), 'javascript://', $options);
     //EOF:mod 20121116
     $this->smarty->assign('milestone_data', $milestone_data);
     //BOF: task 07 | AD
     $this->smarty->assign('is_edit_mode', '1');
     //EOF: task 07 | AD
     if ($this->request->isSubmitted()) {
         if (!isset($milestone_data['assignees'])) {
             $milestone_data['assignees'] = array(array(), 0);
         }
         // if
         db_begin_work();
         $old_name = $this->active_milestone->getName();
         //BOF: task 07 | AD
         $old_project_id = $this->active_milestone->getProjectId();
         //EOF: task 07 | AD
         $this->active_milestone->setAttributes($milestone_data);
         $save = $this->active_milestone->save();
         if ($save && !is_error($save)) {
             db_commit();
             //BOF: task 07 | AD
             //BOF: mod
             $this->active_milestone->register_departments(!empty($milestone_data['departments']) ? $milestone_data['departments'] : array(), implode(',', $milestone_data['departments']));
             //EOF: mod
             //BOF:mod 20110614
             $assignees_flag_data = $this->request->post('assignee');
             $this->active_milestone->register_assignees_flag($assignees_flag_data);
             //EOF:mod 20110614
             if ($old_project_id != $this->active_milestone->getProjectId()) {
                 $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                 mysql_select_db(DB_NAME, $link);
                 $query = "select id, integer_field_1 \n\t\t\t\t\t\t\tfrom healingcrystals_project_objects where \n\t\t\t\t\t\t\tmilestone_id ='" . $this->active_milestone->getId() . "' and \n\t\t\t\t\t\t\tproject_id='" . $old_project_id . "' and type='Ticket' and integer_field_1 is not null";
                 $result = mysql_query($query);
                 $next_id = Tickets::findNextTicketIdByProject($this->active_milestone->getProjectId());
                 while ($ticket = mysql_fetch_assoc($result)) {
                     mysql_query("update healingcrystals_project_objects \n\t\t\t\t\t\t\t\t\tset integer_field_1='" . $next_id . "'  \n\t\t\t\t\t\t\t\t\twhere id='" . $ticket['id'] . "'");
                     $next_id++;
                 }
                 $query = "select updated_on, updated_by_id, updated_by_name, integer_field_1 from healingcrystals_project_objects where id='" . $this->active_milestone->getId() . "'";
                 $result = mysql_query($query, $link);
                 $info = mysql_fetch_assoc($result);
                 $query = "update healingcrystals_project_objects set \n\t\t\t\t\t\t\tproject_id ='" . $this->active_milestone->getProjectId() . "', \n\t\t\t\t\t\t\tupdated_on =" . (empty($info['updated_on']) ? "null" : "'" . $info['updated_on'] . "'") . ", \n\t\t\t\t\t\t\tupdated_by_id =" . (empty($info['updated_by_id']) ? "null" : "'" . $info['updated_by_id'] . "'") . ", \n\t\t\t\t\t\t\tupdated_by_name =" . (empty($info['updated_by_name']) ? "null" : "'" . mysql_real_escape_string($info['updated_by_name']) . "'") . ", \n\t\t\t\t\t\t\tupdated_by_email =" . (empty($info['updated_by_email']) ? "null" : "'" . $info['updated_by_email'] . "'") . " \n\t\t\t\t\t\t\twhere milestone_id ='" . $this->active_milestone->getId() . "' and project_id='" . $old_project_id . "'";
                 mysql_query($query);
                 $query = "update healingcrystals_project_objects set category_id=null where id='" . $this->active_milestone->getId() . "'";
                 mysql_query($query);
                 mysql_close($link);
             }
             //EOF: task 07 | AD
             if ($this->request->getFormat() == FORMAT_HTML) {
                 //flash_success('Milestone ":name" has been updated', array('name' => $old_name), false, true);
                 flash_success('Project ":name" has been updated', array('name' => $old_name), false, true);
                 $this->redirectToUrl($this->active_milestone->getViewUrl());
             } else {
                 $this->serveData($this->active_milestone, 'milestone');
             }
             // if
         } else {
             db_rollback();
             if ($this->request->getFormat() == FORMAT_HTML) {
                 $this->smarty->assign('errors', $save);
             } else {
                 $this->serveData($save);
             }
             // if
         }
         // if
     }
     // if
 }
コード例 #2
0
 /**
  * Save this object into the database
  *
  * @param void
  * @return boolean
  * @throws DBQueryError
  * @throws ValidationErrors
  */
 function save()
 {
     $is_new = $this->isNew();
     $modified_fields = $this->modified_fields;
     $old_values = $this->old_values;
     if ($is_new) {
         $this->setType(get_class($this));
     }
     // if
     if ($this->isModified()) {
         $this->setVersion($this->getVersion() + 1);
         // increment object version on save...
     }
     // if
     db_begin_work();
     $save = parent::save();
     if (!$save || is_error($save)) {
         db_rollback();
         return $save;
     }
     // if
     // Log activities...
     if ($this->log_activities) {
         if ($is_new) {
             if ($this->log_creation) {
                 if (instance_of($this, 'File')) {
                     $activity_log = new NewFileActivityLog();
                 } else {
                     $activity_log = new ObjectCreatedActivityLog();
                 }
                 // if
                 $activity_log->log($this, $this->getCreatedBy());
             }
             // if
         } else {
             if ($this->log_update || $this->log_move_to_trash || $this->log_restore_from_trash) {
                 $trashed = false;
                 $restored = false;
                 if (is_array($this->modified_fields) && in_array('state', $modified_fields)) {
                     if (isset($old_values['state']) && $old_values['state'] == STATE_DELETED && $this->getState() == STATE_VISIBLE) {
                         $restored = true;
                     }
                     // if
                     if (isset($old_values['state']) && $old_values['state'] == STATE_VISIBLE && $this->getState() == STATE_DELETED) {
                         $trashed = true;
                     }
                     // if
                 }
                 // if
                 if ($trashed) {
                     if ($this->log_move_to_trash) {
                         $activity_log = new ObjectTrashedActivityLog();
                         $activity_log->log($this);
                     }
                     // if
                 } elseif ($restored) {
                     if ($this->log_restore_from_trash) {
                         $activity_log = new ObjectRestoredActivityLog();
                         $activity_log->log($this);
                     }
                     // if
                 } else {
                     if ($this->log_update) {
                         $activity_log = new ObjectUpdatedActivityLog();
                         $activity_log->log($this);
                     }
                     // if
                 }
                 // if
             }
             // if
         }
         // if
     }
     // if
     // Pending files
     if ($this->can_have_attachments && is_foreachable($this->pending_files)) {
         foreach ($this->pending_files as $pending_file) {
             $attachment = new Attachment();
             $attachment->setParent($this);
             if (isset($pending_file['created_by']) && (instance_of($pending_file['created_by'], 'User') || instance_of($pending_file['created_by'], 'AnonymousUser'))) {
                 $attachment->setCreatedBy($pending_file['created_by']);
             } else {
                 $attachment->setCreatedBy($this->getCreatedBy());
             }
             // if
             $attachment->setName($pending_file['name']);
             $attachment->setLocation(substr($pending_file['location'], strlen(UPLOAD_PATH) + 1));
             $attachment->setMimeType($pending_file['type']);
             $attachment->setSize($pending_file['size']);
             if (instance_of($this, 'File')) {
                 $attachment->setAttachmentType(ATTACHMENT_TYPE_FILE_REVISION);
             }
             // if
             $save_attachment = $attachment->save();
             if (is_error($save_attachment)) {
                 db_rollback();
                 return $save_attachment;
             }
             // if
         }
         // foreach
         $this->pending_files = array();
         // no more pending files
     }
     // if
     // Set assignees
     if ($this->can_have_assignees && $this->new_assignees !== false) {
         $this->old_assignees = $is_new ? array(array(), 0) : Assignments::findAssignmentDataByObject($this);
         //BOF: mod
         list($old_subscribers, ) = $this->old_assignees;
         if (count($old_subscribers)) {
             foreach ($old_subscribers as $old_subscriber_id) {
                 Subscriptions::unsubscribe(new User($old_subscriber_id), $this);
             }
         }
         //EOF: mod
         Assignments::deleteByObject($this);
         $object_id = $this->getId();
         if (is_array($this->new_assignees)) {
             list($assignees, $owner_id) = $this->new_assignees;
             if (is_foreachable($assignees)) {
                 $user_ids = array();
                 $to_insert = array();
                 foreach ($assignees as $user_id) {
                     if (in_array($user_id, $user_ids)) {
                         continue;
                     }
                     // if
                     $is_owner = $user_id == $owner_id ? 1 : 0;
                     $to_insert[] = "({$user_id}, {$object_id}, {$is_owner})";
                     $user_ids[] = $user_id;
                 }
                 // foreach
                 // Insert assignments
                 $insert = db_execute('INSERT INTO ' . TABLE_PREFIX . 'assignments VALUES ' . implode(', ', $to_insert));
                 if (is_error($insert) && !$insert) {
                     db_rollback();
                     return $insert;
                 }
                 // if
                 // Not array... Empty...
             } else {
                 $assignees = array();
                 $owner_id = 0;
             }
             // if
             // Clean up assignments cache
             clean_assignments_cache();
             // Make sure that all assignees are subscribed
             Subscriptions::subscribeUsers($assignees, $this, false);
             // Check if object is reassigned
             if (!$is_new) {
                 $reassigned = false;
                 if (is_array($this->old_assignees)) {
                     list($old_assignees, $old_owner_id) = $this->old_assignees;
                 } else {
                     $old_assignees = array();
                     $old_owner_id = 0;
                 }
                 // if
                 if ($owner_id != $old_owner_id) {
                     $reassigned = true;
                 } else {
                     if (count($assignees) != count($old_assignees)) {
                         $reassigned = true;
                     } else {
                         foreach ($assignees as $assignee_id) {
                             if (!in_array($assignee_id, $old_assignees)) {
                                 $reassigned = true;
                             }
                             // if
                         }
                         // foerach
                     }
                     // if
                 }
                 // if
                 if ($reassigned) {
                     event_trigger('on_project_object_reassigned', array(&$this, $this->old_assignees, array($assignees, $owner_id)));
                 } else {
                     $this->old_assignees = false;
                 }
                 // if
             }
             // if
         }
         // if
         $this->new_assignees = false;
         // reset
     }
     // if
     // Search index
     if (is_foreachable($this->searchable_fields)) {
         $update_search_index = false;
         // Do we need to update search index?
         foreach ($this->searchable_fields as $field) {
             if (in_array($field, $modified_fields)) {
                 $update_search_index = true;
                 break;
             }
             // if
         }
         // foreach
         // We do... Prepare and if content is empty remove it from the index
         if ($update_search_index) {
             $content = '';
             foreach ($this->searchable_fields as $field) {
                 $value = $this->getFieldValue($field);
                 if ($value) {
                     $content .= $value . "\n\n";
                 }
                 // if
             }
             // foreach
             if ($content) {
                 search_index_set($this->getId(), 'ProjectObject', $content);
             } else {
                 search_index_remove($this->getId(), 'ProjectObject');
             }
             // if
         }
         // if
     }
     // if
     // Update properties of child elements
     if (!$is_new) {
         $properties = array();
         if (in_array('visibility', $modified_fields)) {
             $properties['setVisibility'] = $this->getVisibility();
         }
         // if
         if (in_array('milestone_id', $modified_fields)) {
             $properties['setMilestoneId'] = $this->getMilestoneId();
         }
         // if
         $types = array();
         if ($this->can_have_comments) {
             $types[] = 'Comment';
         }
         // if
         if ($this->can_have_tasks) {
             $types[] = 'Task';
         }
         // if
         if ($this->getHasTime()) {
             $types[] = 'TimeRecord';
         }
         // if
         ProjectObjects::updatePropertiesByParent($this, $properties, $types);
     }
     // if
     if (!$is_new && in_array('project_id', $modified_fields)) {
         ActivityLogs::updateProjectIdCache($this);
     }
     // if
     // Commit and done!
     db_commit();
     return true;
 }
コード例 #3
0
 function quickreminder()
 {
     if ($this->active_task->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall());
     }
     if (empty($this->active_task_parent)) {
         $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall());
     }
     if (!$this->active_task->canEdit($this->logged_user) && $this->active_task->getProjectId() != TASK_LIST_PROJECT_ID) {
         $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall());
     }
     $task_data = $this->request->post('taskquick');
     if (!is_array($task_data)) {
         $task_data = array('body' => $this->active_task->getBody(), 'priority' => $this->active_task->getPriority(), 'due_on' => $this->active_task->getDueOn(), 'assignees' => Assignments::findAssignmentDataByObject($this->active_task));
         $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
         mysql_select_db(DB_NAME);
         $query = "select * from healingcrystals_project_object_misc where object_id='" . $this->active_task->getId() . "'";
         $result = mysql_query($query, $link);
         if (mysql_num_rows($result)) {
             $info = mysql_fetch_assoc($result);
             //$task_data['recurring_flag'] = '1';
             //$task_data['recurring_period'] = $info['recurring_period'];
             //if (empty($task_data['recurring_period'])){
             //   $task_data['recurring_flag'] = '0';
             //}
             //$task_data['recurring_period_type'] = $info['recurring_period_type'];
             //$task_data['recurring_period_condition'] = $info['recurring_period_condition'];
             //$task_data['recurring_end_date'] = empty($info['recurring_end_date']) || $info['recurring_end_date']=='0000-00-00' ? '' : dateval($info['recurring_end_date']);
             if (!empty($info['reminder_date']) && $info['reminder_date'] != '0000-00-00 00:00:00') {
                 list($date, $time) = explode(' ', $info['reminder_date']);
                 list($h, $m, $s) = explode(':', $time);
                 $date = dateval($date);
             }
             $task_data['reminder'] = $date;
             $task_data['remindermeridian'] = $h >= 12 ? 'PM' : 'AM';
             $task_data['reminderhours'] = $h > 12 ? $h - 12 : ($h != 0 ? $h : '12');
             $task_data['reminderminutes'] = $m;
             $task_data['auto_email_status'] = $info['auto_email_status'];
         } else {
             //$task_data['recurring_flag'] = '0';
             //$task_data['recurring_period'] = '';
             //$task_data['recurring_period_type'] = 'D';
             //$task_data['recurring_period_condition'] = 'after_due_date';
             //$task_data['recurring_end_date'] = '';
             $task_data['reminder'] = '';
             $task_data['reminderhours'] = '';
             $task_data['reminderminutes'] = '';
             $task_data['remindermeridian'] = '';
             $task_data['auto_email_status'] = '';
         }
         mysql_close($link);
     }
     $this->smarty->assign('task_data', $task_data);
     $refresh_task_content_mode = false;
     if ($this->request->isSubmitted()) {
         if (!isset($task_data['assignees'])) {
             $task_data['assignees'] = array(array(), 0);
         }
         db_begin_work();
         $old_name = $this->active_task->getBody();
         $this->active_task->setAttributes($task_data);
         $save = $this->active_task->save();
         if ($save && !is_error($save)) {
             db_commit();
             $reminder = dateval($task_data['reminder']);
             $reminderhours = (int) $task_data['reminderhours'];
             $reminderminutes = (int) $task_data['reminderminutes'];
             $remindermeridian = $task_data['remindermeridian'];
             if (!empty($reminder)) {
                 if (!empty($remindermeridian) && $remindermeridian == 'PM' && $reminderhours < 12) {
                     $reminderhours += 12;
                 } elseif (!empty($remindermeridian) && $remindermeridian == 'AM' && $reminderhours == 12) {
                     $reminderhours = 0;
                 }
                 $reminder = $reminder . ' ' . $reminderhours . ':' . $reminderminutes;
             }
             $email_flag = empty($task_data['email_flag']) ? '0' : '1';
             $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
             mysql_select_db(DB_NAME);
             $query = "select * from healingcrystals_project_object_misc where object_id='" . $this->active_task->getId() . "'";
             $result = mysql_query($query, $link);
             if (mysql_num_rows($result)) {
                 $query01 = "update healingcrystals_project_object_misc set reminder_date='" . $reminder . "', auto_email_status='" . $email_flag . "', last_modified=now() where object_id='" . $this->active_task->getId() . "'";
                 mysql_query($query01, $link);
             } else {
                 $query01 = "insert into healingcrystals_project_object_misc\n                                    (object_id,\n                                     reminder_date,\n                                     recurring_period,\n                                     recurring_period_type,\n                                     recurring_period_condition,\n                                     recurring_end_date,\n                                     date_added,\n                                     auto_email_status) values\n                                     ('" . $this->active_task->getId() . "',\n                                      '" . $reminder . "',\n                                      null,\n                                      null,\n                                      null,\n                                      null,\n                                      now(),\n                                      '" . $email_flag . "')";
                 mysql_query($query01, $link);
             }
             mysql_close($link);
             /*if($this->request->isApiCall()) {
             			$this->serveData($this->active_task, 'task');
             		} else {
             			flash_success('Task ":name" has been updated', array('name' => str_excerpt(strip_tags($old_name), 80, '...')), false, false);
             			$this->redirectToUrl($this->active_task_parent->getViewUrl() . '#task' . $this->active_task->getId());
             		}*/
             $refresh_task_content_mode = true;
         } else {
             db_rollback();
             if ($this->request->isApiCall()) {
                 $this->serveData($save);
             } else {
                 $this->smarty->assign('errors', $save);
             }
         }
     } else {
         if ($this->request->isApiCall()) {
             $this->httpError(HTTP_ERR_BAD_REQUEST, null, true, true);
         }
     }
     $this->smarty->assign('refresh_task_content_mode', $refresh_task_content_mode);
 }
コード例 #4
0
 /**
  * Update existing ticket
  *
  * @param void
  * @return null
  */
 function edit()
 {
     $mode = $_GET['mode'];
     if (!empty($mode) and $mode == 'reminder_only_update_mode') {
         $this->register_reminder_info($this->active_ticket->getId(), array('date' => dateval($_POST['reminder']), 'period' => $_POST['recurring_period'], 'type' => $_POST['recurring_period_type']));
         $this->redirectToUrl($this->active_ticket->getViewUrl());
     } else {
         $this->wireframe->print_button = false;
         if ($this->request->isApiCall() && !$this->request->isSubmitted()) {
             $this->httpError(HTTP_ERR_BAD_REQUEST);
         }
         // ifs
         if ($this->active_ticket->isNew()) {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
         if (!$this->active_ticket->canEdit($this->logged_user)) {
             $this->httpError(HTTP_ERR_FORBIDDEN);
         }
         // if
         $ticket_data = $this->request->post('ticket');
         if (!is_array($ticket_data)) {
             $ticket_data = array('name' => $this->active_ticket->getName(), 'body' => $this->active_ticket->getBody(), 'visibility' => $this->active_ticket->getVisibility(), 'parent_id' => $this->active_ticket->getParentId(), 'milestone_id' => $this->active_ticket->getMilestoneId(), 'priority' => $this->active_ticket->getPriority(), 'assignees' => Assignments::findAssignmentDataByObject($this->active_ticket), 'tags' => $this->active_ticket->getTags(), 'due_on' => $this->active_ticket->getDueOn());
         }
         // if
         //BOF:mod 20121116
         $options = array();
         $options[] = array('url' => 'javascript:convert_object_to_milestone(\'' . $this->active_ticket->getProjectId() . '\', \'' . $this->active_ticket->getId() . '\', \'' . $this->active_ticket->getType() . '\');', 'text' => 'Milestone');
         $options[] = array('url' => 'javascript:convert_object_to_page(\'' . $this->active_ticket->getProjectId() . '\', \'' . $this->active_ticket->getId() . '\', \'' . $this->active_ticket->getType() . '\');', 'text' => 'Page');
         $this->wireframe->addPageAction(lang('Convert To'), 'javascript://', $options);
         //EOF:mod 20121116
         $this->smarty->assign('ticket_data', $ticket_data);
         $this->smarty->assign('reminder', $this->get_reminder_info($this->active_ticket->getId()));
         //BOF:mod 13052011
         $this->smarty->assign('ticket_id', $this->active_ticket->getId());
         //EOF:mod 13052011
         if ($this->request->isSubmitted()) {
             if (!isset($ticket_data['assignees'])) {
                 $ticket_data['assignees'] = array(array(), 0);
             }
             // if
             db_begin_work();
             $this->active_ticket->setAttributes($ticket_data);
             $save = $this->active_ticket->save();
             if ($save && !is_error($save)) {
                 db_commit();
                 //BOF: mod
                 $this->active_ticket->register_departments(!empty($ticket_data['departments']) ? $ticket_data['departments'] : array());
                 $this->register_reminder_info($this->active_ticket->getId(), array('date' => dateval($ticket_data['reminder']), 'period' => $ticket_data['recurring_period'], 'type' => $ticket_data['recurring_period_type']));
                 //EOF: mod
                 $assignees_flag_data = $this->request->post('assignee');
                 $this->active_ticket->register_assignees_flag($assignees_flag_data);
                 //BOF:mod 13052011
                 //if ($ticket_data['flag_fyi'] || $ticket_data['flag_actionrequest']){
                 //	$this->register_flag_fyi_actionrequest($ticket_data['flag_fyi'], $ticket_data['flag_actionrequest']);
                 //}
                 //EOF:mod 13052011
                 if ($ticket_data['new_team_id'] != $this->active_project->getId()) {
                     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                     mysql_select_db(DB_NAME);
                     $query = "select max(integer_field_1) as count from healingcrystals_project_objects where project_id='" . $ticket_data['new_team_id'] . "' and type='Ticket'";
                     $result = mysql_query($query, $link);
                     $cur_ticket_id = '1';
                     if (mysql_num_rows($result)) {
                         $info = mysql_fetch_assoc($result);
                         if ($info['count']) {
                             $cur_ticket_id = (int) $info['count'] + 1;
                         }
                     }
                     $query = "update healingcrystals_project_objects set project_id='" . $ticket_data['new_team_id'] . "', milestone_id=null, integer_field_1='" . $cur_ticket_id . "', updated_on=now(), updated_by_id='" . $this->logged_user->getId() . "' where id='" . $this->active_ticket->getId() . "' and project_id='" . $this->active_project->getId() . "'";
                     mysql_query($query);
                     $query = "update healingcrystals_project_objects set project_id='" . $ticket_data['new_team_id'] . "', milestone_id=null, updated_on=now(), updated_by_id='" . $this->logged_user->getId() . "' where parent_id='" . $this->active_ticket->getId() . "' and project_id='" . $this->active_project->getId() . "'";
                     mysql_query($query);
                     mysql_close($link);
                     $this->redirectToUrl(assemble_url('project_ticket', array('project_id' => $ticket_data['new_team_id'], 'ticket_id' => $cur_ticket_id)));
                 }
                 if ($this->request->getFormat() == FORMAT_HTML) {
                     flash_success('Ticket #:ticket_id has been updated', array('ticket_id' => $this->active_ticket->getTicketId()));
                     $this->redirectToUrl($this->active_ticket->getViewUrl());
                 } else {
                     $this->serveData($this->active_ticket, 'ticket');
                 }
                 // if
             } else {
                 db_rollback();
                 if ($this->request->getFormat() == FORMAT_HTML) {
                     $this->smarty->assign('errors', $save);
                 } else {
                     $this->serveData($save);
                 }
                 // if
             }
             // if
         }
         // if
     }
 }