From 7808aae676a26ed14a8e3319ccd3dbb6c7b1d0c5 Mon Sep 17 00:00:00 2001 From: Saurabh Batra Date: Thu, 22 Oct 2015 18:01:00 +0530 Subject: [PATCH] Comment fixes and function clean-up for CRM/Activity directory. --- CRM/Activity/ActionMapping.php | 5 ++ CRM/Activity/BAO/Activity.php | 94 ++++++++++++------------- CRM/Activity/BAO/ActivityContact.php | 6 +- CRM/Activity/BAO/ICalendar.php | 2 +- CRM/Activity/BAO/Query.php | 2 +- CRM/Activity/Form/Activity.php | 60 ++++++++-------- CRM/Activity/Form/ActivityFilter.php | 12 ---- CRM/Activity/Form/ActivityView.php | 8 +-- CRM/Activity/Form/Search.php | 1 - CRM/Activity/Form/Task.php | 4 +- CRM/Activity/Form/Task/AddToTag.php | 2 +- CRM/Activity/Form/Task/Batch.php | 18 +++-- CRM/Activity/Form/Task/Email.php | 2 +- CRM/Activity/Form/Task/FileOnCase.php | 6 -- CRM/Activity/Form/Task/PickOption.php | 12 ++-- CRM/Activity/Form/Task/PickProfile.php | 8 +-- CRM/Activity/Form/Task/Print.php | 10 +-- CRM/Activity/Form/Task/SMS.php | 7 +- CRM/Activity/Import/Form/MapField.php | 24 +++---- CRM/Activity/Import/Form/Preview.php | 4 +- CRM/Activity/Import/Form/Summary.php | 4 +- CRM/Activity/Import/Parser.php | 12 +--- CRM/Activity/Import/Parser/Activity.php | 22 +++--- CRM/Activity/Page/AJAX.php | 24 +++---- CRM/Activity/Page/Tab.php | 4 +- CRM/Activity/Selector/Activity.php | 12 ++-- CRM/Activity/Selector/Search.php | 10 +-- CRM/Activity/Task.php | 16 ++--- CRM/Activity/Tokens.php | 11 ++- 29 files changed, 183 insertions(+), 219 deletions(-) diff --git a/CRM/Activity/ActionMapping.php b/CRM/Activity/ActionMapping.php index 0511c16ea9..d3d4afc077 100644 --- a/CRM/Activity/ActionMapping.php +++ b/CRM/Activity/ActionMapping.php @@ -25,6 +25,11 @@ +--------------------------------------------------------------------+ */ +/** + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + use Civi\ActionSchedule\RecipientBuilder; /** diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 20a66fc1d0..e2f32c1439 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -32,7 +32,7 @@ */ /** - * This class is for activity functions.s + * This class is for activity functions. */ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { @@ -86,8 +86,8 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); // TODO: at some stage we'll have to deal - // TODO: with multiple values for assignees and targets, but - // TODO: for now, let's just fetch first row + // with multiple values for assignees and targets, but + // for now, let's just fetch first row. $defaults['assignee_contact'] = CRM_Activity_BAO_ActivityContact::retrieveContactIdsByActivityId($activity->id, $assigneeID); $assignee_contact_names = CRM_Activity_BAO_ActivityContact::getNames($activity->id, $assigneeID); $defaults['assignee_contact_value'] = implode('; ', $assignee_contact_names); @@ -125,7 +125,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { ); } - //get case subject + // Get case subject. $defaults['case_subject'] = CRM_Case_BAO_Case::getCaseSubject($activity->id); CRM_Core_DAO::storeValues($activity, $defaults); @@ -206,12 +206,12 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $msgs[] = " source={$sourceContactId}"; } - //get target contacts. + // get target contacts. $targetContactIds = CRM_Activity_BAO_ActivityContact::getNames($activity->id, $targetID); if (!empty($targetContactIds)) { $msgs[] = " target =" . implode(',', array_keys($targetContactIds)); } - //get assignee contacts. + // get assignee contacts. $assigneeContactIds = CRM_Activity_BAO_ActivityContact::getNames($activity->id, $assigneeID); if (!empty($assigneeContactIds)) { $msgs[] = " assignee =" . implode(',', array_keys($assigneeContactIds)); @@ -254,9 +254,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $activityContact->record_type_id = $recordTypeID; } - //let's check if activity contact record exits and then delete. - //looks like delete leads to deadlock when multiple simultaneous - //requests are done. CRM-15470 + // Let's check if activity contact record exits and then delete. + // Looks like delete leads to deadlock when multiple simultaneous + // requests are done. CRM-15470 if ($activityContact->find()) { $activityContact->delete(); } @@ -295,7 +295,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } } - //set priority to Normal for Auto-populated activities (for Cases) + // Set priority to Normal for Auto-populated activities (for Cases) if (CRM_Utils_Array::value('priority_id', $params) === NULL && // if not set and not 0 !CRM_Utils_Array::value('id', $params) @@ -486,7 +486,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $t = array_slice($params['target_contact_id'], 0, 1); $recentContactId = $t[0]; } - //is array check fixes warning without degrading functionality but it seems this bit of code may no longer work + // Is array check fixes warning without degrading functionality but it seems this bit of code may no longer work // as it may always be an array elseif (isset($params['target_contact_id']) && !is_array($params['target_contact_id'])) { $msgs[] = "target={$params['target_contact_id']}"; @@ -663,7 +663,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { * Relevant data object values of open activities */ public static function &getActivities($input) { - //step 1: Get the basic activity data + // Step 1: Get the basic activity data. $bulkActivityTypeID = CRM_Core_OptionGroup::getValue( 'activity_type', 'Bulk Email', @@ -751,7 +751,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { SELECT DISTINCT tbl.* from ( {$sqlClause} ) as tbl "; - //filter case activities - CRM-5761 + // Filter case activities - CRM-5761. $components = self::activityComponents(); if (!in_array('CiviCase', $components)) { $query .= " @@ -791,7 +791,7 @@ WHERE ac.record_type_id != %1 CRM_Core_DAO::executeQuery($query, $params); // for each activity insert one target contact - // if we load all target contacts the performance will suffer a lot for mass-activities; + // if we load all target contacts the performance will suffer a lot for mass-activities. $query = " INSERT INTO {$activityContactTempTable} ( activity_id, contact_id, record_type_id, contact_name, is_deleted, counter ) SELECT ac.activity_id, @@ -828,7 +828,7 @@ ORDER BY fixed_sort_order $dao = CRM_Core_DAO::executeQuery($query); - //CRM-3553, need to check user has access to target groups. + // CRM-3553, need to check user has access to target groups. $mailingIDs = CRM_Mailing_BAO_Mailing::mailingACLIDs(); $accessCiviMail = ( (CRM_Core_Permission::check('access CiviMail')) || @@ -836,7 +836,7 @@ ORDER BY fixed_sort_order CRM_Core_Permission::check('create mailings')) ); - //get all campaigns. + // Get all campaigns. $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $values = array(); while ($dao->fetch()) { @@ -1012,7 +1012,7 @@ LEFT JOIN civicrm_case_activity ON ( civicrm_case_activity.activity_id = tbl.a $commonClauses[] = "civicrm_activity.status_id = 1"; } - //Filter on component IDs. + // Filter on component IDs. $components = self::activityComponents(); if (!empty($components)) { $componentsIn = implode(',', array_keys($components)); @@ -1316,7 +1316,7 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND $tokenSubject = CRM_Utils_Token::replaceContactTokens($subject, $values, FALSE, $subjectToken, FALSE, $escapeSmarty); $tokenSubject = CRM_Utils_Token::replaceHookTokens($tokenSubject, $values, $categories, FALSE, $escapeSmarty); - //CRM-4539 + // CRM-4539 if ($values['preferred_mail_format'] == 'Text' || $values['preferred_mail_format'] == 'Both') { $tokenText = CRM_Utils_Token::replaceContactTokens($text, $values, FALSE, $messageToken, FALSE, $escapeSmarty); $tokenText = CRM_Utils_Token::replaceHookTokens($tokenText, $values, $categories, FALSE, $escapeSmarty); @@ -1395,7 +1395,7 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND // get the tokens added in subject and message $messageToken = CRM_Utils_Token::getTokens($text); - //create the meta level record first ( sms activity ) + // Create the meta level record first ( sms activity ) $activityTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'SMS', 'name' @@ -1529,11 +1529,11 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND elseif ($toID) { $filters = array('is_deceased' => 0, 'is_deleted' => 0, 'do_not_sms' => 0); $toPhoneNumbers = CRM_Core_BAO_Phone::allPhones($toID, FALSE, 'Mobile', $filters); - //to get primary mobile ph,if not get a first mobile ph + // To get primary mobile phonenumber,if not get the first mobile phonenumber if (!empty($toPhoneNumbers)) { $toPhoneNumerDetails = reset($toPhoneNumbers); $toPhoneNumber = CRM_Utils_Array::value('phone', $toPhoneNumerDetails); - //contact allows to send sms + // Contact allows to send sms $toDoNotSms = 0; } } @@ -1623,8 +1623,6 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND } $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); - //$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); - //$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); // create the params array @@ -1850,7 +1848,7 @@ SELECT display_name $component = 'Event'; } elseif ($activity->__table == 'civicrm_contribution') { - //create activity record only for Completed Contributions + // create activity record only for Completed Contributions if ($activity->contribution_status_id != 1) { return NULL; } @@ -2083,7 +2081,7 @@ AND cl.modified_id = c.id $followupParams['subject'] = CRM_Utils_Array::value('followup_activity_subject', $params); $followupParams['assignee_contact_id'] = CRM_Utils_Array::value('followup_assignee_contact_id', $params); - //create target contact for followup + // Create target contact for followup. if (!empty($params['target_contact_id'])) { $followupParams['target_contact_id'] = $params['target_contact_id']; } @@ -2160,7 +2158,7 @@ AND cl.modified_id = c.id if (!isset(self::$_exportableFields[$name])) { self::$_exportableFields[$name] = array(); - // TO DO, ideally we should retrieve all fields from xml, in this case since activity processing is done + // TODO: ideally we should retrieve all fields from xml, in this case since activity processing is done // my case hence we have defined fields as case_* if ($name == 'Activity') { $exportableFields = CRM_Activity_DAO_Activity::export(); @@ -2185,7 +2183,7 @@ AND cl.modified_id = c.id $fields = array_merge($Activityfields, $exportableFields); } else { - //set title to activity fields + // Set title to activity fields. $fields = array( 'case_activity_subject' => array('title' => ts('Activity Subject'), 'type' => CRM_Utils_Type::T_STRING), 'case_source_contact_id' => array('title' => ts('Activity Reporter'), 'type' => CRM_Utils_Type::T_STRING), @@ -2327,7 +2325,7 @@ AND cl.modified_id = c.id return $allow; } - //component related permissions. + // Component related permissions. $compPermissions = array( 'CiviCase' => array( 'administer CiviCase', @@ -2344,9 +2342,9 @@ AND cl.modified_id = c.id 'CiviCampaign' => array('administer CiviCampaign'), ); - //return early when it is case activity. + // Return early when it is case activity. $isCaseActivity = CRM_Case_BAO_Case::isCaseActivity($activityId); - //check for civicase related permission. + // Check for civicase related permission. if ($isCaseActivity) { $allow = FALSE; foreach ($compPermissions['CiviCase'] as $per) { @@ -2356,7 +2354,7 @@ AND cl.modified_id = c.id } } - //check for case specific permissions. + // Check for case specific permissions. if ($allow) { $oper = 'view'; if ($action == CRM_Core_Action::UPDATE) { @@ -2371,7 +2369,7 @@ AND cl.modified_id = c.id return $allow; } - //first check the component permission. + // First check the component permission. $sql = " SELECT component_id FROM civicrm_option_value val @@ -2387,7 +2385,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n $componentName = CRM_Core_Component::getComponentName($componentId); $compPermission = CRM_Utils_Array::value($componentName, $compPermissions); - //here we are interesting in any single permission. + // Here we are interesting in any single permission. if (is_array($compPermission)) { foreach ($compPermission as $per) { if (CRM_Core_Permission::check($per)) { @@ -2398,7 +2396,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } } - //check for this permission related to contact. + // Check for this permission related to contact. $permission = CRM_Core_Permission::VIEW; if ($action == CRM_Core_Action::UPDATE) { $permission = CRM_Core_Permission::EDIT; @@ -2409,28 +2407,28 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); - //check for source contact. + // Check for source contact. if (!$componentId || $allow) { $sourceContactId = self::getActivityContact($activity->id, $sourceID); - //account for possibility of activity not having a source contact (as it may have been deleted) + // Account for possibility of activity not having a source contact (as it may have been deleted). if ($sourceContactId) { $allow = CRM_Contact_BAO_Contact_Permission::allow($sourceContactId, $permission); } } - //check for target and assignee contacts. + // Check for target and assignee contacts. if ($allow) { - //first check for supper permission. + // First check for supper permission. $supPermission = 'view all contacts'; if ($action == CRM_Core_Action::UPDATE) { $supPermission = 'edit all contacts'; } $allow = CRM_Core_Permission::check($supPermission); - //user might have sufficient permission, through acls. + // User might have sufficient permission, through acls. if (!$allow) { $allow = TRUE; - //get the target contacts. + // Get the target contacts. $targetContacts = CRM_Activity_BAO_ActivityContact::retrieveContactIdsByActivityId($activity->id, $targetID); foreach ($targetContacts as $cnt => $contactId) { if (!CRM_Contact_BAO_Contact_Permission::allow($contactId, $permission)) { @@ -2439,7 +2437,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } } - //get the assignee contacts. + // Get the assignee contacts. if ($allow) { $assigneeContacts = CRM_Activity_BAO_ActivityContact::retrieveContactIdsByActivityId($activity->id, $assigneeID); foreach ($assigneeContacts as $cnt => $contactId) { @@ -2465,26 +2463,26 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n * Associated array of contact activities */ public static function getContactActivitySelector(&$params) { - // format the params + // Format the params. $params['offset'] = ($params['page'] - 1) * $params['rp']; $params['rowCount'] = $params['rp']; $params['sort'] = CRM_Utils_Array::value('sortBy', $params); $params['caseId'] = NULL; $context = CRM_Utils_Array::value('context', $params); - // get contact activities + // Get contact activities. $activities = CRM_Activity_BAO_Activity::getActivities($params); - // add total + // Add total. $params['total'] = CRM_Activity_BAO_Activity::getActivitiesCount($params); - // format params and add links + // Format params and add links. $contactActivities = array(); if (!empty($activities)) { $activityStatus = CRM_Core_PseudoConstant::activityStatus(); - // check logged in user for permission + // Check logged in user for permission. $page = new CRM_Core_Page(); CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']); $permissions = array($page->_permission); @@ -2496,7 +2494,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n foreach ($activities as $activityId => $values) { $activity = array(); - // add class to this row if overdue + // Add class to this row if overdue. $activity['DT_RowClass'] = 'crm-entity'; if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $values)) && CRM_Utils_Array::value('status_id', $values) == 1 @@ -2727,7 +2725,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } /** - * Send activity as attachment + * Send activity as attachment. * * @param object $activity * @param array $mailToContacts diff --git a/CRM/Activity/BAO/ActivityContact.php b/CRM/Activity/BAO/ActivityContact.php index 9de897ad60..2fd873e38b 100644 --- a/CRM/Activity/BAO/ActivityContact.php +++ b/CRM/Activity/BAO/ActivityContact.php @@ -143,15 +143,13 @@ AND civicrm_contact.is_deleted = 0 * Should look a bit like * [local_col_name] => "related_tablename:related_col_name" * + * @see DB_DataObject::getLinks() + * @see DB_DataObject::getLink() * * @return array|null * array = if there are links defined for this table. * empty array - if there is a links.ini file, but no links on this table * null - if no links.ini exists for this database (hence try auto_links). - * @see DB_DataObject::getLinks(), DB_DataObject::getLink() - */ - /** - * @return array|null */ public function links() { $link = array('activity_id' => 'civicrm_activity:id'); diff --git a/CRM/Activity/BAO/ICalendar.php b/CRM/Activity/BAO/ICalendar.php index 14582daa7b..a6e4c40f68 100644 --- a/CRM/Activity/BAO/ICalendar.php +++ b/CRM/Activity/BAO/ICalendar.php @@ -111,7 +111,7 @@ class CRM_Activity_BAO_ICalendar { } /** - * TODO: Is there a better way to do this? + * @todo Is there a better way to do this? * @return string */ private function getPrimaryEmail() { diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index 9ca167066e..41cde09c5c 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -467,7 +467,7 @@ class CRM_Activity_BAO_Query { CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'activity_campaign_id'); - //add engagement level CRM-7775 + // Add engagement level CRM-7775. $buildEngagementLevel = FALSE; $buildSurveyResult = FALSE; if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index bbfaa1be11..943b40e90b 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -121,6 +121,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { /** * Explicitly declare the entity api name. + * + * @return string */ public function getDefaultEntity() { return 'Activity'; @@ -236,7 +238,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } $this->assign('contactId', $this->_currentlyViewedContactId); - //give the context. + // Give the context. if (!isset($this->_context)) { $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); if (CRM_Contact_Form_Search::isSearchContext($this->_context)) { @@ -260,9 +262,9 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - //CRM-6957 - //when we come from contact search, activity id never comes. - //so don't try to get from object, it might gives you wrong one. + // CRM-6957 + // When we come from contact search, activity id never comes. + // So don't try to get from object, it might gives you wrong one. // if we're not adding new one, there must be an id to // an activity we're trying to work on. @@ -277,7 +279,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->assign('activityId', $this->_activityId); - //check for required permissions, CRM-6264 + // Check for required permissions, CRM-6264. if ($this->_activityId && in_array($this->_action, array( CRM_Core_Action::UPDATE, @@ -300,7 +302,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ); } - //Assigning Activity type name + // Assigning Activity type name. if ($this->_activityTypeId) { $activityTName = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'label'); if ($activityTName[$this->_activityTypeId]) { @@ -309,14 +311,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - // Set title + // Set title. if (isset($activityTName)) { $activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName); $this->assign('pageTitle', ts('%1 Activity', array(1 => $activityName))); if ($this->_currentlyViewedContactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); - // Check if this is default domain contact CRM-10482 + // Check if this is default domain contact CRM-10482. if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) { $displayName .= ' (' . ts('default organization') . ')'; } @@ -327,8 +329,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - //check the mode when this form is called either single or as - //search task action + // Check the mode when this form is called either single or as + // search task action. if ($this->_activityTypeId || $this->_context == 'standalone' || $this->_currentlyViewedContactId @@ -337,7 +339,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->assign('urlPath', 'civicrm/activity'); } else { - //set the appropriate action + // Set the appropriate action. $url = CRM_Utils_System::currentPath(); $urlArray = explode('/', $url); $searchPath = array_pop($urlArray); @@ -376,14 +378,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->assign('action', $this->_action); if ($this->_action & CRM_Core_Action::VIEW) { - // get the tree of custom fields + // Get the tree of custom fields. $this->_groupTree = &CRM_Core_BAO_CustomGroup::getTree('Activity', $this, $this->_activityId, 0, $this->_activityTypeId ); } if ($this->_activityTypeId) { - //set activity type name and description to template + // Set activity type name and description to template. list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId); $this->assign('activityTypeName', $this->_activityTypeName); $this->assign('activityTypeDescription', $activityTypeDescription); @@ -396,7 +398,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); } - //validate the qfKey + // Validate the qfKey. if (!CRM_Utils_Rule::qfKey($qfKey)) { $qfKey = NULL; } @@ -463,9 +465,9 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { - // we need to set it in the session for the below code to work + // We need to set it in the session for the code below to work. // CRM-3014 - //need to assign custom data subtype to the template + // Need to assign custom data subtype to the template. $this->set('type', 'Activity'); $this->set('subType', $this->_activityTypeId); $this->set('entityId', $this->_activityId); @@ -511,6 +513,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { * Set default values for the form. * * For edit/view mode the default values are retrieved from the database. + * + * @return array */ public function setDefaultValues() { @@ -614,10 +618,10 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { return; } - //build other activity links + // Build other activity links. CRM_Activity_Form_ActivityLinks::commonBuildQuickForm($this); - //enable form element (ActivityLinks sets this true) + // Enable form element (ActivityLinks sets this true). $this->assign('suppressForm', FALSE); $element = &$this->add('select', 'activity_type_id', ts('Activity Type'), @@ -628,12 +632,12 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ) ); - //freeze for update mode. + // Freeze for update mode. if ($this->_action & CRM_Core_Action::UPDATE) { $element->freeze(); } - //Call to RecurringEntity buildQuickForm for add/update mode + // Call to RecurringEntity buildQuickForm for add/update mode. if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { CRM_Core_Form_RecurringEntity::buildQuickForm($this); } @@ -655,10 +659,10 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - //CRM-7362 --add campaigns. + // CRM-7362 --add campaigns. CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values)); - //add engagement level CRM-7775 + // Add engagement level CRM-7775 $buildEngagementLevel = FALSE; if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign() @@ -710,7 +714,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ); $this->addDateTime('activity_date_time', ts('Date'), TRUE, array('formatType' => 'activityDateTime')); - //add followup date + // Add followup date. $this->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime')); // Only admins and case-workers can change the activity source @@ -834,7 +838,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { if (!empty($fields['followup_activity_type_id']) && empty($fields['followup_date'])) { $errors['followup_date_time'] = ts('Followup date is a required field.'); } - //Activity type is mandatory if subject or follow-up date is specified for an Follow-up activity, CRM-4515 + // Activity type is mandatory if subject or follow-up date is specified for an Follow-up activity, CRM-4515. if ((!empty($fields['followup_activity_subject']) || !empty($fields['followup_date'])) && empty($fields['followup_activity_type_id'])) { $errors['followup_activity_subject'] = ts('Follow-up Activity type is a required field.'); } @@ -871,7 +875,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $params = $this->controller->exportValues($this->_name); } - //set activity type id + // Set activity type id. if (empty($params['activity_type_id'])) { $params['activity_type_id'] = $this->_activityTypeId; } @@ -1019,10 +1023,10 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - //save static tags + // Save static tags. CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $activity->id); - //save free tags + // Save free tags. if (isset($params['activity_taglist']) && !empty($params['activity_taglist'])) { CRM_Core_Form_Tag::postProcess($params['activity_taglist'], $activity->id, 'civicrm_activity', $this); } @@ -1062,7 +1066,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) { $mailToContacts = array(); - //build an associative array with unique email addresses. + // Build an associative array with unique email addresses. foreach ($activityAssigned as $id => $dnc) { if (isset($id) && array_key_exists($id, $assigneeContacts)) { $mailToContacts[$assigneeContacts[$id]['email']] = $assigneeContacts[$id]; diff --git a/CRM/Activity/Form/ActivityFilter.php b/CRM/Activity/Form/ActivityFilter.php index 3cdd386232..84c20e9207 100644 --- a/CRM/Activity/Form/ActivityFilter.php +++ b/CRM/Activity/Form/ActivityFilter.php @@ -54,18 +54,6 @@ class CRM_Activity_Form_ActivityFilter extends CRM_Core_Form { * @return array * reference to the array of default values */ - /** - * This virtual function is used to set the default values of - * various form elements - * - * access public - * - * @return array - * reference to the array of default values - */ - /** - * @return array - */ public function setDefaultValues() { // CRM-11761 retrieve user's activity filter preferences $defaults = array(); diff --git a/CRM/Activity/Form/ActivityView.php b/CRM/Activity/Form/ActivityView.php index 9f25fbecd0..1629429629 100644 --- a/CRM/Activity/Form/ActivityView.php +++ b/CRM/Activity/Form/ActivityView.php @@ -40,12 +40,12 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { * Set variables up before form is built. */ public function preProcess() { - //get the activity values + // Get the activity values. $activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this); $context = CRM_Utils_Request::retrieve('context', 'String', $this); $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this); - //check for required permissions, CRM-6264 + // Check for required permissions, CRM-6264. if ($activityId && !CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::VIEW) ) { @@ -70,7 +70,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { $params = array('id' => $activityId); CRM_Activity_BAO_Activity::retrieve($params, $defaults); - //set activity type name and description to template + // Set activity type name and description to template. list($activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($defaults['activity_type_id']); $this->assign('activityTypeName', $activityTypeName); @@ -96,7 +96,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { } } - //get the campaign + // Get the campaign. if ($campaignId = CRM_Utils_Array::value('campaign_id', $defaults)) { $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId); $values['campaign'] = $campaigns[$campaignId]; diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index deca0ec2af..ef238a8d23 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -326,7 +326,6 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { ); if ($signupType) { - //$this->_formValues['activity_type_id'] = array(); $this->_formValues['activity_role'] = 1; $this->_defaults['activity_role'] = 1; $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'); diff --git a/CRM/Activity/Form/Task.php b/CRM/Activity/Form/Task.php index 7a330856f4..f359020924 100644 --- a/CRM/Activity/Form/Task.php +++ b/CRM/Activity/Form/Task.php @@ -138,7 +138,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form { $form->_activityHolderIds = $form->_componentIds = $ids; - //set the context for redirection for any task actions + // Set the context for redirection for any task actions. $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { @@ -159,7 +159,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form { /** * Given the membership id, compute the contact id - * since its used for things like send email + * since it's used for things like send email. */ public function setContactIDs() { $IDs = implode(',', $this->_activityHolderIds); diff --git a/CRM/Activity/Form/Task/AddToTag.php b/CRM/Activity/Form/Task/AddToTag.php index f95ec55f91..d975cb4a06 100644 --- a/CRM/Activity/Form/Task/AddToTag.php +++ b/CRM/Activity/Form/Task/AddToTag.php @@ -92,7 +92,7 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task { * Process the form after the input has been submitted and validated. */ public function postProcess() { - //get the submitted values in an array + // Get the submitted values in an array. $params = $this->controller->exportValues($this->_name); $activityTags = $tagList = array(); diff --git a/CRM/Activity/Form/Task/Batch.php b/CRM/Activity/Form/Task/Batch.php index 85648c159a..9f56da6064 100755 --- a/CRM/Activity/Form/Task/Batch.php +++ b/CRM/Activity/Form/Task/Batch.php @@ -57,13 +57,11 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { * Build all the data structures needed to build the form. */ public function preProcess() { - /* - * initialize the task and row fields - */ + // Initialize the task and row fields. parent::preProcess(); - //get the contact read only fields to display. + // Get the contact read only fields to display. $readOnlyFields = array_merge(array('sort_name' => ts('Added By'), 'target_sort_name' => ts('With Contact')), CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options', @@ -71,7 +69,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { ) ); - //get the read only field data. + // Get the read only field data. $returnProperties = array_fill_keys(array_keys($readOnlyFields), 1); $contactDetails = CRM_Contact_BAO_Contact_Utils::contactDetails($this->_activityHolderIds, 'Activity', $returnProperties @@ -117,9 +115,9 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { unset($this->_fields[$name]); } - //fix to reduce size as we are using this field in grid + // Fix to reduce size as we are using this field in grid. if (is_array($field['attributes']) && !empty($this->_fields[$name]['attributes']['size']) && $this->_fields[$name]['attributes']['size'] > 19) { - //shrink class to "form-text-medium" + // Shrink class to "form-text-medium". $this->_fields[$name]['attributes']['size'] = 19; } } @@ -143,7 +141,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { $this->assign('componentIds', $this->_activityHolderIds); $fileFieldExists = FALSE; - //load all campaigns. + // Load all campaigns. if (array_key_exists('activity_campaign_id', $this->_fields)) { $this->_componentCampaigns = array(); CRM_Core_PseudoConstant::populate($this->_componentCampaigns, @@ -172,7 +170,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { } } else { - // handle non custom fields + // Handle non custom fields. CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $activityId); } } @@ -180,7 +178,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { $this->assign('fields', $this->_fields); - // don't set the status message when form is submitted. + // Don't set the status message when form is submitted. // $buttonName = $this->controller->getButtonName('submit'); if ($suppressFields) { diff --git a/CRM/Activity/Form/Task/Email.php b/CRM/Activity/Form/Task/Email.php index 6bf8116a6d..5565596156 100644 --- a/CRM/Activity/Form/Task/Email.php +++ b/CRM/Activity/Form/Task/Email.php @@ -70,7 +70,7 @@ class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task { * Build the form object. */ public function buildQuickForm() { - //enable form element + // Enable form element. $this->assign('emailTask', TRUE); CRM_Contact_Form_Task_EmailCommon::buildQuickForm($this); diff --git a/CRM/Activity/Form/Task/FileOnCase.php b/CRM/Activity/Form/Task/FileOnCase.php index 508bb29f1b..8667562b24 100644 --- a/CRM/Activity/Form/Task/FileOnCase.php +++ b/CRM/Activity/Form/Task/FileOnCase.php @@ -72,12 +72,6 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task { $this->addDefaultButtons(ts('Save')); } - /** - * Add local and global form rules. - */ - public function addRules() { - } - /** * Process the form after the input has been submitted and validated. */ diff --git a/CRM/Activity/Form/Task/PickOption.php b/CRM/Activity/Form/Task/PickOption.php index ac0aeb905c..1d3af3d06f 100644 --- a/CRM/Activity/Form/Task/PickOption.php +++ b/CRM/Activity/Form/Task/PickOption.php @@ -62,10 +62,8 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task { * Build all the data structures needed to build the form. */ public function preProcess() { - /* - * initialize the task and row fields - */ + // initialize the task and row fields. parent::preProcess(); $session = CRM_Core_Session::singleton(); $this->_userContext = $session->readUserContext(); @@ -136,21 +134,21 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task { $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); - //get assignee contacts + // Get assignee contacts. if (!empty($params['assigned_to'])) { foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityContact::getNames($id, $assigneeID)); $this->_contacts = array_merge($this->_contacts, $ids); } } - //get target contacts + // Get target contacts. if (!empty($params['with_contact'])) { foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityContact::getNames($id, $targetID)); $this->_contacts = array_merge($this->_contacts, $ids); } } - //get 'Added by' contacts + // Get 'Added by' contacts. if (!empty($params['created_by'])) { parent::setContactIDs(); if (!empty($this->_contactIds)) { @@ -159,7 +157,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task { } $this->_contacts = array_unique($this->_contacts); - //bounce to pick option if no contacts to send to + // Bounce to pick option if no contacts to send to. if (empty($this->_contacts)) { $urlParams = "_qf_PickOption_display=true&qfKey={$params['qfKey']}"; $urlRedirect = CRM_Utils_System::url('civicrm/activity/search', $urlParams); diff --git a/CRM/Activity/Form/Task/PickProfile.php b/CRM/Activity/Form/Task/PickProfile.php index 2cd3a5a0d3..ae2cbc55d6 100755 --- a/CRM/Activity/Form/Task/PickProfile.php +++ b/CRM/Activity/Form/Task/PickProfile.php @@ -57,10 +57,8 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task { * Build all the data structures needed to build the form. */ public function preProcess() { - /* - * initialize the task and row fields - */ + // Initialize the task and row fields. parent::preProcess(); $session = CRM_Core_Session::singleton(); $this->_userContext = $session->readUserContext(); @@ -68,7 +66,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task { CRM_Utils_System::setTitle(ts('Update multiple activities')); $validate = FALSE; - //validations + // Validations. if (count($this->_activityHolderIds) > $this->_maxActivities) { CRM_Core_Session::setStatus(ts("The maximum number of activities you can select for Update multiple activities is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array( 1 => $this->_maxActivities, @@ -77,7 +75,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task { $validate = TRUE; } - // than redirect + // Then redirect. if ($validate) { CRM_Utils_System::redirect($this->_userContext); } diff --git a/CRM/Activity/Form/Task/Print.php b/CRM/Activity/Form/Task/Print.php index a49fda5951..4ecf118db4 100644 --- a/CRM/Activity/Form/Task/Print.php +++ b/CRM/Activity/Form/Task/Print.php @@ -69,9 +69,8 @@ class CRM_Activity_Form_Task_Print extends CRM_Activity_Form_Task { * - displaying elements for saving the search */ public function buildQuickForm() { - // + // just need to add a javacript to popup the window for printing - // $this->addButtons(array( array( 'type' => 'next', @@ -87,11 +86,4 @@ class CRM_Activity_Form_Task_Print extends CRM_Activity_Form_Task { ); } - /** - * Process the form after the input has been submitted and validated. - */ - public function postProcess() { - // redirect to the main search page after printing is over - } - } diff --git a/CRM/Activity/Form/Task/SMS.php b/CRM/Activity/Form/Task/SMS.php index 0f12a429bc..0ca7a880d1 100644 --- a/CRM/Activity/Form/Task/SMS.php +++ b/CRM/Activity/Form/Task/SMS.php @@ -25,6 +25,11 @@ +--------------------------------------------------------------------+ */ +/** + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * This class provides the functionality to sms a group of contacts. */ @@ -58,7 +63,7 @@ class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task { * Build the form object. */ public function buildQuickForm() { - //enable form element + // Enable form element. $this->assign('SMSTask', TRUE); CRM_Contact_Form_Task_SMSCommon::buildQuickForm($this); } diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index e20f6eecb3..5545264c2c 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -55,7 +55,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { if ($skipColumnHeader) { $this->assign('skipColumnHeader', $skipColumnHeader); $this->assign('rowDisplayCount', 3); - /* if we had a column header to skip, stash it for later */ + // If we had a column header to skip, stash it for later. $this->_columnHeaders = $this->_dataValues[0]; } @@ -80,7 +80,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { * Build the form object. */ public function buildQuickForm() { - //to save the current mappings + // To save the current mappings. if (!$this->get('savedMapping')) { $saveDetailsName = ts('Save this field mapping'); $this->applyFilter('saveMappingName', 'trim'); @@ -89,11 +89,11 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { } else { $savedMapping = $this->get('savedMapping'); - //mapping is to be loaded from database + // Mapping is to be loaded from database. list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping); - //get loaded Mapping Fields + // Get loaded Mapping Fields. $mappingName = CRM_Utils_Array::value('1', $mappingName); $mappingContactType = CRM_Utils_Array::value('1', $mappingContactType); $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation); @@ -131,7 +131,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $dataPatterns = $this->get('dataPatterns'); $hasLocationTypes = $this->get('fieldTypes'); - /* Initialize all field usages to false */ + // Initialize all field usages to false. foreach ($mapperKeys as $key) { $this->_fieldUsed[$key] = FALSE; @@ -144,7 +144,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $js = "\n"; $this->assign('initHideBoxes', $js); - //set warning if mismatch in more than + // Set warning if mismatch in more than. if (isset($mappingName)) { if (($this->_columnCount != count($mappingName))) { $warning++; @@ -370,7 +368,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { */ public function postProcess() { $params = $this->controller->exportValues('MapField'); - //reload the mapfield if load mapping is pressed + // Reload the mapfield if load mapping is pressed. if (!empty($params['savedMapping'])) { $this->set('savedMapping', $params['savedMapping']); $this->controller->resetPage($this->_name); @@ -415,7 +413,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $this->set('loadMappingId', $params['mappingId']); } - //Updating Mapping Records + // Updating Mapping Records. if (!empty($params['updateMapping'])) { $mappingFields = new CRM_Core_DAO_MappingField(); @@ -440,7 +438,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { } } - //Saving Mapping Details and Records + // Saving Mapping Details and Records. if (!empty($params['saveMapping'])) { $mappingParams = array( 'name' => $params['saveMappingName'], diff --git a/CRM/Activity/Import/Form/Preview.php b/CRM/Activity/Import/Form/Preview.php index 2d0c18d5b7..6ab2a173a7 100644 --- a/CRM/Activity/Import/Form/Preview.php +++ b/CRM/Activity/Import/Form/Preview.php @@ -42,14 +42,14 @@ class CRM_Activity_Import_Form_Preview extends CRM_Import_Form_Preview { public function preProcess() { $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); - //get the data from the session + // Get the data from the session. $dataValues = $this->get('dataValues'); $mapper = $this->get('mapper'); $invalidRowCount = $this->get('invalidRowCount'); $conflictRowCount = $this->get('conflictRowCount'); $mismatchCount = $this->get('unMatchCount'); - //get the mapping name displayed if the mappingId is set + // Get the mapping name displayed if the mappingId is set. $mappingId = $this->get('loadMappingId'); if ($mappingId) { $mapDAO = new CRM_Core_DAO_Mapping(); diff --git a/CRM/Activity/Import/Form/Summary.php b/CRM/Activity/Import/Form/Summary.php index 6631141d18..646b191df4 100644 --- a/CRM/Activity/Import/Form/Summary.php +++ b/CRM/Activity/Import/Form/Summary.php @@ -75,13 +75,13 @@ class CRM_Activity_Import_Form_Summary extends CRM_Import_Form_Summary { $dupeActionString = ts('These records have been filled in with the imported data.'); } else { - /* Skip by default */ + // Skip by default. $dupeActionString = ts('These records have not been imported.'); $this->assign('dupeError', TRUE); - /* only subtract dupes from successful import if we're skipping */ + // Only subtract dupes from successful import if we're skipping. $this->set('validRowCount', $totalRowCount - $invalidRowCount - $conflictRowCount - $duplicateRowCount - $mismatchCount diff --git a/CRM/Activity/Import/Parser.php b/CRM/Activity/Import/Parser.php index 9dd3c1c0b2..92a37e811c 100644 --- a/CRM/Activity/Import/Parser.php +++ b/CRM/Activity/Import/Parser.php @@ -34,10 +34,6 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { protected $_fileName; - /**#@+ - * @var integer - */ - /** * Imported file size. */ @@ -128,7 +124,7 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { continue; } - /* trim whitespace around the values */ + // Trim whitespace around the values. $empty = TRUE; foreach ($values as $k => $v) { @@ -197,8 +193,8 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { if ($returnCode & self::DUPLICATE) { if ($returnCode & self::MULTIPLE_DUPE) { - /* TODO: multi-dupes should be counted apart from singles - * on non-skip action */ + // TODO: multi-dupes should be counted apart from singles + // on non-skip action. } $this->_duplicateCount++; $recordNumber = $this->_lineCount; @@ -268,7 +264,6 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { self::exportCSV($this->_duplicateFileName, $headers, $this->_duplicates); } } - //echo "$this->_totalCount,$this->_invalidRowCount,$this->_conflictCount,$this->_duplicateCount"; return $this->fini(); } @@ -371,7 +366,6 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { $store->set('duplicatesFileName', $this->_duplicateFileName); } } - //echo "$this->_totalCount,$this->_invalidRowCount,$this->_conflictCount,$this->_duplicateCount"; } /** diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index adbc2abb50..7bec9bf465 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -192,7 +192,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $errorMessage = NULL; - //for date-Formats + // For date-Formats $session = CRM_Core_Session::singleton(); $dateType = $session->get('dateTypes'); if (!isset($params['source_contact_id'])) { @@ -216,9 +216,9 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { CRM_Contact_Import_Parser_Contact::addToErrorMsg('Activity Engagement Index', $errorMessage); } } - //date-Format part ends + // Date-Format part ends. - //checking error in custom data + // Checking error in custom data. $params['contact_type'] = isset($this->_contactType) ? $this->_contactType : 'Activity'; CRM_Contact_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); @@ -245,7 +245,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { * the result of this processing */ public function import($onDuplicate, &$values) { - // first make sure this is a valid line + // First make sure this is a valid line $response = $this->summary($values); if ($response != CRM_Import_Parser::VALID) { @@ -256,7 +256,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { if ($activityLabel) { $params = array_merge($params, array('activity_label' => $values[$activityLabel])); } - //for date-Formats + // For date-Formats. $session = CRM_Core_Session::singleton(); $dateType = $session->get('dateTypes'); if (!isset($params['source_contact_id'])) { @@ -284,7 +284,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params['subject'] = $val; } } - //date-Format part ends + // Date-Format part ends. require_once 'CRM/Utils/DeprecatedUtils.php'; $formatError = _civicrm_api3_deprecated_activity_formatted_param($params, $params, TRUE); @@ -300,8 +300,8 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { if ($this->_contactIdIndex < 0) { - //retrieve contact id using contact dedupe rule. - //since we are support only individual's activity import. + // Retrieve contact id using contact dedupe rule. + // Since we are supporting only individual's activity import. $params['contact_type'] = 'Individual'; $params['version'] = 3; $error = _civicrm_api3_deprecated_duplicate_formatted_contact($params); @@ -393,10 +393,4 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { } } - /** - * The initializer code, called before the processing. - */ - public function fini() { - } - } diff --git a/CRM/Activity/Page/AJAX.php b/CRM/Activity/Page/AJAX.php index 298deb7507..502d1232d2 100644 --- a/CRM/Activity/Page/AJAX.php +++ b/CRM/Activity/Page/AJAX.php @@ -78,7 +78,7 @@ class CRM_Activity_Page_AJAX { $params = $_GET; - //CRM-14466 initialize variable to avoid php notice + // CRM-14466 initialize variable to avoid php notice. $sortSQL = ""; if ($sort && $sortOrder) { $sortSQL = $sort . ' ' . $sortOrder; @@ -331,12 +331,12 @@ class CRM_Activity_Page_AJAX { } $actDateTime = CRM_Utils_Date::isoToMysql($otherActivity->activity_date_time); - //create new activity record. + // Create new activity record. $mainActivity = new CRM_Activity_DAO_Activity(); $mainActVals = array(); CRM_Core_DAO::storeValues($otherActivity, $mainActVals); - //get new activity subject. + // Get new activity subject. if (!empty($params['newSubject'])) { $mainActVals['subject'] = $params['newSubject']; } @@ -344,9 +344,9 @@ class CRM_Activity_Page_AJAX { $mainActivity->copyValues($mainActVals); $mainActivity->id = NULL; $mainActivity->activity_date_time = $actDateTime; - //make sure this is current revision. + // Make sure this is current revision. $mainActivity->is_current_revision = TRUE; - //drop all relations. + // Drop all relations. $mainActivity->parent_id = $mainActivity->original_id = NULL; $mainActivity->save(); @@ -354,10 +354,8 @@ class CRM_Activity_Page_AJAX { CRM_Activity_BAO_Activity::logActivityAction($mainActivity); $mainActivity->free(); - /* Mark previous activity as deleted. If it was a non-case activity - * then just change the subject. - */ - + // Mark previous activity as deleted. If it was a non-case activity + // then just change the subject. if (in_array($params['mode'], array( 'move', 'file', @@ -421,7 +419,7 @@ class CRM_Activity_Page_AJAX { CRM_Activity_BAO_ActivityContact::create($assigneeParams); } - //attach newly created activity to case. + // Attach newly created activity to case. $caseActivity = new CRM_Case_DAO_CaseActivity(); $caseActivity->case_id = $params['caseID']; $caseActivity->activity_id = $mainActivityId; @@ -464,7 +462,7 @@ class CRM_Activity_Page_AJAX { $activities = CRM_Activity_BAO_Activity::getContactActivitySelector($params); foreach ($activities as $key => $value) { - //Check if recurring activity + // Check if recurring activity. if (!empty($value['is_recurring_activity'])) { $repeat = $value['is_recurring_activity']; $activities[$key]['activity_type'] .= '
' . ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1])) . ''; @@ -480,7 +478,9 @@ class CRM_Activity_Page_AJAX { 'activity_type_exclude_filter_id' => empty($params['activity_type_exclude_id']) ? '' : CRM_Utils_Type::escape($params['activity_type_exclude_id'], 'Integer'), ); - /** @var \Civi\Core\SettingsBag $cSettings */ + /** + * @var \Civi\Core\SettingsBag $cSettings + */ $cSettings = Civi::service('settings_manager')->getBagByContact(CRM_Core_Config::domainID(), $userID); $cSettings->set('activity_tab_filter', $activityFilter); } diff --git a/CRM/Activity/Page/Tab.php b/CRM/Activity/Page/Tab.php index 9d5dbbe918..77b218ddd3 100644 --- a/CRM/Activity/Page/Tab.php +++ b/CRM/Activity/Page/Tab.php @@ -118,7 +118,7 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page { public function preProcess() { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); - //FIX ME: need to fix this conflict + // FIXME: need to fix this conflict $this->assign('contactID', $this->_contactId); // check logged in url permission @@ -159,7 +159,7 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page { $action = CRM_Utils_Request::retrieve('action', 'String', $this); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); - //do check for view/edit operation. + // Do check for view/edit operation. if ($this->_id && in_array($action, array(CRM_Core_Action::UPDATE, CRM_Core_Action::VIEW)) ) { diff --git a/CRM/Activity/Selector/Activity.php b/CRM/Activity/Selector/Activity.php index dbac346b6e..1813a2a635 100644 --- a/CRM/Activity/Selector/Activity.php +++ b/CRM/Activity/Selector/Activity.php @@ -130,9 +130,9 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C } $activityTypeName = CRM_Utils_Array::value($activityTypeId, $activeActTypes); - //CRM-7607 - //lets allow to have normal operation for only activity types. - //when activity type is disabled or no more exists give only delete. + // CRM-7607 + // Lets allow to have normal operation for only activity types. + // When activity type is disabled or no more exists give only delete. switch ($activityTypeName) { case 'Event Registration': case 'Change Registration': @@ -199,7 +199,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}"; $qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}"; - //when type is not available lets hide view and update. + // When type is not available lets hide view and update. if (empty($activityTypeName)) { $showView = $showUpdate = FALSE; } @@ -396,7 +396,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C $engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel(); - //CRM-4418 + // CRM-4418 $permissions = array($this->_permission); if (CRM_Core_Permission::check('delete activities')) { $permissions[] = CRM_Core_Permission::DELETE; @@ -449,7 +449,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C $row['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel); } - //CRM-3553 + // CRM-3553 $accessMailingReport = FALSE; if (!empty($row['mailingId'])) { $accessMailingReport = TRUE; diff --git a/CRM/Activity/Selector/Search.php b/CRM/Activity/Selector/Search.php index e2bbf895a8..c17e5f2bdc 100644 --- a/CRM/Activity/Selector/Search.php +++ b/CRM/Activity/Selector/Search.php @@ -262,7 +262,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM $mailingIDs = CRM_Mailing_BAO_Mailing::mailingACLIDs(); $accessCiviMail = CRM_Core_Permission::check('access CiviMail'); - //get all campaigns. + // Get all campaigns. $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel(); @@ -270,13 +270,13 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); - //get all activity types + // Get all activity types $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name', TRUE); while ($result->fetch()) { $row = array(); - // ignore rows where we dont have an activity id + // Ignore rows where we dont have an activity id. if (empty($result->activity_id)) { continue; } @@ -345,7 +345,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM $result->activity_id ); - //carry campaign to selector. + // Carry campaign to selector. $row['campaign'] = CRM_Utils_Array::value($result->activity_campaign_id, $allCampaigns); $row['campaign_id'] = $result->activity_campaign_id; @@ -355,7 +355,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM ); } - //Check if recurring activity + // Check if recurring activity. $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['activity_id'], 'civicrm_activity'); $row['repeat'] = ''; if ($repeat) { diff --git a/CRM/Activity/Task.php b/CRM/Activity/Task.php index 48f99a52b5..02e6f5d4fe 100644 --- a/CRM/Activity/Task.php +++ b/CRM/Activity/Task.php @@ -26,7 +26,6 @@ */ /** - * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 */ @@ -58,8 +57,8 @@ class CRM_Activity_Task { static $_optionalTasks = NULL; /** - * These tasks are the core set of tasks that the user can perform. - * on a contact / group of contacts + * These tasks are the core set of tasks that the user can perform + * on a contact / group of contacts. * * @return array * the set of tasks for a group of contacts @@ -131,7 +130,7 @@ class CRM_Activity_Task { } } - //CRM-4418, check for delete + // CRM-4418, check for delete if (!CRM_Core_Permission::check('delete activities')) { unset(self::$_tasks[1]); } @@ -142,8 +141,7 @@ class CRM_Activity_Task { } /** - * These tasks are the core set of task titles. - * on activity + * These tasks are the core set of task titles on activity. * * @return array * the set of task titles @@ -158,8 +156,7 @@ class CRM_Activity_Task { } /** - * Show tasks selectively based on the permission level. - * of the user + * Show tasks selectively based on the permission level of the user. * * @param int $permission * @@ -185,8 +182,7 @@ class CRM_Activity_Task { } /** - * These tasks are the core set of tasks that the user can perform. - * on activity + * These tasks are the core set of tasks that the user can perform on activity. * * @param int $value * diff --git a/CRM/Activity/Tokens.php b/CRM/Activity/Tokens.php index 6fabf0b717..f925223529 100644 --- a/CRM/Activity/Tokens.php +++ b/CRM/Activity/Tokens.php @@ -26,6 +26,11 @@ +--------------------------------------------------------------------+ */ +/** + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2015 + */ + /** * Class CRM_Member_Tokens * @@ -62,9 +67,9 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber { return; } - // The join expression for activities needs some extra nuance to handle - // multiple revisions of the activity. Q: Could we simplify & move the - // extra AND clauses into `where(...)`? + // The joint expression for activities needs some extra nuance to handle. + // Multiple revisions of the activity. + // Q: Could we simplify & move the extra AND clauses into `where(...)`? $e->query->param('casEntityJoinExpr', 'e.id = reminder.entity_id AND e.is_current_revision = 1 AND e.is_deleted = 0'); $e->query->select('e.*'); // FIXME: seems too broad. -- 2.25.1