~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to htdocs/redeem_incident.php

  • Committer: Bryan Alsdorf
  • Date: 2013-08-23 03:50:34 UTC
  • mto: (4033.1.168 eventum-skysql)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: bryan@montyprogram.com-20130823035034-7f5r3pt1xg0xnnhk
Initial commit of CRM migration

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
$prj_id = Auth::getCurrentProject();
36
36
$issue_id = $_REQUEST['iss_id'];
 
37
$usr_id = Auth::getUserID();
 
38
 
 
39
if ((!Issue::canAccess($issue_id, $usr_id)) || (Auth::getCurrentRole() <= User::getRoleID("Customer"))) {
 
40
    $tpl->setTemplate("permission_denied.tpl.html");
 
41
    $tpl->displayTemplate();
 
42
    exit;
 
43
}
37
44
 
38
45
$tpl = new Template_Helper();
39
46
$tpl->setTemplate('redeem_incident.tpl.html');
 
47
$crm = CRM::getInstance($prj_id);
 
48
$contract = $crm->getContract(Issue::getContractID($issue_id));
40
49
 
41
50
if (!empty($_REQUEST['submit'])) {
42
51
    // update counts
43
 
    $res = Customer::updateRedeemedIncidents($prj_id, $issue_id, @$_REQUEST['redeem']);
 
52
    $res = $contract->updateRedeemedIncidents($issue_id, @$_REQUEST['redeem']);
44
53
    $tpl->assign('res', $res);
45
54
    Misc::mapMessages($res, array(
46
55
            1   =>  array('Thank you, the issue was successfully marked.', Misc::MSG_INFO),
48
57
            -2  =>  array('This issue already has been marked as redeemed', Misc::MSG_ERROR),
49
58
    ));
50
59
}
51
 
$details = Customer::getDetails($prj_id, Issue::getCustomerID($issue_id), true);
 
60
$details = $contract->getDetails();
52
61
 
53
62
$tpl->assign(array(
54
63
    'issue_id'  =>  $issue_id,
55
 
    'redeemed'  =>  Customer::getRedeemedIncidentDetails($prj_id, $issue_id),
 
64
    'redeemed'  =>  $contract->getRedeemedIncidentDetails($issue_id),
56
65
    'incident_details'  =>  $details['incident_details']
57
66
));
58
67
$tpl->displayTemplate();