function getMeetingsExternalApiDropDown($focus = null, $name = null, $value = null, $view = null) { global $dictionary, $app_list_strings; $cacheKeyName = 'meetings_type_drop_down'; $apiList = sugar_cache_retrieve($cacheKeyName); if ($apiList === null) { require_once 'include/externalAPI/ExternalAPIFactory.php'; $apiList = ExternalAPIFactory::getModuleDropDown('Meetings'); $apiList = array_merge(array('Sugar' => $GLOBALS['app_list_strings']['eapm_list']['Sugar']), $apiList); sugar_cache_put($cacheKeyName, $apiList); } if (!empty($value) && empty($apiList[$value])) { $apiList[$value] = $value; } //bug 46294: adding list of options to dropdown list (if it is not the default list) if ($dictionary['Meeting']['fields']['type']['options'] != "eapm_list") { $apiList = array_merge(getMeetingTypeOptions($dictionary, $app_list_strings), $apiList); } return $apiList; }
public function testgetMeetingTypeOptions() { global $dictionary, $app_list_strings; $result = getMeetingTypeOptions($dictionary, $app_list_strings); $this->assertTrue(is_array($result)); }
/** * @dataProvider provider */ public function testGetMeetingTypeOptions($dictionary, $appList, $isEmpty) { $result = getMeetingTypeOptions($dictionary, $appList, $isEmpty); $this->assertEquals($isEmpty, empty($result)); }
function getMeetingsExternalApiDropDown($focus = null, $name = null, $value = null, $view = null) { global $dictionary, $app_list_strings; $cacheKeyName = 'meetings_type_drop_down'; $apiList = sugar_cache_retrieve($cacheKeyName); if ($apiList === null) { require_once 'include/externalAPI/ExternalAPIFactory.php'; $apiList = ExternalAPIFactory::getModuleDropDown('Meetings'); $apiList = array_merge(array('Sugar' => $app_list_strings['eapm_list']['Sugar']), $apiList); sugar_cache_put($cacheKeyName, $apiList); } if (!empty($value) && empty($apiList[$value])) { $apiList[$value] = $value; } // if options list name is defined in vardef and is a different list than eapm_list then use that list $typeField = $dictionary['Meeting']['fields']['type']; if (isset($typeField['options']) && $typeField['options'] != "eapm_list") { $apiList = array_merge(getMeetingTypeOptions($dictionary, $app_list_strings), $apiList); } return $apiList; }