public function testAddCaseToContact() { $params = array('case_id' => 1, 'contact_id' => 17); CRM_Case_BAO_CaseContact::create($params); $recent = CRM_Utils_Recent::get(); $this->assertEquals('Test Contact - Housing Support', $recent[0]['title']); }
/** * class constructor * * @return CRM_Core_Smarty * @access private */ function CRM_Core_Smarty() { parent::Smarty(); $config =& CRM_Core_Config::singleton(); $this->template_dir = $config->templateDir; $this->compile_dir = $config->templateCompileDir; $this->use_sub_dirs = true; $this->plugins_dir = array($config->smartyDir . 'plugins', $config->pluginsDir); // add the session and the config here $config =& CRM_Core_Config::singleton(); $session =& CRM_Core_Session::singleton(); $recent =& CRM_Utils_Recent::get(); $this->assign_by_ref('config', $config); $this->assign_by_ref('session', $session); $this->assign_by_ref('recentlyViewed', $recent); $this->assign('displayRecent', true); $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL')); }
/** * Set the post action values for the block. * * php is lame and u cannot call functions from static initializers * hence this hack * * @param int $id * * @return void */ private static function setTemplateValues($id) { switch ($id) { case self::CREATE_NEW: self::setTemplateShortcutValues(); break; case self::DASHBOARD: self::setTemplateDashboardValues(); break; case self::ADD: $defaultLocation = CRM_Core_BAO_LocationType::getDefault(); $defaultPrimaryLocationId = $defaultLocation->id; $values = array('postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'), 'primaryLocationType' => $defaultPrimaryLocationId); foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { $values[$greeting . '_id'] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting); } self::setProperty(self::ADD, 'templateValues', $values); break; case self::LANGSWITCH: // gives the currentPath without trailing empty lcMessages to be completed $values = array('queryString' => CRM_Utils_System::getLinksUrl('lcMessages', TRUE, FALSE, FALSE)); self::setProperty(self::LANGSWITCH, 'templateValues', $values); break; case self::FULLTEXT_SEARCH: $urlArray = array('fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'CRM_Contact_Form_Search_Custom_FullText', 'value', 'name')); self::setProperty(self::FULLTEXT_SEARCH, 'templateValues', $urlArray); break; case self::RECENTLY_VIEWED: $recent = CRM_Utils_Recent::get(); self::setProperty(self::RECENTLY_VIEWED, 'templateValues', array('recentlyViewed' => $recent)); break; case self::EVENT: self::setTemplateEventValues(); break; } }
/** * set the post action values for the block. * * php is lame and u cannot call functions from static initializers * hence this hack * * @return void * @access private */ private function setTemplateValues($id) { switch ($id) { case self::CREATE_NEW: self::setTemplateShortcutValues(); break; case self::DASHBOARD: self::setTemplateDashboardValues(); break; case self::ADD: require_once "CRM/Core/BAO/LocationType.php"; $defaultLocation =& CRM_Core_BAO_LocationType::getDefault(); $defaultPrimaryLocationId = $defaultLocation->id; $values = array('postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'), 'primaryLocationType' => $defaultPrimaryLocationId); self::setProperty(self::ADD, 'templateValues', $values); break; case self::FULLTEXT_SEARCH: $urlArray = array('fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'CRM_Contact_Form_Search_Custom_FullText', 'value', 'name')); self::setProperty(self::FULLTEXT_SEARCH, 'templateValues', $urlArray); break; case self::CIVICRM_CONTENT: break; case self::RECENTLY_VIEWED: require_once 'CRM/Utils/Recent.php'; $recent =& CRM_Utils_Recent::get(); self::setProperty(self::RECENTLY_VIEWED, 'templateValues', array('recentlyViewed' => $recent)); break; case self::EVENT: self::setTemplateEventValues(); break; } }