Beispiel #1
0
include_once APP_INC_PATH . "class.phone_support.php";
include_once APP_INC_PATH . "class.status.php";
include_once APP_INC_PATH . "class.history.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.authorized_replier.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("popup.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
if (@$HTTP_GET_VARS["cat"] == "delete_note") {
    $res = Note::remove($HTTP_GET_VARS["id"]);
    $tpl->assign("note_delete_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_time") {
    $res = Time_Tracking::removeEntry($HTTP_GET_VARS["id"], $usr_id);
    $tpl->assign("time_delete_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "bulk_update") {
    $res = Issue::bulkUpdate();
    $tpl->assign("bulk_update_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "set_initial_impact") {
    $res = Issue::setImpactAnalysis($HTTP_POST_VARS["issue_id"]);
    $tpl->assign("set_initial_impact_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "add_requirement") {
    $res = Impact_Analysis::insert($HTTP_POST_VARS["issue_id"]);
    $tpl->assign("add_requirement_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "set_impact_requirement") {
    $res = Impact_Analysis::update($HTTP_POST_VARS["isr_id"]);
    $tpl->assign("set_impact_requirement_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "delete_requirement") {
    $res = Impact_Analysis::remove();
 /**
  * Method used to remove a specific phone support entry from the 
  * application.
  *
  * @access  public
  * @param   integer $phone_id The phone support entry ID
  * @return  integer 1 if the removal worked, -1 or -2 otherwise
  */
 function remove($phone_id)
 {
     $phone_id = Misc::escapeInteger($phone_id);
     $stmt = "SELECT\n                    phs_iss_id,\n                    phs_ttr_id,\n                    phs_usr_id\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support\n                 WHERE\n                    phs_id={$phone_id}";
     $details = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
     if ($details['phs_usr_id'] != Auth::getUserID()) {
         return -2;
     }
     $stmt = "DELETE FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support\n                 WHERE\n                    phs_id={$phone_id}";
     $res = $GLOBALS["db_api"]->dbh->query($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return -1;
     } else {
         Issue::markAsUpdated($details["phs_iss_id"]);
         // need to save a history entry for this
         History::add($details["phs_iss_id"], Auth::getUserID(), History::getTypeID('phone_entry_removed'), 'Phone Support entry removed by ' . User::getFullName(Auth::getUserID()));
         if (!empty($details["phs_ttr_id"])) {
             $time_result = Time_Tracking::removeEntry($details["phs_ttr_id"], $details['phs_usr_id']);
             if ($time_result == 1) {
                 return 2;
             } else {
                 return $time_result;
             }
         } else {
             return 1;
         }
     }
 }