~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to lib/eventum/class.template_helper.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:
156
156
            $prj_id = Auth::getCurrentProject();
157
157
            if (!empty($prj_id)) {
158
158
                $role_id = User::getRoleByUser($usr_id, $prj_id);
 
159
                $has_crm = CRM::hasCustomerIntegration($prj_id);
159
160
                $core = $core + array(
160
161
                    'project_id'    =>  $prj_id,
161
162
                    'project_name'  =>  Auth::getCurrentProjectName(),
162
 
                    'has_customer_integration'  =>  Customer::hasCustomerIntegration($prj_id),
163
 
                    'customer_backend_name'     =>  Customer::getBackendImplementationName($prj_id),
 
163
                    'has_crm'       =>  $has_crm,
164
164
                    'current_role'              =>  $role_id,
165
165
                    'current_role_name'         =>  User::getRole($role_id),
166
166
                    'feature_access'            =>  Access::getFeatureAccessArray($usr_id)
167
167
                );
 
168
                if ($has_crm) {
 
169
                    $crm = CRM::getInstance($prj_id);
 
170
                    $core['crm_template_path'] = $crm->getTemplatePath();
 
171
                    if ($role_id == User::getRoleID('Customer')) {
 
172
                        try {
 
173
                            $contact = $crm->getContact($core['user']['usr_customer_contact_id']);
 
174
                            $core['allowed_customers'] = $contact->getCustomers();
 
175
                            $core['current_customer'] = $crm->getCustomer(Auth::getCurrentCustomerID(false));
 
176
                        } catch (CRMException $e) {}
 
177
                    }
 
178
                }
168
179
            }
169
180
            $info = User::getDetails($usr_id);
170
181
            $raw_projects = Project::getAssocList(Auth::getUserID(), false, true);