Esempio n. 1
0
 /**
  * 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;
     }
 }