@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | $content = $this->displayListPlain($layout_def); |
| 57 | - return $content; |
|
| 57 | + return $content; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | function queryFilterBefore($layout_def) |
@@ -88,26 +88,26 @@ discard block |
||
| 88 | 88 | $this->queryDateOp($column, $end, "<=", "date").")\n"; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - function queryFilterTP_yesterday($layout_def) |
|
| 92 | - { |
|
| 93 | - global $timedate; |
|
| 91 | + function queryFilterTP_yesterday($layout_def) |
|
| 92 | + { |
|
| 93 | + global $timedate; |
|
| 94 | 94 | $layout_def['input_name0'] = $timedate->asDbDate($timedate->getNow(true)->get("-1 day")); |
| 95 | 95 | return $this->queryFilterOn($layout_def); |
| 96 | - } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - function queryFilterTP_today($layout_def) |
|
| 99 | - { |
|
| 100 | - global $timedate; |
|
| 98 | + function queryFilterTP_today($layout_def) |
|
| 99 | + { |
|
| 100 | + global $timedate; |
|
| 101 | 101 | $layout_def['input_name0'] = $timedate->asDbDate($timedate->getNow(true)); |
| 102 | 102 | return $this->queryFilterOn($layout_def); |
| 103 | - } |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - function queryFilterTP_tomorrow(& $layout_def) |
|
| 106 | - { |
|
| 107 | - global $timedate; |
|
| 108 | - $layout_def['input_name0'] = $timedate->asDbDate($timedate->getNow(true)->get("+1 day")); |
|
| 105 | + function queryFilterTP_tomorrow(& $layout_def) |
|
| 106 | + { |
|
| 107 | + global $timedate; |
|
| 108 | + $layout_def['input_name0'] = $timedate->asDbDate($timedate->getNow(true)->get("+1 day")); |
|
| 109 | 109 | return $this->queryFilterOn($layout_def); |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | 112 | protected function queryMonth($layout_def, $month) |
| 113 | 113 | { |
@@ -49,37 +49,37 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | class SugarWidget |
| 51 | 51 | { |
| 52 | - var $layout_manager = null; |
|
| 53 | - var $widget_id; |
|
| 52 | + var $layout_manager = null; |
|
| 53 | + var $widget_id; |
|
| 54 | 54 | protected $form_value; |
| 55 | 55 | protected $parent_bean; |
| 56 | 56 | |
| 57 | - function SugarWidget(&$layout_manager) |
|
| 58 | - { |
|
| 59 | - $this->layout_manager = $layout_manager; |
|
| 60 | - } |
|
| 61 | - function display($layout_def) |
|
| 62 | - { |
|
| 63 | - return 'display class undefined'; |
|
| 64 | - } |
|
| 57 | + function SugarWidget(&$layout_manager) |
|
| 58 | + { |
|
| 59 | + $this->layout_manager = $layout_manager; |
|
| 60 | + } |
|
| 61 | + function display($layout_def) |
|
| 62 | + { |
|
| 63 | + return 'display class undefined'; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * getSubpanelWidgetId |
|
| 68 | - * This is a utility function to return a widget's unique id |
|
| 69 | - * @return id String label of the widget's unique id |
|
| 70 | - */ |
|
| 71 | - public function getWidgetId() { |
|
| 72 | - return $this->widget_id; |
|
| 73 | - } |
|
| 66 | + /** |
|
| 67 | + * getSubpanelWidgetId |
|
| 68 | + * This is a utility function to return a widget's unique id |
|
| 69 | + * @return id String label of the widget's unique id |
|
| 70 | + */ |
|
| 71 | + public function getWidgetId() { |
|
| 72 | + return $this->widget_id; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * setSubpanelWidgetId |
|
| 77 | - * This is a utility function to set the id for a widget |
|
| 78 | - * @param id String value to set the widget's unique id |
|
| 79 | - */ |
|
| 80 | - public function setWidgetId($id='') { |
|
| 81 | - $this->widget_id = $id; |
|
| 82 | - } |
|
| 75 | + /** |
|
| 76 | + * setSubpanelWidgetId |
|
| 77 | + * This is a utility function to set the id for a widget |
|
| 78 | + * @param id String value to set the widget's unique id |
|
| 79 | + */ |
|
| 80 | + public function setWidgetId($id='') { |
|
| 81 | + $this->widget_id = $id; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | public function getDisplayName() |
| 85 | 85 | { |
@@ -94,20 +94,20 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $this->parent_bean = $parent_bean; |
| 96 | 96 | } |
| 97 | - /** |
|
| 98 | - * getTruncatedColumnAlias |
|
| 99 | - * This function ensures that a column alias is no more than 28 characters. Should the column_name |
|
| 100 | - * argument exceed 28 charcters, it creates an alias using the first 22 characters of the column_name |
|
| 101 | - * plus an md5 of the first 6 characters of the lowercased column_name value. |
|
| 102 | - * |
|
| 103 | - */ |
|
| 97 | + /** |
|
| 98 | + * getTruncatedColumnAlias |
|
| 99 | + * This function ensures that a column alias is no more than 28 characters. Should the column_name |
|
| 100 | + * argument exceed 28 charcters, it creates an alias using the first 22 characters of the column_name |
|
| 101 | + * plus an md5 of the first 6 characters of the lowercased column_name value. |
|
| 102 | + * |
|
| 103 | + */ |
|
| 104 | 104 | protected function getTruncatedColumnAlias($column_name) |
| 105 | 105 | { |
| 106 | - if(empty($column_name) || !is_string($column_name) || strlen($column_name) < 28) |
|
| 107 | - { |
|
| 108 | - return $column_name; |
|
| 109 | - } |
|
| 110 | - return strtoupper(substr($column_name,0,22) . substr(md5(strtolower($column_name)), 0, 6)); |
|
| 106 | + if(empty($column_name) || !is_string($column_name) || strlen($column_name) < 28) |
|
| 107 | + { |
|
| 108 | + return $column_name; |
|
| 109 | + } |
|
| 110 | + return strtoupper(substr($column_name,0,22) . substr(md5(strtolower($column_name)), 0, 6)); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | class SugarWidgetFieldFloat extends SugarWidgetFieldInt |
| 43 | 43 | { |
| 44 | - function displayList($layout_def) |
|
| 45 | - { |
|
| 44 | + function displayList($layout_def) |
|
| 45 | + { |
|
| 46 | 46 | |
| 47 | 47 | $vardef = $this->getVardef($layout_def); |
| 48 | 48 | |
@@ -51,37 +51,37 @@ discard block |
||
| 51 | 51 | } else { |
| 52 | 52 | $precision = null; |
| 53 | 53 | } |
| 54 | - return format_number(parent::displayListPlain($layout_def), $precision, $precision); |
|
| 55 | - } |
|
| 54 | + return format_number(parent::displayListPlain($layout_def), $precision, $precision); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - function displayListPlain($layout_def) |
|
| 58 | - { |
|
| 59 | - return $this->displayList($layout_def); |
|
| 60 | - } |
|
| 61 | - function queryFilterEquals(&$layout_def) |
|
| 62 | - { |
|
| 57 | + function displayListPlain($layout_def) |
|
| 58 | + { |
|
| 59 | + return $this->displayList($layout_def); |
|
| 60 | + } |
|
| 61 | + function queryFilterEquals(&$layout_def) |
|
| 62 | + { |
|
| 63 | 63 | return $this->_get_column_select($layout_def)."= ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - function queryFilterNot_Equals(&$layout_def) |
|
| 67 | - { |
|
| 68 | - return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
| 69 | - } |
|
| 66 | + function queryFilterNot_Equals(&$layout_def) |
|
| 67 | + { |
|
| 68 | + return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - function queryFilterGreater(&$layout_def) |
|
| 72 | - { |
|
| 71 | + function queryFilterGreater(&$layout_def) |
|
| 72 | + { |
|
| 73 | 73 | return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - function queryFilterLess(&$layout_def) |
|
| 77 | - { |
|
| 78 | - return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
| 79 | - } |
|
| 76 | + function queryFilterLess(&$layout_def) |
|
| 77 | + { |
|
| 78 | + return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - function queryFilterBetween(&$layout_def) |
|
| 82 | - { |
|
| 83 | - return $this->_get_column_select($layout_def)." BETWEEN ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND " . $GLOBALS['db']->quote(unformat_number($layout_def['input_name1'])) . "\n"; |
|
| 84 | - } |
|
| 81 | + function queryFilterBetween(&$layout_def) |
|
| 82 | + { |
|
| 83 | + return $this->_get_column_select($layout_def)." BETWEEN ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND " . $GLOBALS['db']->quote(unformat_number($layout_def['input_name1'])) . "\n"; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | } |
@@ -51,13 +51,13 @@ |
||
| 51 | 51 | $ops = $layout_def['options']; |
| 52 | 52 | } |
| 53 | 53 | elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
| 54 | - $ops = $app_list_strings[$layout_def['options']]; |
|
| 54 | + $ops = $app_list_strings[$layout_def['options']]; |
|
| 55 | 55 | if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
| 56 | - unset($ops['']); |
|
| 57 | - } |
|
| 56 | + unset($ops['']); |
|
| 57 | + } |
|
| 58 | 58 | } |
| 59 | 59 | else{ |
| 60 | - $ops = array(); |
|
| 60 | + $ops = array(); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | else { |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected $reporter; |
| 56 | 56 | |
| 57 | - function SugarWidgetReportField(&$layout_manager) { |
|
| 57 | + function SugarWidgetReportField(&$layout_manager) { |
|
| 58 | 58 | parent::SugarWidgetField($layout_manager); |
| 59 | 59 | $this->reporter = $this->layout_manager->getAttribute("reporter"); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - function getSubClass($layout_def) |
|
| 63 | - { |
|
| 64 | - if (! empty($layout_def['type'])) |
|
| 65 | - { |
|
| 66 | - |
|
| 67 | - if ($layout_def['type'] == 'time') { |
|
| 68 | - $layout_def['widget_class'] = 'Fielddate'; |
|
| 69 | - } else { |
|
| 70 | - $layout_def['widget_class'] = 'Field'.$layout_def['type']; |
|
| 71 | - } |
|
| 72 | - return $this->layout_manager->getClassFromWidgetDef($layout_def); |
|
| 73 | - } else { |
|
| 74 | - return $this; |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - |
|
| 79 | - function display($layout_def) |
|
| 80 | - { |
|
| 62 | + function getSubClass($layout_def) |
|
| 63 | + { |
|
| 64 | + if (! empty($layout_def['type'])) |
|
| 65 | + { |
|
| 66 | + |
|
| 67 | + if ($layout_def['type'] == 'time') { |
|
| 68 | + $layout_def['widget_class'] = 'Fielddate'; |
|
| 69 | + } else { |
|
| 70 | + $layout_def['widget_class'] = 'Field'.$layout_def['type']; |
|
| 71 | + } |
|
| 72 | + return $this->layout_manager->getClassFromWidgetDef($layout_def); |
|
| 73 | + } else { |
|
| 74 | + return $this; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + |
|
| 79 | + function display($layout_def) |
|
| 80 | + { |
|
| 81 | 81 | $obj = $this->getSubClass($layout_def); |
| 82 | 82 | |
| 83 | 83 | $context = $this->layout_manager->getAttribute('context');//_ppd($context); |
@@ -91,51 +91,51 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | return 'display not found:'.$func_name; |
| 93 | 93 | } |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - function _get_column_select_special($layout_def) |
|
| 97 | - { |
|
| 98 | - $alias = ''; |
|
| 99 | - if ( ! empty($layout_def['table_alias'])) |
|
| 100 | - { |
|
| 101 | - $alias = $layout_def['table_alias']; |
|
| 102 | - } |
|
| 96 | + function _get_column_select_special($layout_def) |
|
| 97 | + { |
|
| 98 | + $alias = ''; |
|
| 99 | + if ( ! empty($layout_def['table_alias'])) |
|
| 100 | + { |
|
| 101 | + $alias = $layout_def['table_alias']; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | if ($layout_def['name'] == 'weighted_sum' ) |
| 105 | 105 | { |
| 106 | 106 | return sprintf("SUM(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)), |
| 107 | 107 | $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0))); |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | if ($layout_def['name'] == 'weighted_amount' ) |
| 110 | 110 | { |
| 111 | 111 | return sprintf("AVG(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)), |
| 112 | 112 | $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0))); |
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - function _get_column_select($layout_def) |
|
| 117 | - { |
|
| 118 | - global $reportAlias; |
|
| 119 | - if (!isset($reportAlias)) { |
|
| 120 | - $reportAlias = array(); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - if ( ! empty($layout_def['table_alias'])) { |
|
| 124 | - $alias = $layout_def['table_alias'].".".$layout_def['name']; |
|
| 125 | - } else if (! empty($layout_def['name'])) { |
|
| 126 | - $alias = $layout_def['name']; |
|
| 127 | - } else { |
|
| 128 | - $alias = "*"; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - if ( ! empty($layout_def['group_function']) ) |
|
| 132 | - { |
|
| 133 | - if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount') |
|
| 134 | - { |
|
| 135 | - $alias = $this->_get_column_select_special($layout_def); |
|
| 136 | - $reportAlias[$alias] = $layout_def; |
|
| 137 | - return $alias; |
|
| 138 | - } |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + function _get_column_select($layout_def) |
|
| 117 | + { |
|
| 118 | + global $reportAlias; |
|
| 119 | + if (!isset($reportAlias)) { |
|
| 120 | + $reportAlias = array(); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + if ( ! empty($layout_def['table_alias'])) { |
|
| 124 | + $alias = $layout_def['table_alias'].".".$layout_def['name']; |
|
| 125 | + } else if (! empty($layout_def['name'])) { |
|
| 126 | + $alias = $layout_def['name']; |
|
| 127 | + } else { |
|
| 128 | + $alias = "*"; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + if ( ! empty($layout_def['group_function']) ) |
|
| 132 | + { |
|
| 133 | + if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount') |
|
| 134 | + { |
|
| 135 | + $alias = $this->_get_column_select_special($layout_def); |
|
| 136 | + $reportAlias[$alias] = $layout_def; |
|
| 137 | + return $alias; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | // Use IFNULL only if it's not AVG aggregate |
| 141 | 141 | // because it adds NULL rows to the count when it should not, thus getting wrong result |
@@ -164,66 +164,66 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | } |
| 167 | - } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - $reportAlias[$alias] = $layout_def; |
|
| 170 | - return $alias; |
|
| 171 | - } |
|
| 169 | + $reportAlias[$alias] = $layout_def; |
|
| 170 | + return $alias; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - function querySelect(&$layout_def) |
|
| 174 | - { |
|
| 173 | + function querySelect(&$layout_def) |
|
| 174 | + { |
|
| 175 | 175 | return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)."\n"; |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - function queryGroupBy($layout_def) |
|
| 179 | - { |
|
| 180 | - return $this->_get_column_select($layout_def)." \n"; |
|
| 181 | - } |
|
| 178 | + function queryGroupBy($layout_def) |
|
| 179 | + { |
|
| 180 | + return $this->_get_column_select($layout_def)." \n"; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | 183 | |
| 184 | - function queryOrderBy($layout_def) |
|
| 185 | - { |
|
| 186 | - $field_def = array(); |
|
| 187 | - if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
| 184 | + function queryOrderBy($layout_def) |
|
| 185 | + { |
|
| 186 | + $field_def = array(); |
|
| 187 | + if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
| 188 | 188 | |
| 189 | 189 | if (!empty($layout_def['group_function'])) |
| 190 | 190 | { |
| 191 | 191 | $order_by = $this->_get_column_alias($layout_def); |
| 192 | 192 | } |
| 193 | 193 | elseif (!empty($field_def['sort_on'])) |
| 194 | - { |
|
| 195 | - $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
|
| 194 | + { |
|
| 195 | + $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
|
| 196 | 196 | if(!empty($field_def['sort_on2'])) |
| 197 | 197 | $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2']; |
| 198 | 198 | } |
| 199 | - else { |
|
| 200 | - $order_by = $this->_get_column_alias($layout_def)." \n"; |
|
| 201 | - } |
|
| 199 | + else { |
|
| 200 | + $order_by = $this->_get_column_alias($layout_def)." \n"; |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | - //use sugar db function convert on order by string to convert to varchar. This is mainly for db's |
|
| 204 | - //that do not allow sorting on clob/text fields |
|
| 203 | + //use sugar db function convert on order by string to convert to varchar. This is mainly for db's |
|
| 204 | + //that do not allow sorting on clob/text fields |
|
| 205 | 205 | if ($this->reporter->db->isTextType($this->reporter->db->getFieldType($field_def))) { |
| 206 | 206 | $order_by = $this->reporter->db->convert($order_by,'text2char', array(10000)); // array(10000) is for db2 only |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if ( empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
|
| 210 | - { |
|
| 211 | - return $order_by." ASC"; |
|
| 212 | - } else { |
|
| 213 | - return $order_by." DESC"; |
|
| 214 | - } |
|
| 215 | - } |
|
| 209 | + if ( empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
|
| 210 | + { |
|
| 211 | + return $order_by." ASC"; |
|
| 212 | + } else { |
|
| 213 | + return $order_by." DESC"; |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | 217 | |
| 218 | - function queryFilter($layout_def) |
|
| 219 | - { |
|
| 220 | - $method_name = "queryFilter".$layout_def['qualifier_name']; |
|
| 221 | - return $this->$method_name($layout_def); |
|
| 222 | - } |
|
| 218 | + function queryFilter($layout_def) |
|
| 219 | + { |
|
| 220 | + $method_name = "queryFilter".$layout_def['qualifier_name']; |
|
| 221 | + return $this->$method_name($layout_def); |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - function displayHeaderCell($layout_def) |
|
| 225 | - { |
|
| 226 | - global $start_link_wrapper,$end_link_wrapper; |
|
| 224 | + function displayHeaderCell($layout_def) |
|
| 225 | + { |
|
| 226 | + global $start_link_wrapper,$end_link_wrapper; |
|
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | // don't show sort links if name isn't defined |
@@ -237,22 +237,22 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $sort_by =''; |
| 239 | 239 | if ( ! empty($layout_def['table_key']) && ! empty($layout_def['name']) ) { |
| 240 | - if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') { |
|
| 240 | + if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') { |
|
| 241 | 241 | $sort_by = $layout_def['table_key'].":".'count'; |
| 242 | - } else { |
|
| 243 | - $sort_by = $layout_def['table_key'].":".$layout_def['name']; |
|
| 242 | + } else { |
|
| 243 | + $sort_by = $layout_def['table_key'].":".$layout_def['name']; |
|
| 244 | 244 | if ( ! empty($layout_def['column_function'])) { |
| 245 | - $sort_by .= ':'.$layout_def['column_function']; |
|
| 246 | - } else if ( ! empty($layout_def['group_function']) ) { |
|
| 247 | - $sort_by .= ':'.$layout_def['group_function']; |
|
| 248 | - } |
|
| 249 | - } |
|
| 245 | + $sort_by .= ':'.$layout_def['column_function']; |
|
| 246 | + } else if ( ! empty($layout_def['group_function']) ) { |
|
| 247 | + $sort_by .= ':'.$layout_def['group_function']; |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | 250 | } else { |
| 251 | - return $this->displayHeaderCellPlain($layout_def); |
|
| 251 | + return $this->displayHeaderCellPlain($layout_def); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $start = empty($start_link_wrapper) ? '': $start_link_wrapper; |
| 255 | - $end = empty($end_link_wrapper) ? '': $end_link_wrapper; |
|
| 255 | + $end = empty($end_link_wrapper) ? '': $end_link_wrapper; |
|
| 256 | 256 | |
| 257 | 257 | // unable to retrieve the vardef here, exclude columns of type clob/text from being sortable |
| 258 | 258 | |
@@ -262,40 +262,40 @@ discard block |
||
| 262 | 262 | $objListView = new ListView(); |
| 263 | 263 | $header_cell .= $objListView->getArrowUpDownStart(isset($layout_def['sort']) ? $layout_def['sort'] : ''); |
| 264 | 264 | $header_cell .= $objListView->getArrowUpDownEnd(isset($layout_def['sort']) ? $layout_def['sort'] : ''); |
| 265 | - $header_cell .= "</a>"; |
|
| 266 | - return $header_cell; |
|
| 267 | - } |
|
| 265 | + $header_cell .= "</a>"; |
|
| 266 | + return $header_cell; |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - return $this->displayHeaderCellPlain($layout_def); |
|
| 269 | + return $this->displayHeaderCellPlain($layout_def); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - function query($layout_def) |
|
| 273 | - { |
|
| 274 | - $obj = $this->getSubClass($layout_def); |
|
| 272 | + function query($layout_def) |
|
| 273 | + { |
|
| 274 | + $obj = $this->getSubClass($layout_def); |
|
| 275 | 275 | |
| 276 | - $context = $this->layout_manager->getAttribute('context'); |
|
| 277 | - $func_name = 'query'.$context; |
|
| 276 | + $context = $this->layout_manager->getAttribute('context'); |
|
| 277 | + $func_name = 'query'.$context; |
|
| 278 | 278 | |
| 279 | - if ( ! empty($context) && method_exists($obj,$func_name)) |
|
| 280 | - { |
|
| 281 | - return $obj->$func_name($layout_def); |
|
| 282 | - } else |
|
| 283 | - { |
|
| 284 | - return ''; |
|
| 285 | - } |
|
| 286 | - } |
|
| 279 | + if ( ! empty($context) && method_exists($obj,$func_name)) |
|
| 280 | + { |
|
| 281 | + return $obj->$func_name($layout_def); |
|
| 282 | + } else |
|
| 283 | + { |
|
| 284 | + return ''; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | 287 | |
| 288 | - function _get_column_alias($layout_def) |
|
| 289 | - { |
|
| 288 | + function _get_column_alias($layout_def) |
|
| 289 | + { |
|
| 290 | 290 | $alias_arr = array(); |
| 291 | 291 | |
| 292 | - if (!empty($layout_def['table_key']) && $layout_def['table_key'] == 'self' && !empty($layout_def['name']) && $layout_def['name'] == 'id') |
|
| 293 | - { |
|
| 294 | - return 'primaryid'; |
|
| 295 | - } |
|
| 292 | + if (!empty($layout_def['table_key']) && $layout_def['table_key'] == 'self' && !empty($layout_def['name']) && $layout_def['name'] == 'id') |
|
| 293 | + { |
|
| 294 | + return 'primaryid'; |
|
| 295 | + } |
|
| 296 | 296 | |
| 297 | - // Bug: 44605 |
|
| 298 | - // this comment is being added to trigger the upgrade package |
|
| 297 | + // Bug: 44605 |
|
| 298 | + // this comment is being added to trigger the upgrade package |
|
| 299 | 299 | if ( ! empty($layout_def['group_function']) && $layout_def['group_function']=='count') |
| 300 | 300 | { |
| 301 | 301 | return $layout_def['table_alias'] . '__count'; |
@@ -322,49 +322,49 @@ discard block |
||
| 322 | 322 | array_push($alias_arr,$layout_def['name']); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - global $used_aliases, $alias_map; |
|
| 325 | + global $used_aliases, $alias_map; |
|
| 326 | 326 | |
| 327 | 327 | $alias = strtolower(implode("_",$alias_arr)); |
| 328 | 328 | |
| 329 | 329 | $short_alias = $this->getTruncatedColumnAlias($alias); |
| 330 | 330 | |
| 331 | - if ( empty($used_aliases[$short_alias])) |
|
| 332 | - { |
|
| 333 | - $alias_map[$alias] = $short_alias; |
|
| 334 | - $used_aliases[$short_alias] = 1; |
|
| 335 | - return $short_alias; |
|
| 336 | - } else if ( ! empty($alias_map[$alias]) ) |
|
| 337 | - { |
|
| 338 | - return $alias_map[$alias]; |
|
| 339 | - } else { |
|
| 340 | - $alias_map[$alias] = $short_alias.'_'.$used_aliases[$short_alias]; |
|
| 341 | - $used_aliases[$short_alias]++; |
|
| 342 | - return $alias_map[$alias]; |
|
| 343 | - } |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - function queryFilterEmpty($layout_def) |
|
| 347 | - { |
|
| 348 | - $column = $this->_get_column_select($layout_def); |
|
| 349 | - return "($column IS NULL OR $column = ".$this->reporter->db->emptyValue($layout_def['type']).")"; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - function queryFilterIs($layout_def) |
|
| 353 | - { |
|
| 354 | - return '( '.$this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n"; |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - function queryFilteris_not($layout_def) |
|
| 358 | - { |
|
| 359 | - return '( '.$this->_get_column_select($layout_def)."<>'".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n"; |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - function queryFilterNot_Empty($layout_def) |
|
| 363 | - { |
|
| 364 | - /** @var $db DBManager */ |
|
| 365 | - $db = $this->reporter->db; |
|
| 366 | - $column = $this->_get_column_select($layout_def); |
|
| 367 | - return "(coalesce(" . $db->convert($column, "length") . ",0) > 0)\n"; |
|
| 368 | - } |
|
| 331 | + if ( empty($used_aliases[$short_alias])) |
|
| 332 | + { |
|
| 333 | + $alias_map[$alias] = $short_alias; |
|
| 334 | + $used_aliases[$short_alias] = 1; |
|
| 335 | + return $short_alias; |
|
| 336 | + } else if ( ! empty($alias_map[$alias]) ) |
|
| 337 | + { |
|
| 338 | + return $alias_map[$alias]; |
|
| 339 | + } else { |
|
| 340 | + $alias_map[$alias] = $short_alias.'_'.$used_aliases[$short_alias]; |
|
| 341 | + $used_aliases[$short_alias]++; |
|
| 342 | + return $alias_map[$alias]; |
|
| 343 | + } |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + function queryFilterEmpty($layout_def) |
|
| 347 | + { |
|
| 348 | + $column = $this->_get_column_select($layout_def); |
|
| 349 | + return "($column IS NULL OR $column = ".$this->reporter->db->emptyValue($layout_def['type']).")"; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + function queryFilterIs($layout_def) |
|
| 353 | + { |
|
| 354 | + return '( '.$this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n"; |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + function queryFilteris_not($layout_def) |
|
| 358 | + { |
|
| 359 | + return '( '.$this->_get_column_select($layout_def)."<>'".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n"; |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + function queryFilterNot_Empty($layout_def) |
|
| 363 | + { |
|
| 364 | + /** @var $db DBManager */ |
|
| 365 | + $db = $this->reporter->db; |
|
| 366 | + $column = $this->_get_column_select($layout_def); |
|
| 367 | + return "(coalesce(" . $db->convert($column, "length") . ",0) > 0)\n"; |
|
| 368 | + } |
|
| 369 | 369 | |
| 370 | 370 | } |
@@ -46,8 +46,8 @@ |
||
| 46 | 46 | |
| 47 | 47 | class SugarWidgetSubPanelTopMessage extends SugarWidgetSubPanelTopButton |
| 48 | 48 | { |
| 49 | - function display($defines) |
|
| 50 | - { |
|
| 49 | + function display($defines) |
|
| 50 | + { |
|
| 51 | 51 | return $defines['message']; |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | } |
| 54 | 54 | \ No newline at end of file |
@@ -58,39 +58,39 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function queryFilteris($layout_def) { |
| 61 | - $input_name0 = $layout_def['input_name0']; |
|
| 62 | - if (is_array($layout_def['input_name0'])) { |
|
| 63 | - $input_name0 = $layout_def['input_name0'][0]; |
|
| 64 | - } |
|
| 65 | - return $this->_get_column_select($layout_def)." = ".$this->reporter->db->quoted($input_name0)."\n"; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - public function queryFilteris_not($layout_def) { |
|
| 69 | - $input_name0 = $layout_def['input_name0']; |
|
| 70 | - if (is_array($layout_def['input_name0'])) { |
|
| 71 | - $input_name0 = $layout_def['input_name0'][0]; |
|
| 72 | - } |
|
| 73 | - return $this->_get_column_select($layout_def)." <> ".$this->reporter->db->quoted($input_name0)."\n"; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - public function queryFilterone_of($layout_def) { |
|
| 77 | - $arr = array (); |
|
| 78 | - foreach ($layout_def['input_name0'] as $value) { |
|
| 79 | - $arr[] = $this->reporter->db->quoted($value); |
|
| 80 | - } |
|
| 81 | - $str = implode(",", $arr); |
|
| 82 | - return $this->_get_column_select($layout_def)." IN (".$str.")\n"; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - public function queryFilternot_one_of($layout_def) { |
|
| 86 | - $arr = array (); |
|
| 87 | - foreach ($layout_def['input_name0'] as $value) { |
|
| 88 | - $arr[] = $this->reporter->db->quoted($value); |
|
| 89 | - } |
|
| 90 | - $reporter = $this->layout_manager->getAttribute("reporter"); |
|
| 91 | - $str = implode(",", $arr); |
|
| 92 | - return $this->_get_column_select($layout_def)." NOT IN (".$str.")\n"; |
|
| 93 | - } |
|
| 61 | + $input_name0 = $layout_def['input_name0']; |
|
| 62 | + if (is_array($layout_def['input_name0'])) { |
|
| 63 | + $input_name0 = $layout_def['input_name0'][0]; |
|
| 64 | + } |
|
| 65 | + return $this->_get_column_select($layout_def)." = ".$this->reporter->db->quoted($input_name0)."\n"; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + public function queryFilteris_not($layout_def) { |
|
| 69 | + $input_name0 = $layout_def['input_name0']; |
|
| 70 | + if (is_array($layout_def['input_name0'])) { |
|
| 71 | + $input_name0 = $layout_def['input_name0'][0]; |
|
| 72 | + } |
|
| 73 | + return $this->_get_column_select($layout_def)." <> ".$this->reporter->db->quoted($input_name0)."\n"; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + public function queryFilterone_of($layout_def) { |
|
| 77 | + $arr = array (); |
|
| 78 | + foreach ($layout_def['input_name0'] as $value) { |
|
| 79 | + $arr[] = $this->reporter->db->quoted($value); |
|
| 80 | + } |
|
| 81 | + $str = implode(",", $arr); |
|
| 82 | + return $this->_get_column_select($layout_def)." IN (".$str.")\n"; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + public function queryFilternot_one_of($layout_def) { |
|
| 86 | + $arr = array (); |
|
| 87 | + foreach ($layout_def['input_name0'] as $value) { |
|
| 88 | + $arr[] = $this->reporter->db->quoted($value); |
|
| 89 | + } |
|
| 90 | + $reporter = $this->layout_manager->getAttribute("reporter"); |
|
| 91 | + $str = implode(",", $arr); |
|
| 92 | + return $this->_get_column_select($layout_def)." NOT IN (".$str.")\n"; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | function & displayList($layout_def) { |
| 96 | 96 | if(!empty($layout_def['column_key'])){ |
@@ -116,84 +116,84 @@ discard block |
||
| 116 | 116 | $field_type = $field_def['type']; |
| 117 | 117 | $div_id = $field_def['module'] ."&$record&$field_name"; |
| 118 | 118 | $str = "<div id='$div_id'>" . $cell . " " |
| 119 | - . SugarThemeRegistry::current()->getImage( |
|
| 119 | + . SugarThemeRegistry::current()->getImage( |
|
| 120 | 120 | "edit_inline", |
| 121 | 121 | "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(" . |
| 122 | 122 | "\"$div_id\",\"$cell\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'" |
| 123 | - ) |
|
| 124 | - . "</div>"; |
|
| 123 | + ) |
|
| 124 | + . "</div>"; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | return $str; |
| 128 | 128 | } |
| 129 | - function & displayListPlain($layout_def) { |
|
| 130 | - if(!empty($layout_def['column_key'])){ |
|
| 131 | - $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
| 132 | - }else if(!empty($layout_def['fields'])){ |
|
| 133 | - $field_def = $layout_def['fields']; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){ |
|
| 137 | - $value = $this->_get_list_value($layout_def); |
|
| 138 | - }else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){ |
|
| 139 | - $key = strtoupper($layout_def['name']); |
|
| 140 | - $value = $layout_def['fields'][$key]; |
|
| 141 | - } |
|
| 142 | - $cell = ''; |
|
| 143 | - |
|
| 144 | - if(isset($field_def['options'])){ |
|
| 145 | - $cell = translate($field_def['options'], $field_def['module'], $value); |
|
| 146 | - }else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){ |
|
| 147 | - global $beanFiles; |
|
| 148 | - if(empty($beanFiles)) { |
|
| 149 | - include('include/modules.php'); |
|
| 150 | - } |
|
| 151 | - $bean_name = get_singular_bean_name($field_def['module']); |
|
| 152 | - require_once($beanFiles[$bean_name]); |
|
| 153 | - $list = $field_def['function'](); |
|
| 154 | - $cell = $list[$value]; |
|
| 155 | - } |
|
| 156 | - if (is_array($cell)) { |
|
| 157 | - |
|
| 158 | - //#22632 |
|
| 159 | - $value = unencodeMultienum($value); |
|
| 160 | - $cell=array(); |
|
| 161 | - foreach($value as $val){ |
|
| 162 | - $returnVal = translate($field_def['options'],$field_def['module'],$val); |
|
| 163 | - if(!is_array($returnVal)){ |
|
| 164 | - array_push( $cell, translate($field_def['options'],$field_def['module'],$val)); |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - $cell = implode(", ",$cell); |
|
| 168 | - } |
|
| 169 | - return $cell; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - public function queryOrderBy($layout_def) { |
|
| 173 | - $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
| 174 | - if (!empty ($field_def['sort_on'])) { |
|
| 175 | - $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
|
| 176 | - } else { |
|
| 177 | - $order_by = $this->_get_column_select($layout_def); |
|
| 178 | - } |
|
| 179 | - $list = array(); |
|
| 129 | + function & displayListPlain($layout_def) { |
|
| 130 | + if(!empty($layout_def['column_key'])){ |
|
| 131 | + $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
| 132 | + }else if(!empty($layout_def['fields'])){ |
|
| 133 | + $field_def = $layout_def['fields']; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){ |
|
| 137 | + $value = $this->_get_list_value($layout_def); |
|
| 138 | + }else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){ |
|
| 139 | + $key = strtoupper($layout_def['name']); |
|
| 140 | + $value = $layout_def['fields'][$key]; |
|
| 141 | + } |
|
| 142 | + $cell = ''; |
|
| 143 | + |
|
| 144 | + if(isset($field_def['options'])){ |
|
| 145 | + $cell = translate($field_def['options'], $field_def['module'], $value); |
|
| 146 | + }else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){ |
|
| 147 | + global $beanFiles; |
|
| 148 | + if(empty($beanFiles)) { |
|
| 149 | + include('include/modules.php'); |
|
| 150 | + } |
|
| 151 | + $bean_name = get_singular_bean_name($field_def['module']); |
|
| 152 | + require_once($beanFiles[$bean_name]); |
|
| 153 | + $list = $field_def['function'](); |
|
| 154 | + $cell = $list[$value]; |
|
| 155 | + } |
|
| 156 | + if (is_array($cell)) { |
|
| 157 | + |
|
| 158 | + //#22632 |
|
| 159 | + $value = unencodeMultienum($value); |
|
| 160 | + $cell=array(); |
|
| 161 | + foreach($value as $val){ |
|
| 162 | + $returnVal = translate($field_def['options'],$field_def['module'],$val); |
|
| 163 | + if(!is_array($returnVal)){ |
|
| 164 | + array_push( $cell, translate($field_def['options'],$field_def['module'],$val)); |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + $cell = implode(", ",$cell); |
|
| 168 | + } |
|
| 169 | + return $cell; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + public function queryOrderBy($layout_def) { |
|
| 173 | + $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
| 174 | + if (!empty ($field_def['sort_on'])) { |
|
| 175 | + $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
|
| 176 | + } else { |
|
| 177 | + $order_by = $this->_get_column_select($layout_def); |
|
| 178 | + } |
|
| 179 | + $list = array(); |
|
| 180 | 180 | if(isset($field_def['options'])) { |
| 181 | - $list = translate($field_def['options'], $field_def['module']); |
|
| 181 | + $list = translate($field_def['options'], $field_def['module']); |
|
| 182 | 182 | } elseif(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) { |
| 183 | - global $beanFiles; |
|
| 184 | - if(empty($beanFiles)) { |
|
| 185 | - include('include/modules.php'); |
|
| 186 | - } |
|
| 187 | - $bean_name = get_singular_bean_name($field_def['module']); |
|
| 188 | - require_once($beanFiles[$bean_name]); |
|
| 183 | + global $beanFiles; |
|
| 184 | + if(empty($beanFiles)) { |
|
| 185 | + include('include/modules.php'); |
|
| 186 | + } |
|
| 187 | + $bean_name = get_singular_bean_name($field_def['module']); |
|
| 188 | + require_once($beanFiles[$bean_name]); |
|
| 189 | 189 | $list = $field_def['function'](); |
| 190 | 190 | } |
| 191 | - if (empty ($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') { |
|
| 192 | - $order_dir = "ASC"; |
|
| 193 | - } else { |
|
| 194 | - $order_dir = "DESC"; |
|
| 195 | - } |
|
| 196 | - return $this->reporter->db->orderByEnum($order_by, $list, $order_dir); |
|
| 191 | + if (empty ($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') { |
|
| 192 | + $order_dir = "ASC"; |
|
| 193 | + } else { |
|
| 194 | + $order_dir = "DESC"; |
|
| 195 | + } |
|
| 196 | + return $this->reporter->db->orderByEnum($order_by, $list, $order_dir); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | public function displayInput($layout_def) { |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | $ops = $layout_def['options']; |
| 205 | 205 | } |
| 206 | 206 | elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
| 207 | - $ops = $app_list_strings[$layout_def['options']]; |
|
| 207 | + $ops = $app_list_strings[$layout_def['options']]; |
|
| 208 | 208 | if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
| 209 | - unset($ops['']); |
|
| 210 | - } |
|
| 209 | + unset($ops['']); |
|
| 210 | + } |
|
| 211 | 211 | } |
| 212 | 212 | else{ |
| 213 | - $ops = array(); |
|
| 213 | + $ops = array(); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | else { |
@@ -45,137 +45,137 @@ |
||
| 45 | 45 | |
| 46 | 46 | class SugarWidgetSubPanelTopSelectUsersButton extends SugarWidgetSubPanelTopSelectButton |
| 47 | 47 | { |
| 48 | - //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
|
| 49 | - function SugarWidgetSubPanelTopSelectUsersButton($button_properties=array()) |
|
| 50 | - { |
|
| 51 | - $this->button_properties=$button_properties; |
|
| 52 | - } |
|
| 48 | + //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
|
| 49 | + function SugarWidgetSubPanelTopSelectUsersButton($button_properties=array()) |
|
| 50 | + { |
|
| 51 | + $this->button_properties=$button_properties; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | function getDisplayName() |
| 55 | 55 | { |
| 56 | 56 | return $GLOBALS['app_strings']['LBL_SELECT_USER_BUTTON_LABEL']; |
| 57 | 57 | } |
| 58 | - //widget_data is the collection of attributes associated with the button in the layout_defs file. |
|
| 59 | - function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 60 | - { |
|
| 61 | - global $app_strings; |
|
| 62 | - $initial_filter = ''; |
|
| 63 | - |
|
| 64 | - $this->title = $app_strings['LBL_SELECT_USER_BUTTON_TITLE']; |
|
| 65 | - //$this->accesskey = $app_strings['LBL_SELECT_USER_BUTTON_KEY']; |
|
| 66 | - $this->value = $this->getDisplayName(); |
|
| 67 | - |
|
| 68 | - $this->module_name = 'Users'; |
|
| 69 | - |
|
| 70 | - if (is_array($this->button_properties)) { |
|
| 71 | - if( isset($this->button_properties['title'])) { |
|
| 72 | - $this->title = $app_strings[$this->button_properties['title']]; |
|
| 73 | - } |
|
| 74 | - if( isset($this->button_properties['accesskey'])) { |
|
| 75 | - //$this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
|
| 76 | - } |
|
| 77 | - if( isset($this->button_properties['form_value'])) { |
|
| 78 | - $this->value = $app_strings[$this->button_properties['form_value']]; |
|
| 79 | - } |
|
| 80 | - if( isset($this->button_properties['module'])) { |
|
| 81 | - $this->module_name = $this->button_properties['module']; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - $focus = $widget_data['focus']; |
|
| 86 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 87 | - $button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 88 | - . ' title="' . $this->title . '"' |
|
| 89 | - . ' value="' . $this->value . "\"\n" |
|
| 90 | - .' disabled />'; |
|
| 91 | - return $button; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - //refresh the whole page after end of action? |
|
| 95 | - $refresh_page = 0; |
|
| 96 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 97 | - $refresh_page = 1; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $subpanel_definition = $widget_data['subpanel_definition']; |
|
| 101 | - |
|
| 102 | - $button_definition = $subpanel_definition->get_buttons(); |
|
| 103 | - $subpanel_name = $subpanel_definition->get_module_name(); |
|
| 104 | - if (empty($this->module_name)) { |
|
| 105 | - $this->module_name = $subpanel_name; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - if ($subpanel_name == 'Project'){ |
|
| 109 | - $link_field_name = 'project_users_1'; |
|
| 110 | - } |
|
| 111 | - else{ |
|
| 112 | - $link_field_name = $subpanel_definition->get_data_source_name(true); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $popup_mode='Single'; |
|
| 116 | - if(isset($widget_data['mode'])){ |
|
| 117 | - $popup_mode=$widget_data['mode']; |
|
| 118 | - } |
|
| 119 | - if(isset($widget_data['initial_filter_fields'])){ |
|
| 120 | - if (is_array($widget_data['initial_filter_fields'])) { |
|
| 121 | - foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
|
| 122 | - if (isset($focus->$value) and !empty($focus->$value)) { |
|
| 123 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - if (!empty($widget_data['filter_out_is_admin'])) { |
|
| 58 | + //widget_data is the collection of attributes associated with the button in the layout_defs file. |
|
| 59 | + function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 60 | + { |
|
| 61 | + global $app_strings; |
|
| 62 | + $initial_filter = ''; |
|
| 63 | + |
|
| 64 | + $this->title = $app_strings['LBL_SELECT_USER_BUTTON_TITLE']; |
|
| 65 | + //$this->accesskey = $app_strings['LBL_SELECT_USER_BUTTON_KEY']; |
|
| 66 | + $this->value = $this->getDisplayName(); |
|
| 67 | + |
|
| 68 | + $this->module_name = 'Users'; |
|
| 69 | + |
|
| 70 | + if (is_array($this->button_properties)) { |
|
| 71 | + if( isset($this->button_properties['title'])) { |
|
| 72 | + $this->title = $app_strings[$this->button_properties['title']]; |
|
| 73 | + } |
|
| 74 | + if( isset($this->button_properties['accesskey'])) { |
|
| 75 | + //$this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
|
| 76 | + } |
|
| 77 | + if( isset($this->button_properties['form_value'])) { |
|
| 78 | + $this->value = $app_strings[$this->button_properties['form_value']]; |
|
| 79 | + } |
|
| 80 | + if( isset($this->button_properties['module'])) { |
|
| 81 | + $this->module_name = $this->button_properties['module']; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + $focus = $widget_data['focus']; |
|
| 86 | + if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 87 | + $button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 88 | + . ' title="' . $this->title . '"' |
|
| 89 | + . ' value="' . $this->value . "\"\n" |
|
| 90 | + .' disabled />'; |
|
| 91 | + return $button; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + //refresh the whole page after end of action? |
|
| 95 | + $refresh_page = 0; |
|
| 96 | + if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 97 | + $refresh_page = 1; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $subpanel_definition = $widget_data['subpanel_definition']; |
|
| 101 | + |
|
| 102 | + $button_definition = $subpanel_definition->get_buttons(); |
|
| 103 | + $subpanel_name = $subpanel_definition->get_module_name(); |
|
| 104 | + if (empty($this->module_name)) { |
|
| 105 | + $this->module_name = $subpanel_name; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + if ($subpanel_name == 'Project'){ |
|
| 109 | + $link_field_name = 'project_users_1'; |
|
| 110 | + } |
|
| 111 | + else{ |
|
| 112 | + $link_field_name = $subpanel_definition->get_data_source_name(true); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $popup_mode='Single'; |
|
| 116 | + if(isset($widget_data['mode'])){ |
|
| 117 | + $popup_mode=$widget_data['mode']; |
|
| 118 | + } |
|
| 119 | + if(isset($widget_data['initial_filter_fields'])){ |
|
| 120 | + if (is_array($widget_data['initial_filter_fields'])) { |
|
| 121 | + foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
|
| 122 | + if (isset($focus->$value) and !empty($focus->$value)) { |
|
| 123 | + $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + if (!empty($widget_data['filter_out_is_admin'])) { |
|
| 130 | 130 | $initial_filter.="&is_admin_advanced=0"; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $create="true"; |
|
| 134 | - if(isset($widget_data['create'])){ |
|
| 135 | - $create=$widget_data['create']; |
|
| 136 | - } |
|
| 137 | - $return_module = $_REQUEST['module']; |
|
| 138 | - $return_action = 'SubPanelViewer'; |
|
| 139 | - $return_id = $_REQUEST['record']; |
|
| 140 | - |
|
| 141 | - //field_to_name_array |
|
| 142 | - $fton_array= array('id' => 'subpanel_id'); |
|
| 143 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 144 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
|
| 148 | - |
|
| 149 | - $popup_request_data = array( |
|
| 150 | - 'call_back_function' => 'set_return_and_save_background', |
|
| 151 | - 'form_name' => 'DetailView', |
|
| 152 | - 'field_to_name_array' => $fton_array, |
|
| 153 | - 'passthru_data' => array( |
|
| 154 | - 'child_field' => $this->module_name, |
|
| 155 | - 'return_url' => urlencode($return_url), |
|
| 156 | - 'link_field_name' => $link_field_name, |
|
| 157 | - 'module_name' => $this->module_name, |
|
| 158 | - 'refresh_page' => 1, |
|
| 159 | - ), |
|
| 160 | - ); |
|
| 161 | - |
|
| 162 | - if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) { |
|
| 163 | - $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
|
| 167 | - |
|
| 168 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 169 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 170 | - } |
|
| 171 | - } |
|
| 172 | - $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
|
| 173 | - |
|
| 174 | - return '<form action="index.php">' . "\n" |
|
| 175 | - . ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 176 | - . ' title="' . $this->title . '"' |
|
| 177 | - . ' value="' . $this->value . "\"\n" |
|
| 178 | - . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n"; |
|
| 179 | - } |
|
| 133 | + $create="true"; |
|
| 134 | + if(isset($widget_data['create'])){ |
|
| 135 | + $create=$widget_data['create']; |
|
| 136 | + } |
|
| 137 | + $return_module = $_REQUEST['module']; |
|
| 138 | + $return_action = 'SubPanelViewer'; |
|
| 139 | + $return_id = $_REQUEST['record']; |
|
| 140 | + |
|
| 141 | + //field_to_name_array |
|
| 142 | + $fton_array= array('id' => 'subpanel_id'); |
|
| 143 | + if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 144 | + $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
|
| 148 | + |
|
| 149 | + $popup_request_data = array( |
|
| 150 | + 'call_back_function' => 'set_return_and_save_background', |
|
| 151 | + 'form_name' => 'DetailView', |
|
| 152 | + 'field_to_name_array' => $fton_array, |
|
| 153 | + 'passthru_data' => array( |
|
| 154 | + 'child_field' => $this->module_name, |
|
| 155 | + 'return_url' => urlencode($return_url), |
|
| 156 | + 'link_field_name' => $link_field_name, |
|
| 157 | + 'module_name' => $this->module_name, |
|
| 158 | + 'refresh_page' => 1, |
|
| 159 | + ), |
|
| 160 | + ); |
|
| 161 | + |
|
| 162 | + if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) { |
|
| 163 | + $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
|
| 167 | + |
|
| 168 | + if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 169 | + $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | + $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
|
| 173 | + |
|
| 174 | + return '<form action="index.php">' . "\n" |
|
| 175 | + . ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 176 | + . ' title="' . $this->title . '"' |
|
| 177 | + . ' value="' . $this->value . "\"\n" |
|
| 178 | + . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n"; |
|
| 179 | + } |
|
| 180 | 180 | } |
| 181 | 181 | ?> |
@@ -45,33 +45,33 @@ |
||
| 45 | 45 | |
| 46 | 46 | class SugarWidgetSubPanelEditRoleButton extends SugarWidgetField |
| 47 | 47 | { |
| 48 | - function displayHeaderCell(&$layout_def) |
|
| 49 | - { |
|
| 50 | - return ' '; |
|
| 51 | - } |
|
| 48 | + function displayHeaderCell(&$layout_def) |
|
| 49 | + { |
|
| 50 | + return ' '; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - function displayList(&$layout_def) |
|
| 54 | - { |
|
| 55 | - global $app_strings; |
|
| 53 | + function displayList(&$layout_def) |
|
| 54 | + { |
|
| 55 | + global $app_strings; |
|
| 56 | 56 | global $subpanel_item_count; |
| 57 | 57 | $unique_id = $layout_def['subpanel_id']."_edit_".$subpanel_item_count; //bug 51512 |
| 58 | 58 | |
| 59 | - $href = 'index.php?module=' . $layout_def['module'] |
|
| 60 | - . '&action=' . 'ContactOpportunityRelationshipEdit' |
|
| 61 | - . '&record=' . $layout_def['fields']['OPPORTUNITY_ROLE_ID'] |
|
| 62 | - . '&return_module=' . $_REQUEST['module'] |
|
| 63 | - . '&return_action=' . 'DetailView' |
|
| 64 | - . '&return_id=' . $_REQUEST['record']; |
|
| 59 | + $href = 'index.php?module=' . $layout_def['module'] |
|
| 60 | + . '&action=' . 'ContactOpportunityRelationshipEdit' |
|
| 61 | + . '&record=' . $layout_def['fields']['OPPORTUNITY_ROLE_ID'] |
|
| 62 | + . '&return_module=' . $_REQUEST['module'] |
|
| 63 | + . '&return_action=' . 'DetailView' |
|
| 64 | + . '&return_id=' . $_REQUEST['record']; |
|
| 65 | 65 | |
| 66 | - //based on listview since that lets you select records |
|
| 67 | - if($layout_def['ListView']){ |
|
| 68 | - return '<a href="' . $href . '"' |
|
| 66 | + //based on listview since that lets you select records |
|
| 67 | + if($layout_def['ListView']){ |
|
| 68 | + return '<a href="' . $href . '"' |
|
| 69 | 69 | . "id=\"$unique_id\"" |
| 70 | - . 'class="listViewTdToolsS1">' . $app_strings['LNK_EDIT'] .'</a> '; |
|
| 71 | - }else{ |
|
| 72 | - return ''; |
|
| 73 | - } |
|
| 74 | - } |
|
| 70 | + . 'class="listViewTdToolsS1">' . $app_strings['LNK_EDIT'] .'</a> '; |
|
| 71 | + }else{ |
|
| 72 | + return ''; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | ?> |
| 78 | 78 | \ No newline at end of file |