'defaultPagerSize' => (int) \Civi::settings()->get('default_pager_size'),
'defaultDisplay' => SearchDisplay::getDefault(FALSE)->setSavedSearch(['id' => NULL])->execute()->first(),
'modules' => \CRM_Core_BAO_Managed::getBaseModules(),
- 'defaultContactType' => \CRM_Contact_BAO_ContactType::basicTypeInfo()['Individual']['name'] ?? NULL,
'defaultDistanceUnit' => \CRM_Utils_Address::getDefaultDistanceUnit(),
'jobFrequency' => \Civi\Api4\Job::getFields()
->addWhere('name', '=', 'run_frequency')
->addSelect('id', 'label', 'color', 'is_selectable', 'description')
->addWhere('used_for', 'CONTAINS', 'civicrm_saved_search')
->execute(),
+ 'myName' => \CRM_Core_Session::singleton()->getLoggedInContactDisplayName(),
];
$perms = \Civi\Api4\Permission::get()
->addWhere('group', 'IN', ['civicrm', 'cms'])
// Changing entity will refresh the angular page
$scope.$watch('$ctrl.savedSearch.api_entity', function(newEntity, oldEntity) {
if (newEntity && oldEntity && newEntity !== oldEntity) {
- $location.url('/create/' + newEntity + (ctrl.savedSearch.label ? '?label=' + ctrl.savedSearch.label : ''));
+ $location.url('/create/' + newEntity + ($routeParams.label ? '?label=' + $routeParams.label : ''));
}
});
})
defaults[param] = [];
}
});
- // Default to Individuals
- if (this.savedSearch.api_entity === 'Contact' && CRM.crmSearchAdmin.defaultContactType) {
- defaults.where.push(['contact_type:name', '=', CRM.crmSearchAdmin.defaultContactType]);
- }
$scope.$bindToRoute({
param: 'params',
default: defaults
});
+ // Set default label
+ ctrl.savedSearch.label = ts('%1 Search by %2', {
+ 1: searchMeta.getEntity(ctrl.savedSearch.api_entity).title,
+ 2: CRM.crmSearchAdmin.myName
+ });
$scope.$bindToRoute({
param: 'label',
expr: '$ctrl.savedSearch.label',
format: 'raw',
- default: ''
+ default: ctrl.savedSearch.label
});
}