/** * Additional data to update after a delete call (such as denormalized values in other tables). * * @param boolean Do the query? */ function post_delete($doquery = true) { $this->registry->db->query_first("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "phrase\r\n\t\t\tWHERE varname = 'issuestatus" . $this->fetch_field('issuestatusid') . "'\r\n\t\t\t\tAND fieldname = 'projecttools'\r\n\t\t"); if ($this->info['rebuild_caches']) { require_once DIR . '/includes/adminfunctions_language.php'; build_language(); require_once DIR . '/includes/adminfunctions_projecttools.php'; build_issue_type_cache(); } // update any issues with this status... if ($this->info['delete_deststatusid'] and $dest_status = $this->registry->db->query_first("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuestatus\r\n\t\t\tWHERE issuestatusid = " . intval($this->info['delete_deststatusid']) . "\r\n\t\t\t\tAND issuetypeid = '" . $this->registry->db->escape_string($this->fetch_field('issuetypeid')) . "'\r\n\t\t")) { // ... to the destination status $this->registry->db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pt_issue SET\r\n\t\t\t\t\tissuestatusid = {$dest_status['issuestatusid']}\r\n\t\t\t\tWHERE issuestatusid = " . $this->fetch_field('issuestatusid')); } else { // ... or, if we don't know a destination, the default start state $this->registry->db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pt_issue AS issue\r\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_projecttype AS projecttype ON\r\n\t\t\t\t\t(projecttype.projectid = issue.projectid\r\n\t\t\t\t\tAND projecttype.issuetypeid = '" . $this->registry->db->escape_string($this->fetch_field('issuetypeid')) . "')\r\n\t\t\t\tSET issue.issuestatusid = projecttype.startstatusid\r\n\t\t\t\tWHERE issue.issuestatusid = " . $this->fetch_field('issuestatusid')); } if ($this->info['rebuild_caches']) { rebuild_project_counters(false); rebuild_milestone_counters(false); } ($hook = vBulletinHook::fetch_hook('pt_issuestatusdata_delete')) ? eval($hook) : false; return true; }
$case = ''; foreach ($vbulletin->GPC['order'] as $statusid => $displayorder) { $case .= "\nWHEN " . intval($statusid) . " THEN " . $displayorder; } if ($case) { $db->query_write("\r\n\t\t\tUPDATE " . TABLE_PREFIX . "pt_issuestatus SET\r\n\t\t\t\tdisplayorder = CASE issuestatusid {$case} ELSE displayorder END\r\n\t\t"); } $case = ''; foreach ($vbulletin->GPC['issuecompleted'] as $statusid => $issuecompleted) { $case .= "\nWHEN " . intval($statusid) . " THEN " . ($issuecompleted ? 1 : 0); } if ($case) { $db->query_write("\r\n\t\t\tUPDATE " . TABLE_PREFIX . "pt_issuestatus SET\r\n\t\t\t\tissuecompleted = CASE issuestatusid {$case} ELSE 0 END\r\n\t\t"); } build_issue_type_cache(); rebuild_project_counters(false); rebuild_milestone_counters(false); define('CP_REDIRECT', 'project.php?do=typelist'); print_stop_message('saved_display_order_successfully'); } // ######################################################################## if ($_REQUEST['do'] == 'typelist') { print_form_header('', ''); print_table_header($vbphrase['issue_type_manager']); print_description_row('<a href="#" onclick="js_open_help(\'project\', \'typelist\', \'\'); return false;">[' . $vbphrase['help'] . ']</a> | ' . construct_link_code($vbphrase['add_issue_type'], 'project.php?do=typeadd'), false, 2, '', 'center'); print_table_footer(); $statuses = array(); $status_data = $db->query_read("\r\n\t\tSELECT *\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuestatus\r\n\t\tORDER BY displayorder\r\n\t"); while ($status = $db->fetch_array($status_data)) { $statuses["{$status['issuetypeid']}"][] = $status; }