*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
- * This class generates view mode for CiviCase
- *
+ * This class generates view mode for CiviCase.
*/
class CRM_Case_Form_CaseView extends CRM_Core_Form {
/**
/**
* Set variables up before form is built.
- *
- * @return void
*/
public function preProcess() {
$this->_showRelatedCases = CRM_Utils_Array::value('relatedCases', $_GET);
$this->assign('caseID', $this->_caseID);
$this->assign('contactID', $this->_contactID);
+ $this->assign('contactType', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
//validate case id.
$this->_userCases = array();
}
/**
- * Set default values for the form. For edit/view mode
- * the default values are retrieved from the database
+ * Set default values for the form.
*
- *
- * @return void
+ * @return array;
*/
public function setDefaultValues() {
$defaults = array();
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
//this call is for show related cases.
return;
}
+ $allowedRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType($this->_contactID);
+
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header')
- ->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js', 2, 'html-header');
+ ->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js', 2, 'html-header')
+ ->addVars('relationshipTypes', CRM_Contact_Form_Relationship::getRelationshipTypeMetadata($allowedRelationshipTypes));
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($this->_caseType, 'CaseRoles');
$emailActivityType = array_search('Email', $allActTypes);
$pdfActivityType = array_search('Print PDF Letter', $allActTypes);
+ if ($pdfActivityType) {
+ $this->assign('exportDoc', CRM_Utils_System::url('civicrm/activity/pdf/add',
+ "action=add&context=standalone&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=$pdfActivityType"));
+ }
+
// remove Open Case activity type since we're inside an existing case
if ($openActTypeId = array_search('Open Case', $allActTypes)) {
unset($aTypes[$openActTypeId]);
$activityLinks[$url] = $label;
}
- $this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-plus twenty'));
+ $this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, array('class' => 'crm-select2 crm-action-menu fa-calendar-check-o twenty'));
if ($this->_hasAccessToAllCases) {
$this->add('select', 'report_id', '',
array('' => ts('Activity Audit')) + $reports,
FALSE,
- array('class' => 'crm-select2 crm-action-menu action-icon-clipboard')
+ array('class' => 'crm-select2 crm-action-menu fa-list-alt')
);
$this->add('select', 'timeline_id', '',
array('' => ts('Add Timeline')) + $reports,
FALSE,
- array('class' => 'crm-select2 crm-action-menu action-icon-play')
+ array('class' => 'crm-select2 crm-action-menu fa-list-ol')
);
}
$this->addElement('submit', $this->getButtonName('next'), ' ', array('class' => 'hiddenElement'));
CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo);
$this->assign('globalGroupInfo', $globalGroupInfo);
- // List of relationship types
- $baoRel = new CRM_Contact_BAO_Relationship();
- $relType = $baoRel->getRelationType('Individual');
- $roleTypes = array();
- foreach ($relType as $k => $v) {
- $roleTypes[substr($k, 0, strpos($k, '_'))] = $v;
- }
- $this->add('select', 'role_type', ts('Relationship Type'), array('' => ts('- select type -')) + $roleTypes, FALSE, array('class' => 'crm-select2 twenty'));
+ // List relationship types for adding an arbitrary new role to the case
+ $this->add('select',
+ 'role_type',
+ ts('Relationship Type'),
+ array('' => ts('- select type -')) + $allowedRelationshipTypes,
+ FALSE,
+ array('class' => 'crm-select2 twenty', 'data-select-params' => '{"allowClear": false}')
+ );
$hookCaseSummary = CRM_Utils_Hook::caseSummary($this->_caseID);
if (is_array($hookCaseSummary)) {
/**
* Process the form.
- *
- * @return void
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);