} $contact_id = (int) w2PgetParam($_GET, 'contact_id', 0); //check permissions for this record $perms =& $AppUI->acl(); $canRead = $perms->checkModuleItem($m, 'view', $contact_id); if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $tab = $AppUI->processIntState('ContactVwTab', $_GET, 'tab', 0); $df = $AppUI->getPref('SHDATEFORMAT'); $df .= ' ' . $AppUI->getPref('TIMEFORMAT'); // load the record data $msg = ''; $contact = new CContact(); $canDelete = $contact->canDelete($msg, $contact_id); $is_user = $contact->isUser($contact_id); $canEdit = $perms->checkModuleItem($m, 'edit', $contact_id); if (!$contact->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } elseif ($contact->contact_private && $contact->contact_owner != $AppUI->user_id && $contact->contact_owner && $contact_id != 0) { // check only owner can edit $AppUI->redirect('m=public&a=access_denied'); } $countries = w2PgetSysVal('GlobalCountries'); // Get the contact details for company and department $company_detail = $contact->getCompanyDetails(); $dept_detail = $contact->getDepartmentDetails(); // Get the Contact info (phone, emails, etc) for the contact $methods = $contact->getContactMethods();
public function testIsUser() { $contact = new CContact(); $contact->contact_id = 1; $this->assertTrue($contact->isUser()); $contact->contact_id = 13; $this->assertFalse($contact->isUser()); $contact->contact_id = 'monkey!'; $this->assertFalse($contact->isUser()); }