~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to htdocs/select_project.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:
32
32
$tpl = new Template_Helper();
33
33
$tpl->setTemplate("select_project.tpl.html");
34
34
 
 
35
session_start();
 
36
 
35
37
// check if cookies are enabled, first of all
36
38
if (!Auth::hasCookieSupport(APP_COOKIE)) {
37
39
    Auth::redirect("index.php?err=11");
60
62
    if (count($assigned_projects) == 1) {
61
63
        list($prj_id,) = each($assigned_projects);
62
64
        Auth::setCurrentProject($prj_id, 0);
63
 
        handleExpiredCustomer($prj_id);
 
65
        checkCustomerAuthentication($prj_id);
64
66
 
65
67
        if (!empty($_GET["url"])) {
66
68
            Auth::redirect($_GET["url"]);
79
81
        }
80
82
        if (!empty($assigned_projects[$prj_id])) {
81
83
            Auth::setCurrentProject($prj_id, 0);
82
 
            handleExpiredCustomer($prj_id);
 
84
            checkCustomerAuthentication($prj_id);
83
85
            Auth::redirect($_GET["url"]);
84
86
        }
85
87
    }
105
107
            $_POST["remember"] = 0;
106
108
        }
107
109
        Auth::setCurrentProject($prj_id, $_POST["remember"]);
108
 
        handleExpiredCustomer($prj_id);
 
110
        checkCustomerAuthentication($prj_id);
109
111
 
110
112
        if (!empty($_POST["url"])) {
111
113
            Auth::redirect($_POST["url"]);
116
118
}
117
119
$tpl->displayTemplate();
118
120
 
119
 
function handleExpiredCustomer($prj_id)
 
121
function checkCustomerAuthentication($prj_id)
120
122
{
121
 
    GLOBAL $tpl;
122
 
 
123
 
    if (Customer::hasCustomerIntegration($prj_id)) {
 
123
    if (CRM::hasCustomerIntegration($prj_id)) {
 
124
        $crm = CRM::getInstance($prj_id);
124
125
        // check if customer is expired
125
126
        $usr_id = Auth::getUserID();
126
127
        $contact_id = User::getCustomerContactID($usr_id);
127
128
        $customer_id = User::getCustomerID($usr_id);
128
129
        if ((!empty($contact_id)) && ($contact_id != -1)) {
129
 
            Customer::authenticateCustomer($prj_id, $customer_id, $contact_id);
 
130
            $crm->authenticateCustomer();
130
131
        }
131
132
    }
132
133
}