X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FForm%2FTask%2FAddToHousehold.php;h=f537e23ca0c6d74d65682772f56fdfd69024a1f9;hb=68383a402e0b8365c7c50e5304f746a2a9bfb5a7;hp=0490eb929e3fadb3241e9a180e8f3b941d60d508;hpb=dc195289d598fae6feedab517c4ababcdb840541;p=civicrm-core.git diff --git a/CRM/Contact/Form/Task/AddToHousehold.php b/CRM/Contact/Form/Task/AddToHousehold.php index 0490eb929e..f537e23ca0 100644 --- a/CRM/Contact/Form/Task/AddToHousehold.php +++ b/CRM/Contact/Form/Task/AddToHousehold.php @@ -45,10 +45,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { * @return void */ public function preProcess() { - /* - * initialize the task and row fields - */ - + // initialize the task and row fields parent::preProcess(); } @@ -65,7 +62,8 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { $this->add('select', 'relationship_type_id', ts('Relationship Type'), array( - '' => ts('- select -')) + + '' => ts('- select -'), + ) + CRM_Contact_BAO_Relationship::getRelationType("Household"), TRUE ); @@ -145,10 +143,11 @@ class CRM_Contact_Form_Task_AddToHousehold 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; } @@ -160,15 +159,33 @@ class CRM_Contact_Form_Task_AddToHousehold 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 => $house))); + $status = array( + ts('%count %2 %3 relationship created', array( + 'count' => $valid, + 'plural' => '%count %2 %3 relationships created', + 2 => $relationship, + 3 => $house, + )), + ); 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 => $house)); + $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 => $house, + )); } 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 = ''; - 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)); } } @@ -235,8 +252,8 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { } // get the count of contact - $contactBAO = new CRM_Contact_BAO_Contact(); - $query = new CRM_Contact_BAO_Query($searchValues); + $contactBAO = new CRM_Contact_BAO_Contact(); + $query = new CRM_Contact_BAO_Query($searchValues); $searchCount = $query->searchQuery(0, 0, NULL, TRUE); $form->set('searchCount', $searchCount); if ($searchCount <= 50) { @@ -268,8 +285,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task { $contact_type = '