function _get_column_select($layout_def) { global $sugar_config; // if $this->db->dbytpe is empty, then grab dbtype value from global array "$sugar_config[dbconfig]" if (empty($this->db->dbType)) { $this->db->dbType = $sugar_config['dbconfig']['db_type']; } $field_def = $this->reporter->all_fields[$layout_def['column_key']]; if (empty($field_def['fields']) || empty($field_def['fields'][0]) || empty($field_def['fields'][1])) { return parent::_get_column_select($layout_def); } // 'fields' are the two fields to concat to create the name $alias = ''; $endalias = ''; if (!empty($layout_def['table_alias'])) { if ($this->db->dbType == 'mysql') { $alias .= "CONCAT(CONCAT(IFNULL(" . $layout_def['table_alias'] . "." . $field_def['fields'][0] . ",''),' ')," . $layout_def['table_alias'] . "." . $field_def['fields'][1] . ")"; } elseif ($this->db->dbType == 'mssql') { $alias .= $layout_def['table_alias'] . '.' . $field_def['fields'][0] . " + ' ' + " . $layout_def['table_alias'] . '.' . $field_def['fields'][1] . ""; } } elseif (!empty($layout_def['name'])) { $alias = $layout_def['name']; } else { $alias .= "*"; } $alias .= $endalias; return $alias; }
/** * Gets the lowercase version of the name of the field for use in queries * * @param array $def * @return string */ protected function getLowercaseColumnSelect($def) { // Copied to ensure that references don't get clobbered after this point $hold = $def; $hold['name'] .= '_lower'; return parent::_get_column_select($hold); }
function queryFilterEmpty(&$layout_def) { if ($this->reporter->db->dbType == 'mysql') { return parent::queryFilterEmpty($layout_def); } elseif ($this->reporter->db->dbType == 'mssql') { return '( ' . $this->_get_column_select($layout_def) . ' IS NULL OR DATALENGTH(' . $this->_get_column_select($layout_def) . ") = 0)\n"; } }
function SugarWidgetFieldText(&$layout_manager) { parent::SugarWidgetFieldVarchar($layout_manager); }
function _get_column_select($layout_def) { global $locale, $current_user; if (isset($this->reporter->all_fields)) { $field_def = $this->reporter->all_fields[$layout_def['column_key']]; } else { $field_def = array(); } // 'fields' are the two fields to concatenate to create the name if (!isset($field_def['fields'])) { return $this->_get_normal_column_select($layout_def); } $localeNameFormat = $locale->getLocaleFormatMacro($current_user); $localeNameFormat = trim(preg_replace('/s/i', '', $localeNameFormat)); if (empty($field_def['fields']) || empty($field_def['fields'][0]) || empty($field_def['fields'][1])) { return parent::_get_column_select($layout_def); } if (!empty($layout_def['table_alias'])) { $comps = preg_split("/([fl])/", $localeNameFormat, null, PREG_SPLIT_DELIM_CAPTURE); $name = array(); foreach ($comps as $val) { if ($val == 'f') { $name[] = $this->reporter->db->convert($layout_def['table_alias'] . "." . $field_def['fields'][0], 'IFNULL', array("''")); } elseif ($val == 'l') { $name[] = $this->reporter->db->convert($layout_def['table_alias'] . "." . $field_def['fields'][1], 'IFNULL', array("''")); } else { if (!empty($val)) { $name[] = $this->reporter->db->quoted($val); } } } $alias = $this->reporter->db->convert($name, "CONCAT"); } elseif (!empty($layout_def['name'])) { $alias = $layout_def['name']; } else { $alias = "*"; } return $alias; }
function displayList($layout_def) { return nl2br(parent::displayListPlain($layout_def)); }
public function __construct($layout_manager) { parent::__construct($layout_manager); }
function _get_column_select($layout_def) { global $sugar_config; global $locale, $current_user; // if $this->db->dbytpe is empty, then grab dbtype value from global array "$sugar_config[dbconfig]" if (empty($this->db->dbType)) { $this->db->dbType = $sugar_config['dbconfig']['db_type']; } if (isset($this->reporter->all_fields)) { $field_def = $this->reporter->all_fields[$layout_def['column_key']]; } else { $field_def = array(); } // 'fields' are the two fields to concat to create the name $alias = ''; $endalias = ''; if (!isset($field_def['fields'])) { $alias = $this->_get_normal_column_select($layout_def); return $alias; } $localeNameFormat = $locale->getLocaleFormatMacro($current_user); $localeNameFormat = trim(preg_replace('/s/i', '', $localeNameFormat)); $names = array(); $names['f'] = db_convert($layout_def['table_alias'] . '.' . $field_def['fields'][0] . ",''", "IFNULL"); $names['l'] = $layout_def['table_alias'] . '.' . $field_def['fields'][1]; if (empty($field_def['fields']) || empty($field_def['fields'][0]) || empty($field_def['fields'][1])) { return parent::_get_column_select($layout_def); } if (!empty($layout_def['table_alias'])) { if ($this->db->dbType == 'mysql') { for ($i = 0; $i < strlen($localeNameFormat); $i++) { $alias .= array_key_exists($localeNameFormat[$i], $names) ? $names[$localeNameFormat[$i]] : '\'' . $localeNameFormat[$i] . '\''; if ($i < strlen($localeNameFormat) - 1) { $alias .= ','; } } if (strlen($localeNameFormat) > 1) { $alias = 'concat(' . $alias . ')'; } } elseif ($this->db->dbType == 'mssql') { for ($i = 0; $i < strlen($localeNameFormat); $i++) { $alias .= array_key_exists($localeNameFormat[$i], $names) ? $names[$localeNameFormat[$i]] : '\'' . $localeNameFormat[$i] . '\''; if ($i < strlen($localeNameFormat) - 1) { $alias .= ' + '; } } } } elseif (!empty($layout_def['name'])) { $alias = $layout_def['name']; } else { $alias .= "*"; } $alias .= $endalias; return $alias; }
public function SugarWidgetFieldCronSchedule($layout_manager) { parent::SugarWidgetFieldText($layout_manager); }