/** * This should be called when the bean is saved. The bean itself will be passed by reference * * @param SugarBean bean - the bean performing the save * @param array params - an array of paramester relevant to the save, most likely will be $_REQUEST */ public function save($bean, $params, $field, $properties, $prefix = '') { parent::save($bean, $params, $field, $properties, $prefix); if (isset($params[$prefix . $field])) { $bean->{$field} = $params[$prefix . $field]; } }
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $displayParams['nl2br'] = true; $displayParams['htmlescape'] = true; $displayParams['url2html'] = true; return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); }
function getWirelessEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $displayParams['nl2br'] = true; $displayParams['url2html'] = true; $vardef['usertheme'] = $_GET['usertheme']; return parent::getWirelessEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); }
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { // Create Smarty variables for the Calendar picker widget if (!isset($displayParams['showMinutesDropdown'])) { $displayParams['showMinutesDropdown'] = false; } if (!isset($displayParams['showHoursDropdown'])) { $displayParams['showHoursDropdown'] = false; } if (!isset($displayParams['showNoneCheckbox'])) { $displayParams['showNoneCheckbox'] = false; } if (!isset($displayParams['showFormats'])) { $displayParams['showFormats'] = false; } if (!isset($displayParams['hiddeCalendar'])) { $displayParams['hiddeCalendar'] = false; } // jpereira@dri - #Bug49552 - Datetime field unable to follow parent class methods //jchi , bug #24557 , 10/31/2008 if (isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')) { return $this->getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } //end return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); // ~ jpereira@dri - #Bug49552 - Datetime field unable to follow parent class methods }
public function getNormalizedDefs($vardef, $defs) { $vardef = parent::getNormalizedDefs($vardef, $defs); if (!empty($defs['name_format_map'])) { $vardef['fields'] = array_unique(array_values($defs['name_format_map'])); } return $vardef; }
function displayFromFunc($displayType, $parentFieldArray, $vardef, $displayParams, $tabindex) { if (isset($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') { return parent::displayFromFunc($displayType, $parentFieldArray, $vardef, $displayParams, $tabindex); } $displayTypeFunc = 'get' . $displayType . 'Smarty'; return $this->{$displayTypeFunc}($parentFieldArray, $vardef, $displayParams, $tabindex); }
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { if (empty($displayParams['size'])) { $displayParams['size'] = 6; } if (isset($vardef['function']) && !empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') { $this->setup($parentFieldArray, $vardef, $displayParams); return $this->fetch('include/SugarFields/Fields/Enum/EditViewFunction.tpl'); } else { return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } }
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $this->fillInOptions($vardef, $displayParams); $keys = $this->getAccessKey($vardef, 'FILE', $vardef['module']); $displayParams['accessKeySelect'] = $keys['accessKeySelect']; $displayParams['accessKeySelectLabel'] = $keys['accessKeySelectLabel']; $displayParams['accessKeySelectTitle'] = $keys['accessKeySelectTitle']; $displayParams['accessKeyClear'] = $keys['accessKeyClear']; $displayParams['accessKeyClearLabel'] = $keys['accessKeyClearLabel']; $displayParams['accessKeyClearTitle'] = $keys['accessKeyClearTitle']; return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); }
/** * {@inheritDoc} */ public function apiFormatField(array &$data, SugarBean $bean, array $args, $fieldName, $properties, array $fieldList = null, ServiceBase $service = null) { $this->ensureApiFormatFieldArguments($fieldList, $service); // this is only for generated links if (isset($bean->field_defs[$fieldName]['gen']) && isTruthy($bean->field_defs[$fieldName]['gen'])) { $subject = $bean->field_defs[$fieldName]['default']; if (!empty($subject)) { $data[$fieldName] = replace_sugar_vars($subject, $bean->toArray(), true); } else { $data[$fieldName] = ""; } } else { parent::apiFormatField($data, $bean, $args, $fieldName, $properties, $fieldList, $service); } }
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { global $mod_strings; $this->ss->assign('textocheck', $mod_strings['LBL_AUTOGEN']); $this->ss->assign('textocambio', $mod_strings['LBL_CHANGE_BUTTON']); // Mark checked if Number field is empty /* echo "<pre>"; print_r($vardef); echo "</pre>"; */ if (!$vardef['value'] || $vardef['value'] == "") { $this->ss->assign('checked', 'CHECKED'); } return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); }
function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass = true) { parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass); $editor = ""; if ($vardef['editor'] == "html") { if (!isset($displayParams['htmlescape'])) { $displayParams['htmlescape'] = false; } if ($_REQUEST['action'] == "EditView") { require_once "include/SugarTinyMCE.php"; $tiny = new SugarTinyMCE(); $editor = $tiny->getInstance($vardef['name'], 'email_compose_light'); } $this->ss->assign("tinymce", $editor); } else { $this->ss->assign("tinymce", $editor); } }
function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass = true) { global $app_list_strings, $app_strings; parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass); $this->ss->assign('APP', $app_strings); $this->ss->assign('types', get_select_options_with_id($app_list_strings['aor_scheduled_report_schedule_types'], '')); $weekdays = $this->getWeekDays(); $this->ss->assign('weekday_vals', json_encode($weekdays)); $this->ss->assign('weekdays', get_select_options($weekdays, '')); $days = $this->getDays(); $this->ss->assign('days', get_select_options($days, '')); function padNumbers($x) { return str_pad($x, 2, '0', STR_PAD_LEFT); } $minutes = array_map('padNumbers', range(0, 59)); $hours = array_map('padNumbers', range(0, 23)); $this->ss->assign('minutes', get_select_options($minutes, '')); $this->ss->assign('hours', get_select_options($hours, '')); }
/** * getSearchWhereValue * * Checks and returns a sane value based on the field type that can be used when building the where clause in a * search form. * * @param $value Mixed value being searched on * @return Int the value for the where clause used in search */ function getSearchWhereValue($value) { $newVal = parent::getSearchWhereValue($value); if (!is_numeric($newVal)) { if (strpos($newVal, ',') > 0) { $multiVals = explode(',', $newVal); $newVal = ''; foreach ($multiVals as $key => $val) { if (!empty($newVal)) { $newVal .= ','; } if (!empty($val) && !is_numeric($val)) { $newVal .= -1; } else { $newVal .= $val; } } return $newVal; } else { return -1; } } return $newVal; }
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $this->fillInOptions($vardef, $displayParams); return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); }
/** * {@inheritDoc} */ public function apiFormatField(array &$data, SugarBean $bean, array $args, $fieldName, $properties, array $fieldList = null, ServiceBase $service = null) { // Handle the parent so our current data element is set parent::apiFormatField($data, $bean, $args, $fieldName, $properties, $fieldList, $service); // Get fields related to this field but only if the current field is empty // If the current field is empty, set it to the related field(s) until it // isn't empty. This happens in the case of upload file fields in File // type SugarObject based custom modules. In most cases the fields array // will either be empty or one entry long. if (empty($data[$fieldName]) && isset($properties['fields'])) { foreach ($properties['fields'] as $field) { if (empty($data[$field])) { $data[$field] = empty($bean->{$field}) ? '' : $bean->{$field}; } $data[$fieldName] = $data[$field]; break; } } // Add in file_mime_type if (empty($data['file_mime_type'])) { $data['file_mime_type'] = empty($bean->file_mime_type) ? '' : $bean->file_mime_type; } }
/** * This should be called when the bean is saved. The bean itself will be passed by reference * * @param SugarBean bean - the bean performing the save * @param array params - an array of paramester relevant to the save, most likely will be $_REQUEST */ public function save($bean, $params, $field, $properties, $prefix = '') { parent::save($bean, $params, $field, $properties, $prefix); }
/** * For Relate fields we should not be sending the len vardef back * @param array $vardef * @return array of $vardef */ public function getNormalizedDefs($vardef, $defs) { unset($vardef['len']); return parent::getNormalizedDefs($vardef, $defs); }
function __construct($type) { parent::SugarFieldBase($type); }
/** * @see SugarFieldBase::getEditViewSmarty() */ public function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { if (!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') { return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex); } $call_back_function = 'set_return'; if (isset($displayParams['call_back_function'])) { $call_back_function = $displayParams['call_back_function']; } $form_name = 'EditView'; if (isset($displayParams['formName'])) { $form_name = $displayParams['formName']; } if (isset($displayParams['idName'])) { $rpos = strrpos($displayParams['idName'], $vardef['name']); $displayParams['idNameHidden'] = substr($displayParams['idName'], 0, $rpos); } //Special Case for accounts; use the displayParams array and retrieve //the key and copy indexes. 'key' is the suffix of the field we are searching //the Account's address with. 'copy' is the suffix we are copying the addresses //form fields into. if (isset($vardef['module']) && preg_match('/Accounts/si', $vardef['module']) && isset($displayParams['key']) && isset($displayParams['copy'])) { if (isset($displayParams['key']) && is_array($displayParams['key'])) { $database_key = $displayParams['key']; } else { $database_key[] = $displayParams['key']; } if (isset($displayParams['copy']) && is_array($displayParams['copy'])) { $form = $displayParams['copy']; } else { $form[] = $displayParams['copy']; } if (count($database_key) != count($form)) { global $app_list_strings; $this->ss->trigger_error($app_list_strings['ERR_SMARTY_UNEQUAL_RELATED_FIELD_PARAMETERS']); } //if $copy_phone = isset($displayParams['copyPhone']) ? $displayParams['copyPhone'] : true; $field_to_name = array(); $field_to_name['id'] = $vardef['id_name']; $field_to_name['name'] = $vardef['name']; $address_fields = array('_address_street', '_address_city', '_address_state', '_address_postalcode', '_address_country'); $count = 0; foreach ($form as $f) { foreach ($address_fields as $afield) { $field_to_name[$database_key[$count] . $afield] = $f . $afield; } $count++; } $popup_request_data = array('call_back_function' => $call_back_function, 'form_name' => $form_name, 'field_to_name_array' => $field_to_name); if ($copy_phone) { $popup_request_data['field_to_name_array']['phone_office'] = 'phone_work'; } } elseif (isset($displayParams['field_to_name_array'])) { $popup_request_data = array('call_back_function' => $call_back_function, 'form_name' => $form_name, 'field_to_name_array' => $displayParams['field_to_name_array']); } else { $popup_request_data = array('call_back_function' => $call_back_function, 'form_name' => $form_name, 'field_to_name_array' => array('id' => empty($displayParams['idNameHidden']) ? $vardef['id_name'] : $displayParams['idNameHidden'] . $vardef['id_name'], empty($vardef['rname']) ? 'name' : $vardef['rname'] => empty($displayParams['idName']) ? $vardef['name'] : $displayParams['idName'])); } $json = getJSONobj(); $displayParams['popupData'] = '{literal}' . $json->encode($popup_request_data) . '{/literal}'; if (!isset($displayParams['readOnly'])) { $displayParams['readOnly'] = ''; } else { $displayParams['readOnly'] = $displayParams['readOnly'] == false ? '' : 'READONLY'; } $keys = $this->getAccessKey($vardef, 'RELATE', $vardef['module']); $displayParams['accessKeySelect'] = $keys['accessKeySelect']; $displayParams['accessKeySelectLabel'] = $keys['accessKeySelectLabel']; $displayParams['accessKeySelectTitle'] = $keys['accessKeySelectTitle']; $displayParams['accessKeyClear'] = $keys['accessKeyClear']; $displayParams['accessKeyClearLabel'] = $keys['accessKeyClearLabel']; $displayParams['accessKeyClearTitle'] = $keys['accessKeyClearTitle']; $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); return $this->fetch($this->findTemplate('EditView')); }
public function save(&$bean, $params, $field, $properties, $prefix = '') { $GLOBALS['log']->debug("SugarFieldPresentationfield::save() function called."); parent::save($bean, $params, $field, $properties, $prefix); }