addTable('contacts'); $q->addQuery('contact_id'); $q->addWhere('contact_updatekey= \'' . $updatekey . '\''); $contactkey = $q->loadList(); $q->clear(); $contact_id = count($contactkey) ? $contactkey[0]['contact_id'] : 0; $company_id = intval(w2PgetParam($_REQUEST, 'company_id', 0)); $company_name = w2PgetParam($_REQUEST, 'company_name', null); // check permissions for this record if (!$contact_id) { echo ($AppUI->_('You are not authorized to use this page. If you should be authorized please contact') . ' ' . $w2Pconfig['company_name'] . ' ' . $AppUI->_('to give you another valid link, thank you.')); exit; } // load the record data $msg = ''; $row = new CContact(); if (!$row->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) { // check only owner can edit $AppUI->redirect('m=public&a=access_denied'); } $df = $AppUI->getPref('SHDATEFORMAT'); $df .= ' ' . $AppUI->getPref('TIMEFORMAT'); // setup the title block $ttl = $contact_id > 0 ? 'Edit Contact' : 'Add Contact'; $company_detail = $row->getCompanyDetails(); $dept_detail = $row->getDepartmentDetails(); if ($contact_id == 0 && $company_id > 0) { $company_detail['company_id'] = $company_id; $company_detail['company_name'] = $company_name; echo $company_name; } $uistyle = 'web2project'; $outsider = $row->contact_first_name . ' ' . $row->contact_last_name; require W2P_BASE_DIR . '/style/' . $uistyle . '/overrides.php'; require W2P_BASE_DIR . '/style/' . $uistyle . '/header.php'; $countries = array('' => $AppUI->_('(Select a Country)')) + w2PgetSysVal('GlobalCountries'); if (function_exists('styleRenderBoxTop')) { echo styleRenderBoxTop(); } ?>