/** * Method used to remove all issues associated with a specific list of * projects. * * XXX: this is dangerous, maybe remove such methods? * * @param array $ids The list of projects to look for * @return boolean */ public static function removeByProjects($ids) { $stmt = 'SELECT iss_id FROM {{%issue}} WHERE iss_prj_id IN (' . DB_Helper::buildList($ids) . ')'; try { $res = DB_Helper::getInstance()->getColumn($stmt, $ids); } catch (DbException $e) { return false; } if (count($res) > 0) { self::deleteAssociations($res); Attachment::removeByIssues($res); SCM::removeByIssues($res); Impact_Analysis::removeByIssues($res); self::deleteUserAssociations($res); Note::removeByIssues($res); Time_Tracking::removeTimeEntriesByIssues($res); Notification::removeByIssues($res); Custom_Field::removeByIssues($res); Phone_Support::removeByIssues($res); History::removeByIssues($res); // now really delete the issues $items = implode(', ', $res); $stmt = "DELETE FROM\n {{%issue}}\n WHERE\n iss_id IN ({$items})"; DB_Helper::getInstance()->query($stmt); } return true; }
// | Copyright (c) 2008 - 2010 Sun Microsystem Inc. | // | Copyright (c) 2011 - 2013 Eventum Team. | // | | // | This program is free software; you can redistribute it and/or modify | // | it under the terms of the GNU General Public License as published by | // | the Free Software Foundation; either version 2 of the License, or | // | (at your option) any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('requirement.tpl.html'); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); if (@$_POST['cat'] == 'set_analysis') { $res = Impact_Analysis::update($_POST['isr_id']); $tpl->assign('set_analysis_result', $res); } $tpl->displayTemplate();
$res = Time_Tracking::removeTimeEntry($id, $usr_id); $tpl->assign('time_delete_result', $res); } elseif ($cat == 'bulk_update') { $res = Issue::bulkUpdate(); $tpl->assign('bulk_update_result', $res); } elseif ($cat == 'set_initial_impact') { $res = Issue::setImpactAnalysis($iss_id); $tpl->assign('set_initial_impact_result', $res); } elseif ($cat == 'add_requirement') { $res = Impact_Analysis::insert($iss_id); $tpl->assign('add_requirement_result', $res); } elseif ($cat == 'set_impact_requirement') { $res = Impact_Analysis::update($isr_id); $tpl->assign('set_impact_requirement_result', $res); } elseif ($cat == 'delete_requirement') { $res = Impact_Analysis::remove(); $tpl->assign('requirement_delete_result', $res); } elseif ($cat == 'save_filter') { $res = Filter::save(); $tpl->assign('save_filter_result', $res); } elseif ($cat == 'delete_filter') { $res = Filter::remove(); $tpl->assign('delete_filter_result', $res); } elseif ($cat == 'remove_support_email') { $res = Support::removeAssociation(); $tpl->assign('remove_association_result', $res); } elseif ($cat == 'delete_attachment') { $res = Attachment::remove($id); $tpl->assign('remove_attachment_result', $res); } elseif ($cat == 'delete_file') { $res = Attachment::removeIndividualFile($id);
// | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 59 Temple Place - Suite 330 | // | Boston, MA 02111-1307, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ // // @(#) $Id: s.requirement.php 1.5 03/01/16 01:47:32-00:00 jpm $ // include_once "config.inc.php"; include_once APP_INC_PATH . "class.template.php"; include_once APP_INC_PATH . "class.auth.php"; include_once APP_INC_PATH . "class.impact_analysis.php"; include_once APP_INC_PATH . "db_access.php"; $tpl = new Template_API(); $tpl->setTemplate("requirement.tpl.html"); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); if (@$HTTP_POST_VARS["cat"] == "set_analysis") { $res = Impact_Analysis::update($HTTP_POST_VARS["isr_id"]); $tpl->assign("set_analysis_result", $res); } $tpl->displayTemplate();
$show_category = 0; } $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE); if (!empty($auto_switched_from)) { $tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($auto_switched_from))); } $setup = Setup::load(); $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]); $tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_API::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'show_releases' => $show_releases, 'show_category' => $show_category, 'categories' => Category::getAssocList($prj_id), 'quarantine' => Issue::getQuarantineInfo($issue_id))); if ($role_id != User::getRoleID('customer')) { if (@$_REQUEST['show_all_drafts'] == 1) { $show_all_drafts = true; } else { $show_all_drafts = false; } if (Workflow::hasWorkflowIntegration($prj_id)) { $statuses = Workflow::getAllowedStatuses($prj_id, $issue_id); // if currently selected release is not on list, go ahead and add it. } else { $statuses = Status::getAssocStatusList($prj_id); } if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) { $statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']); } $time_entries = Time_Tracking::getListing($issue_id); $tpl->assign(array('notes' => Note::getListing($issue_id), 'is_user_assigned' => Issue::isAssignedToUser($issue_id, $usr_id), 'is_user_authorized' => Authorized_Replier::isUserAuthorizedReplier($issue_id, $usr_id), 'phone_entries' => Phone_Support::getListing($issue_id), 'phone_categories' => Phone_Support::getCategoryAssocList($prj_id), 'checkins' => SCM::getCheckinList($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'time_entries' => $time_entries['list'], 'total_time_spent' => $time_entries['total_time_spent'], 'impacts' => Impact_Analysis::getListing($issue_id), 'statuses' => $statuses, 'drafts' => Draft::getList($issue_id, $show_all_drafts), 'groups' => Group::getAssocList($prj_id))); } } } } $tpl->displayTemplate();
/** * Method used to remove all issues associated with a specific list of * projects. * * @access public * @param array $ids The list of projects to look for * @return boolean */ function removeByProjects($ids) { $items = @implode(", ", Misc::escapeInteger($ids)); $stmt = "SELECT\n iss_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n WHERE\n iss_prj_id IN ({$items})"; $res = $GLOBALS["db_api"]->dbh->getCol($stmt); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return false; } else { if (count($res) > 0) { Issue::deleteAssociations($res); Attachment::removeByIssues($res); SCM::removeByIssues($res); Impact_Analysis::removeByIssues($res); Issue::deleteUserAssociations($res); Note::removeByIssues($res); Time_Tracking::removeByIssues($res); Notification::removeByIssues($res); Custom_Field::removeByIssues($res); Phone_Support::removeByIssues($res); History::removeByIssues($res); // now really delete the issues $items = implode(", ", $res); $stmt = "DELETE FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n WHERE\n iss_id IN ({$items})"; $GLOBALS["db_api"]->dbh->query($stmt); } return true; } }