INFRA-132 - Batch #8
[civicrm-core.git] / CRM / Contact / Form / Task / AddToOrganization.php
index b167015558cbf833d807407ca882d7144e8e6a29..325031c912747849ea6bb7178c0148f45472ecc2 100644 (file)
@@ -41,11 +41,10 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
   /**
    * Build the form object
    *
-   * @access public
    *
    * @return void
    */
-  function preProcess() {
+  public function preProcess() {
     // initialize the task and row fields
     parent::preProcess();
   }
@@ -53,11 +52,10 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
   /**
    * Build the form object
    *
-   * @access public
    *
    * @return void
    */
-  function buildQuickForm() {
+  public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Add Contacts to Organization'));
     $this->addElement('text', 'name', ts('Find Target Organization'));
 
@@ -65,7 +63,8 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
       'relationship_type_id',
       ts('Relationship Type'),
       array(
-        '' => ts('- select -')) +
+        '' => ts('- select -'),
+      ) +
       CRM_Contact_BAO_Relationship::getRelationType("Organization"), TRUE
     );
 
@@ -89,14 +88,12 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
       $this->assign('searchRows', $searchRows);
     }
 
-
     $this->assign('searchCount', $searchCount);
     $this->assign('searchDone', $this->get('searchDone'));
     $this->assign('contact_type_display', ts('Organization'));
     $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'crm-form-submit'));
     $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'crm-form-submit'));
 
-
     $this->addButtons(array(
         array(
           'type' => 'next',
@@ -114,7 +111,6 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
   /**
    * Process the form after the input has been submitted and validated
    *
-   * @access public
    *
    * @return void
    */
@@ -148,10 +144,11 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
         }
 
         if (CRM_Contact_BAO_Relationship::checkDuplicateRelationship($params,
-            CRM_Utils_Array::value('contact', $ids),
-            // step 2
-            $params['contact_check']
-          )) {
+          CRM_Utils_Array::value('contact', $ids),
+          // step 2
+          $params['contact_check']
+        )
+        ) {
           $duplicate++;
           continue;
         }
@@ -162,15 +159,33 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task {
       list($rtype, $a_b) = explode('_', $data['relationship_type_id'], 2);
       $relationship = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $rtype, "label_$a_b");
 
-      $status = array(ts('%count %2 %3 relationship created', array('count' => $valid, 'plural' => '%count %2 %3 relationships created', 2 => $relationship, 3 => $org)));
+      $status = array(
+        ts('%count %2 %3 relationship created', array(
+            'count' => $valid,
+            'plural' => '%count %2 %3 relationships created',
+            2 => $relationship,
+            3 => $org,
+          )),
+      );
       if ($duplicate) {
-        $status[] = ts('%count was skipped because the contact is already %2 %3', array('count' => $duplicate, 'plural' => '%count were skipped because the contacts are already %2 %3', 2 => $relationship, 3 => $org));
+        $status[] = ts('%count was skipped because the contact is already %2 %3', array(
+            'count' => $duplicate,
+            'plural' => '%count were skipped because the contacts are already %2 %3',
+            2 => $relationship,
+            3 => $org,
+          ));
       }
       if ($invalid) {
-        $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array('count' => $invalid, 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'));
+        $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array(
+            'count' => $invalid,
+            'plural' => '%count relationships were not created because the contact is not of the right type for this relationship',
+          ));
       }
       $status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
-      CRM_Core_Session::setStatus($status, ts('Relationship created.', array('count' => $valid, 'plural' => 'Relationships created.')), 'success', array('expires' => 0));
+      CRM_Core_Session::setStatus($status, ts('Relationship created.', array(
+            'count' => $valid,
+            'plural' => 'Relationships created.',
+          )), 'success', array('expires' => 0));
     }
   }