Beispiel #1
0
$tpl = new Template_Helper();
$tpl->setTemplate('popup.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$iss_id = isset($_GET['iss_id']) ? (int) $_GET['iss_id'] : (isset($_POST['issue_id']) ? (int) $_POST['issue_id'] : null);
$cat = isset($_GET['cat']) ? (string) $_GET['cat'] : (isset($_POST['cat']) ? (string) $_POST['cat'] : null);
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
$status_id = isset($_GET['new_sta_id']) ? (int) $_GET['new_sta_id'] : null;
$isr_id = isset($_POST['isr_id']) ? (int) $_POST['isr_id'] : null;
$items = isset($_POST['item']) ? (array) $_POST['item'] : null;
if ($cat == 'delete_note') {
    $res = Note::remove($id);
    $tpl->assign('note_delete_result', $res);
} elseif ($cat == 'delete_time') {
    $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();
 /**
  * Method used to remove a specific phone support entry from the
  * application.
  *
  * @param   integer $phone_id The phone support entry ID
  * @return  integer 1 if the removal worked, -1 or -2 otherwise
  */
 public static function remove($phone_id)
 {
     $stmt = 'SELECT
                 phs_iss_id,
                 phs_ttr_id,
                 phs_usr_id
              FROM
                 {{%phone_support}}
              WHERE
                 phs_id=?';
     $details = DB_Helper::getInstance()->getRow($stmt, array($phone_id));
     if ($details['phs_usr_id'] != Auth::getUserID()) {
         return -2;
     }
     $stmt = 'DELETE FROM
                 {{%phone_support}}
              WHERE
                 phs_id=?';
     try {
         DB_Helper::getInstance()->query($stmt, array($phone_id));
     } catch (DbException $e) {
         return -1;
     }
     Issue::markAsUpdated($details['phs_iss_id']);
     $usr_id = Auth::getUserID();
     History::add($details['phs_iss_id'], $usr_id, 'phone_entry_removed', 'Phone Support entry removed by {user}', array('user' => User::getFullName($usr_id)));
     if (!empty($details['phs_ttr_id'])) {
         $time_result = Time_Tracking::removeTimeEntry($details['phs_ttr_id'], $details['phs_usr_id']);
         if ($time_result == 1) {
             return 2;
         }
         return $time_result;
     }
     return 1;
 }