Merge pull request #5076 from colemanw/Attachment
[civicrm-core.git] / CRM / Contact / Form / Relationship.php
index e3f0e7e57f56046267c220514f284ba51d7af3a5..e386bc5752e613bd280aefb147aa0b18a505582e 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -55,25 +55,21 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
 
   /**
    * 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;
 
@@ -149,12 +145,15 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
       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;
@@ -276,7 +275,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
   }
 
   /**
-   * This function is used to add the rules for form.
+   * add the rules for form.
    *
    * @return void
    */
@@ -351,7 +350,10 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
     );
 
     $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();
@@ -467,13 +469,28 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
     }
 
     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');
@@ -542,8 +559,8 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
    * @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();