| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
/**
* This is a string which is either a_b or b_a used to determine the relationship between to contacts
- *
*/
public $_rtype;
/**
* This is a string which is used to determine the relationship between to contacts
- *
*/
public $_rtypeId;
/**
* Display name of contact a
- *
*/
public $_display_name_a;
/**
* Display name of contact b
- *
*/
public $_display_name_b;
case CRM_Core_Action::VIEW:
CRM_Utils_System::setTitle(ts('View Relationship for %1', array(1 => $this->_display_name_a)));
break;
+
case CRM_Core_Action::ADD:
CRM_Utils_System::setTitle(ts('Add Relationship for %1', array(1 => $this->_display_name_a)));
break;
+
case CRM_Core_Action::UPDATE:
CRM_Utils_System::setTitle(ts('Edit Relationship for %1', array(1 => $this->_display_name_a)));
break;
+
case CRM_Core_Action::DELETE:
CRM_Utils_System::setTitle(ts('Delete Relationship for %1', array(1 => $this->_display_name_a)));
break;
'entity_id' => $this->_relationshipId,
'entity_table' => 'civicrm_relationship',
'limit' => 1,
- 'version' => 3
+ 'version' => 3,
);
- $note = civicrm_api('Note' ,'getsingle', $noteParams);
+ $note = civicrm_api('Note', 'getsingle', $noteParams);
$defaults['note'] = CRM_Utils_Array::value('note', $note);
}
}
}
/**
- * This function is used to add the rules for form.
+ * add the rules for form.
*
* @return void
*/
$jsData = array();
// Get just what we need to keep the dom small
$whatWeWant = array_flip(array('contact_type_a', 'contact_type_b', 'contact_sub_type_a', 'contact_sub_type_b'));
- foreach($this->_allRelationshipNames as $id => $vals) {
+ foreach ($this->_allRelationshipNames as $id => $vals) {
if ($vals['name_a_b'] === 'Employee of') {
$this->assign('employmentRelationship', $id);
}
'select',
'relationship_type_id',
ts('Relationship Type'),
- array( '' => ts('- select -')) + $relationshipList,
+ array('' => ts('- select -')) + $relationshipList,
TRUE,
array('class' => 'crm-select2 huge')
);
$label = $this->_action & CRM_Core_Action::ADD ? ts('Contact(s)') : ts('Contact');
- $contactField = $this->addEntityRef('related_contact_id', $label, array('multiple' => TRUE, 'create' => TRUE), TRUE);
+ $contactField = $this->addEntityRef('related_contact_id', $label, array(
+ 'multiple' => TRUE,
+ 'create' => TRUE,
+ ), TRUE);
// This field cannot be updated
if ($this->_action & CRM_Core_Action::UPDATE) {
$contactField->freeze();
);
// Save relationships
- list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::create($params, $ids);
+ list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::createMultiple($params, $ids);
// if this is called from case view,
//create an activity for case role removal.CRM-4480
}
if ($valid) {
- CRM_Core_Session::setStatus(ts('Relationship created.', array('count' => $valid, 'plural' => '%count relationships created.')), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('Relationship created.', array(
+ 'count' => $valid,
+ 'plural' => '%count relationships created.',
+ )), ts('Saved'), 'success');
}
if ($invalid) {
- CRM_Core_Session::setStatus(ts('%count relationship record was not created due to an invalid contact type.', array('count' => $invalid, 'plural' => '%count relationship records were not created due to invalid contact types.')), ts('%count invalid relationship record', array('count' => $invalid, 'plural' => '%count invalid relationship records')));
+ CRM_Core_Session::setStatus(ts('%count relationship record was not created due to an invalid contact type.', array(
+ 'count' => $invalid,
+ 'plural' => '%count relationship records were not created due to invalid contact types.',
+ )), ts('%count invalid relationship record', array(
+ 'count' => $invalid,
+ 'plural' => '%count invalid relationship records',
+ )));
}
if ($duplicate) {
- CRM_Core_Session::setStatus(ts('One relationship was not created because it already exists.', array('count' => $duplicate, 'plural' => '%count relationships were not created because they already exist.')), ts('%count duplicate relationship', array('count' => $duplicate, 'plural' => '%count duplicate relationships')));
+ CRM_Core_Session::setStatus(ts('One relationship was not created because it already exists.', array(
+ 'count' => $duplicate,
+ 'plural' => '%count relationships were not created because they already exist.',
+ )), ts('%count duplicate relationship', array(
+ 'count' => $duplicate,
+ 'plural' => '%count duplicate relationships',
+ )));
}
if ($saved) {
CRM_Core_Session::setStatus(ts('Relationship record has been updated.'), ts('Saved'), 'success');
'entity_id' => $id,
'entity_table' => 'civicrm_relationship',
);
- $existing = civicrm_api3('note' ,'get', $noteParams);
+ $existing = civicrm_api3('note', 'get', $noteParams);
if (!empty($existing['id'])) {
$noteParams['id'] = $existing['id'];
}
/**
* Date validation
*
- * @param array $params (reference ) an assoc array of name/value pairs
+ * @param array $params
+ * (reference ) an assoc array of name/value pairs.
*
- * @return mixed true or array of errors
- * @static
+ * @return bool|array
+ * mixed true or array of errors
*/
public static function dateRule($params) {
$errors = array();