/**
* Get the metadata for fields to be included on the activity search form.
*
+ * @throws \CiviCRM_API3_Exception
* @todo ideally this would be a trait included on the activity search & advanced search
* rather than a static function.
*/
public static function getSearchFieldMetadata() {
- $fields = ['activity_type_id', 'activity_date_time', 'priority_id', 'activity_location'];
+ $fields = ['activity_type_id', 'activity_date_time', 'priority_id', 'activity_location', 'activity_status_id'];
$metadata = civicrm_api3('Activity', 'getfields', [])['values'];
$metadata = array_intersect_key($metadata, array_flip($fields));
$metadata['activity_text'] = [
* Add all the elements shared between case activity search and advanced search.
*
* @param CRM_Core_Form_Search $form
+ *
+ * @throws \CiviCRM_API3_Exception
+ * @throws \CRM_Core_Exception
*/
public static function buildSearchForm(&$form) {
$form->addSearchFieldMetadata(['Activity' => self::getSearchFieldMetadata()]);
'flip' => 1,
'labelColumn' => 'name',
]);
- $form->addSelect('status_id',
- [
- 'entity' => 'activity',
- 'multiple' => 'multiple',
- 'option_url' => NULL,
- 'placeholder' => ts('- any -'),
- ]
- );
$ssID = $form->get('ssID');
$status = [$activityStatus['Completed'], $activityStatus['Scheduled']];
//If status is saved in smart group.
if (!empty($ssID) && !empty($form->_formValues['activity_status_id'])) {
$status = $form->_formValues['activity_status_id'];
}
- $form->setDefaults(['status_id' => $status]);
+ $form->setDefaults(['activity_status_id' => $status]);
$form->addElement('text', 'activity_text', ts('Activity Text'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
'participant_status_id',
'contribution_trxn_id',
'activity_type_id',
- 'status_id',
'priority_id',
'contribution_product_id',
'payment_instrument_id',
'preferred_communication_method',
];
$changeNames = [
- 'status_id' => 'activity_status_id',
'priority_id' => 'activity_priority_id',
];
CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, $specialParams, $changeNames);
* Class constructor.
*
* @param array $formValues
+ *
+ * @throws \CRM_Core_Exception
*/
public function __construct(&$formValues) {
$this->_formValues = self::formatSavedSearchFields($formValues);
* @param bool $justIDs
*
* @return string
+ * @throws \CRM_Core_Exception
*/
public function all(
$offset = 0, $rowcount = 0, $sort = NULL,
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Activity');
foreach ($groupTree as $key) {
- if (!empty($key['extends']) && $key['extends'] == 'Activity') {
+ if (!empty($key['extends']) && $key['extends'] === 'Activity') {
$select .= ", " . $key['table_name'] . ".*";
$from .= " LEFT JOIN " . $key['table_name'] . " ON " . $key['table_name'] . ".entity_id = activity.id";
}
/**
* @inheritDoc
+ *
+ * @throws \CRM_Core_Exception
*/
public function count() {
$sql = $this->all();