@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,22 +42,22 @@ discard block |
||
42 | 42 | |
43 | 43 | class SugarWidgetFieldMultiEnum extends SugarWidgetFieldEnum { |
44 | 44 | public function queryFilternot_one_of(&$layout_def) { |
45 | - $arr = array (); |
|
45 | + $arr = array(); |
|
46 | 46 | foreach ($layout_def['input_name0'] as $value) { |
47 | 47 | array_push($arr, "'".$GLOBALS['db']->quote($value)."'"); |
48 | 48 | } |
49 | 49 | $reporter = $this->layout_manager->getAttribute("reporter"); |
50 | 50 | |
51 | - $col_name = $this->_get_column_select($layout_def) . " NOT LIKE " ; |
|
51 | + $col_name = $this->_get_column_select($layout_def)." NOT LIKE "; |
|
52 | 52 | $arr_count = count($arr); |
53 | 53 | $query = ""; |
54 | - foreach($arr as $key=>$val) { |
|
54 | + foreach ($arr as $key=>$val) { |
|
55 | 55 | $query .= $col_name; |
56 | 56 | $value = preg_replace("/^'/", "'%", $val, 1); |
57 | 57 | $value = preg_replace("/'$/", "%'", $value, 1); |
58 | 58 | $query .= $value; |
59 | 59 | if ($key != ($arr_count - 1)) |
60 | - $query.= " OR " ; |
|
60 | + $query .= " OR "; |
|
61 | 61 | } |
62 | 62 | return '('.$query.')'; |
63 | 63 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | //Fix for inaccurate filtering of contacts in Contacts dashlet on multiselects. |
67 | 67 | $arr = array(); |
68 | 68 | foreach ($layout_def['input_name0'] as $value) { |
69 | - if($value != ""){ |
|
69 | + if ($value != "") { |
|
70 | 70 | array_push($arr, "'".$GLOBALS['db']->quote($value)."'"); |
71 | - }else{ |
|
71 | + } else { |
|
72 | 72 | array_push($arr, "'^^'"); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | $reporter = $this->layout_manager->getAttribute("reporter"); |
76 | 76 | |
77 | - $col_name = $this->_get_column_select($layout_def) . " LIKE " ; |
|
77 | + $col_name = $this->_get_column_select($layout_def)." LIKE "; |
|
78 | 78 | $arr_count = count($arr); |
79 | 79 | $query = ""; |
80 | - foreach($arr as $key=>$val) { |
|
80 | + foreach ($arr as $key=>$val) { |
|
81 | 81 | $query .= $col_name; |
82 | 82 | $value = preg_replace("/^'/", "'%", $val, 1); |
83 | 83 | $value = preg_replace("/'$/", "%'", $value, 1); |
84 | 84 | $query .= $value; |
85 | 85 | if ($key != ($arr_count - 1)) |
86 | - $query.= " OR " ; |
|
86 | + $query .= " OR "; |
|
87 | 87 | } |
88 | 88 | return '('.$query.')'; |
89 | 89 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | function queryFilterone_of(&$layout_def) |
79 | 79 | { |
80 | - foreach($layout_def['input_name0'] as $key => $value) { |
|
80 | + foreach ($layout_def['input_name0'] as $key => $value) { |
|
81 | 81 | $layout_def['input_name0'][$key] = $GLOBALS['db']->quote($value); |
82 | 82 | } |
83 | - return $this->_get_column_select($layout_def) . " IN ('" . implode("','", $layout_def['input_name0']) . "')\n"; |
|
83 | + return $this->_get_column_select($layout_def)." IN ('".implode("','", $layout_def['input_name0'])."')\n"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | function displayInput(&$layout_def) |
87 | 87 | { |
88 | - $str = '<input type="text" size="20" value="' . $layout_def['input_name0'] . '" name="' . $layout_def['name'] . '">'; |
|
88 | + $str = '<input type="text" size="20" value="'.$layout_def['input_name0'].'" name="'.$layout_def['name'].'">'; |
|
89 | 89 | return $str; |
90 | 90 | } |
91 | 91 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | { |
47 | 47 | global $timedate; |
48 | 48 | // i guess qualifier and column_function are the same.. |
49 | - if (! empty($layout_def['column_function'])) { |
|
49 | + if (!empty($layout_def['column_function'])) { |
|
50 | 50 | $func_name = 'displayList'.$layout_def['column_function']; |
51 | - if ( method_exists($this,$func_name)) { |
|
51 | + if (method_exists($this, $func_name)) { |
|
52 | 52 | $display = $this->$func_name($layout_def); |
53 | 53 | return $display; |
54 | 54 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * This is a utility function to set the id for a widget |
78 | 78 | * @param id String value to set the widget's unique id |
79 | 79 | */ |
80 | - public function setWidgetId($id='') { |
|
80 | + public function setWidgetId($id = '') { |
|
81 | 81 | $this->widget_id = $id; |
82 | 82 | } |
83 | 83 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function getTruncatedColumnAlias($column_name) |
105 | 105 | { |
106 | - if(empty($column_name) || !is_string($column_name) || strlen($column_name) < 28) |
|
106 | + if (empty($column_name) || !is_string($column_name) || strlen($column_name) < 28) |
|
107 | 107 | { |
108 | 108 | return $column_name; |
109 | 109 | } |
110 | - return strtoupper(substr($column_name,0,22) . substr(md5(strtolower($column_name)), 0, 6)); |
|
110 | + return strtoupper(substr($column_name, 0, 22).substr(md5(strtolower($column_name)), 0, 6)); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | $vardef = $this->getVardef($layout_def); |
48 | 48 | |
49 | - if ( isset($vardef['precision']) ) { |
|
49 | + if (isset($vardef['precision'])) { |
|
50 | 50 | $precision = $vardef['precision']; |
51 | 51 | } else { |
52 | 52 | $precision = null; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | function queryFilterBetween(&$layout_def) |
82 | 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"; |
|
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 | 84 | } |
85 | 85 | |
86 | 86 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | function displayInput(&$layout_def) { |
47 | 47 | global $app_list_strings; |
48 | 48 | |
49 | - if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) { |
|
50 | - if ( is_array($layout_def['options']) ) { |
|
49 | + if (!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) { |
|
50 | + if (is_array($layout_def['options'])) { |
|
51 | 51 | $ops = $layout_def['options']; |
52 | 52 | } |
53 | - elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
|
53 | + elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])) { |
|
54 | 54 | $ops = $app_list_strings[$layout_def['options']]; |
55 | - if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
|
55 | + if (array_key_exists('', $app_list_strings[$layout_def['options']])) { |
|
56 | 56 | unset($ops['']); |
57 | 57 | } |
58 | 58 | } |
59 | - else{ |
|
59 | + else { |
|
60 | 60 | $ops = array(); |
61 | 61 | } |
62 | 62 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $ops = $app_list_strings[$layout_def['options']]; |
65 | 65 | } |
66 | 66 | |
67 | - $str = '<select name="' . $layout_def['name'] . '">'; |
|
67 | + $str = '<select name="'.$layout_def['name'].'">'; |
|
68 | 68 | $str .= get_select_options_with_id($ops, $layout_def['input_name0']); |
69 | 69 | $str .= '</select>'; |
70 | 70 | return $str; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | function getSubClass($layout_def) |
63 | 63 | { |
64 | - if (! empty($layout_def['type'])) |
|
64 | + if (!empty($layout_def['type'])) |
|
65 | 65 | { |
66 | 66 | |
67 | 67 | if ($layout_def['type'] == 'time') { |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | { |
81 | 81 | $obj = $this->getSubClass($layout_def); |
82 | 82 | |
83 | - $context = $this->layout_manager->getAttribute('context');//_ppd($context); |
|
83 | + $context = $this->layout_manager->getAttribute('context'); //_ppd($context); |
|
84 | 84 | $func_name = 'display'.$context; |
85 | 85 | |
86 | 86 | |
87 | - if ( ! empty($context) && method_exists($obj,$func_name)) |
|
87 | + if (!empty($context) && method_exists($obj, $func_name)) |
|
88 | 88 | { |
89 | 89 | return $obj->$func_name($layout_def); |
90 | 90 | } else |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | function _get_column_select_special($layout_def) |
97 | 97 | { |
98 | 98 | $alias = ''; |
99 | - if ( ! empty($layout_def['table_alias'])) |
|
99 | + if (!empty($layout_def['table_alias'])) |
|
100 | 100 | { |
101 | 101 | $alias = $layout_def['table_alias']; |
102 | 102 | } |
103 | 103 | |
104 | - if ($layout_def['name'] == 'weighted_sum' ) |
|
104 | + if ($layout_def['name'] == 'weighted_sum') |
|
105 | 105 | { |
106 | - return sprintf("SUM(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)), |
|
107 | - $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0))); |
|
106 | + return sprintf("SUM(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability", "IFNULL", array(0)), |
|
107 | + $this->reporter->db->convert("$alias.amount_usdollar", "IFNULL", array(0))); |
|
108 | 108 | } |
109 | - if ($layout_def['name'] == 'weighted_amount' ) |
|
109 | + if ($layout_def['name'] == 'weighted_amount') |
|
110 | 110 | { |
111 | - return sprintf("AVG(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)), |
|
112 | - $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0))); |
|
111 | + return sprintf("AVG(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability", "IFNULL", array(0)), |
|
112 | + $this->reporter->db->convert("$alias.amount_usdollar", "IFNULL", array(0))); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | $reportAlias = array(); |
121 | 121 | } |
122 | 122 | |
123 | - if ( ! empty($layout_def['table_alias'])) { |
|
123 | + if (!empty($layout_def['table_alias'])) { |
|
124 | 124 | $alias = $layout_def['table_alias'].".".$layout_def['name']; |
125 | - } else if (! empty($layout_def['name'])) { |
|
125 | + } else if (!empty($layout_def['name'])) { |
|
126 | 126 | $alias = $layout_def['name']; |
127 | 127 | } else { |
128 | 128 | $alias = "*"; |
129 | 129 | } |
130 | 130 | |
131 | - if ( ! empty($layout_def['group_function']) ) |
|
131 | + if (!empty($layout_def['group_function'])) |
|
132 | 132 | { |
133 | 133 | if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount') |
134 | 134 | { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if ($layout_def['group_function'] != 'avg') { |
154 | 154 | $alias = "{$layout_def['group_function']}($alias/{$query})*{$currency->conversion_rate}"; |
155 | 155 | } else { |
156 | - $alias = $this->reporter->db->convert("$alias/$query", "AVG") . " * {$currency->conversion_rate}"; |
|
156 | + $alias = $this->reporter->db->convert("$alias/$query", "AVG")." * {$currency->conversion_rate}"; |
|
157 | 157 | } |
158 | 158 | } else { |
159 | 159 | // We need to use convert() for AVG because of Oracle |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | function queryOrderBy($layout_def) |
185 | 185 | { |
186 | 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']]; |
|
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 | { |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | elseif (!empty($field_def['sort_on'])) |
194 | 194 | { |
195 | 195 | $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
196 | - if(!empty($field_def['sort_on2'])) |
|
197 | - $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2']; |
|
196 | + if (!empty($field_def['sort_on2'])) |
|
197 | + $order_by .= ', '.$layout_def['table_alias'].".".$field_def['sort_on2']; |
|
198 | 198 | } |
199 | 199 | else { |
200 | 200 | $order_by = $this->_get_column_alias($layout_def)." \n"; |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | //use sugar db function convert on order by string to convert to varchar. This is mainly for db's |
204 | 204 | //that do not allow sorting on clob/text fields |
205 | 205 | if ($this->reporter->db->isTextType($this->reporter->db->getFieldType($field_def))) { |
206 | - $order_by = $this->reporter->db->convert($order_by,'text2char', array(10000)); // array(10000) is for db2 only |
|
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') |
|
209 | + if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
|
210 | 210 | { |
211 | 211 | return $order_by." ASC"; |
212 | 212 | } else { |
@@ -223,27 +223,27 @@ discard block |
||
223 | 223 | |
224 | 224 | function displayHeaderCell($layout_def) |
225 | 225 | { |
226 | - global $start_link_wrapper,$end_link_wrapper; |
|
226 | + global $start_link_wrapper, $end_link_wrapper; |
|
227 | 227 | |
228 | 228 | |
229 | 229 | // don't show sort links if name isn't defined |
230 | 230 | $no_sort = $this->layout_manager->getAttribute('no_sort'); |
231 | - if(empty($layout_def['name']) || ! empty($no_sort) || ! empty($layout_def['no_sort'])) |
|
231 | + if (empty($layout_def['name']) || !empty($no_sort) || !empty($layout_def['no_sort'])) |
|
232 | 232 | { |
233 | 233 | return $layout_def['label']; |
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | - $sort_by =''; |
|
239 | - if ( ! empty($layout_def['table_key']) && ! empty($layout_def['name']) ) { |
|
240 | - if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') { |
|
238 | + $sort_by = ''; |
|
239 | + if (!empty($layout_def['table_key']) && !empty($layout_def['name'])) { |
|
240 | + if (!empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') { |
|
241 | 241 | $sort_by = $layout_def['table_key'].":".'count'; |
242 | 242 | } else { |
243 | 243 | $sort_by = $layout_def['table_key'].":".$layout_def['name']; |
244 | - if ( ! empty($layout_def['column_function'])) { |
|
244 | + if (!empty($layout_def['column_function'])) { |
|
245 | 245 | $sort_by .= ':'.$layout_def['column_function']; |
246 | - } else if ( ! empty($layout_def['group_function']) ) { |
|
246 | + } else if (!empty($layout_def['group_function'])) { |
|
247 | 247 | $sort_by .= ':'.$layout_def['group_function']; |
248 | 248 | } |
249 | 249 | } |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | return $this->displayHeaderCellPlain($layout_def); |
252 | 252 | } |
253 | 253 | |
254 | - $start = empty($start_link_wrapper) ? '': $start_link_wrapper; |
|
255 | - $end = empty($end_link_wrapper) ? '': $end_link_wrapper; |
|
254 | + $start = empty($start_link_wrapper) ? '' : $start_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 | |
259 | - if(!in_array($layout_def['name'], array('description', 'account_description', 'lead_source_description', 'status_description', 'to_addrs', 'cc_addrs', 'bcc_addrs', 'work_log', 'objective', 'resolution'))) { |
|
259 | + if (!in_array($layout_def['name'], array('description', 'account_description', 'lead_source_description', 'status_description', 'to_addrs', 'cc_addrs', 'bcc_addrs', 'work_log', 'objective', 'resolution'))) { |
|
260 | 260 | $header_cell = "<a class=\"listViewThLinkS1\" href=\"".$start.$sort_by.$end."\">"; |
261 | 261 | $header_cell .= $this->displayHeaderCellPlain($layout_def); |
262 | 262 | $objListView = new ListView(); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $context = $this->layout_manager->getAttribute('context'); |
277 | 277 | $func_name = 'query'.$context; |
278 | 278 | |
279 | - if ( ! empty($context) && method_exists($obj,$func_name)) |
|
279 | + if (!empty($context) && method_exists($obj, $func_name)) |
|
280 | 280 | { |
281 | 281 | return $obj->$func_name($layout_def); |
282 | 282 | } else |
@@ -296,44 +296,44 @@ discard block |
||
296 | 296 | |
297 | 297 | // Bug: 44605 |
298 | 298 | // this comment is being added to trigger the upgrade package |
299 | - if ( ! empty($layout_def['group_function']) && $layout_def['group_function']=='count') |
|
299 | + if (!empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') |
|
300 | 300 | { |
301 | - return $layout_def['table_alias'] . '__count'; |
|
301 | + return $layout_def['table_alias'].'__count'; |
|
302 | 302 | } |
303 | 303 | |
304 | - if ( ! empty($layout_def['table_alias'])) |
|
304 | + if (!empty($layout_def['table_alias'])) |
|
305 | 305 | { |
306 | - array_push($alias_arr,$layout_def['table_alias']); |
|
306 | + array_push($alias_arr, $layout_def['table_alias']); |
|
307 | 307 | } |
308 | 308 | |
309 | - if ( ! empty($layout_def['group_function']) && $layout_def['group_function'] != 'weighted_amount' && $layout_def['group_function'] != 'weighted_sum') |
|
309 | + if (!empty($layout_def['group_function']) && $layout_def['group_function'] != 'weighted_amount' && $layout_def['group_function'] != 'weighted_sum') |
|
310 | 310 | { |
311 | - array_push($alias_arr,$layout_def['group_function']); |
|
312 | - } else if ( ! empty($layout_def['column_function'])) |
|
311 | + array_push($alias_arr, $layout_def['group_function']); |
|
312 | + } else if (!empty($layout_def['column_function'])) |
|
313 | 313 | { |
314 | - array_push($alias_arr,$layout_def['column_function']); |
|
315 | - } else if ( ! empty($layout_def['qualifier'])) |
|
314 | + array_push($alias_arr, $layout_def['column_function']); |
|
315 | + } else if (!empty($layout_def['qualifier'])) |
|
316 | 316 | { |
317 | - array_push($alias_arr,$layout_def['qualifier']); |
|
317 | + array_push($alias_arr, $layout_def['qualifier']); |
|
318 | 318 | } |
319 | 319 | |
320 | - if ( ! empty($layout_def['name'])) |
|
320 | + if (!empty($layout_def['name'])) |
|
321 | 321 | { |
322 | - array_push($alias_arr,$layout_def['name']); |
|
322 | + array_push($alias_arr, $layout_def['name']); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | global $used_aliases, $alias_map; |
326 | 326 | |
327 | - $alias = strtolower(implode("_",$alias_arr)); |
|
327 | + $alias = strtolower(implode("_", $alias_arr)); |
|
328 | 328 | |
329 | 329 | $short_alias = $this->getTruncatedColumnAlias($alias); |
330 | 330 | |
331 | - if ( empty($used_aliases[$short_alias])) |
|
331 | + if (empty($used_aliases[$short_alias])) |
|
332 | 332 | { |
333 | 333 | $alias_map[$alias] = $short_alias; |
334 | 334 | $used_aliases[$short_alias] = 1; |
335 | 335 | return $short_alias; |
336 | - } else if ( ! empty($alias_map[$alias]) ) |
|
336 | + } else if (!empty($alias_map[$alias])) |
|
337 | 337 | { |
338 | 338 | return $alias_map[$alias]; |
339 | 339 | } else { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | /** @var $db DBManager */ |
365 | 365 | $db = $this->reporter->db; |
366 | 366 | $column = $this->_get_column_select($layout_def); |
367 | - return "(coalesce(" . $db->convert($column, "length") . ",0) > 0)\n"; |
|
367 | + return "(coalesce(".$db->convert($column, "length").",0) > 0)\n"; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | public function getWidgetId($buttonSuffix = true) |
48 | 48 | { |
49 | - return parent::getWidgetId() . '_select_button'; |
|
49 | + return parent::getWidgetId().'_select_button'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | function display($widget_data) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $this->title = $app_strings['LBL_SELECT_BUTTON_TITLE']; |
61 | 61 | $this->value = $app_strings['LBL_SELECT_BUTTON_LABEL']; |
62 | - $this->module = 'Campaigns';//'CampaignLog'; |
|
62 | + $this->module = 'Campaigns'; //'CampaignLog'; |
|
63 | 63 | $this->module_name = 'Campaigns'; |
64 | 64 | |
65 | 65 | |
@@ -68,52 +68,52 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | $focus = $widget_data['focus']; |
71 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
72 | - $button = ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
73 | - . ' title="' . $this->title . '"' |
|
74 | - . ' value="' . $this->value . "\"\n" |
|
71 | + if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) { |
|
72 | + $button = ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\n" |
|
73 | + . ' title="'.$this->title.'"' |
|
74 | + . ' value="'.$this->value."\"\n" |
|
75 | 75 | .' disabled />'; |
76 | 76 | return $button; |
77 | 77 | } |
78 | 78 | |
79 | 79 | //refresh the whole page after end of action? |
80 | 80 | $refresh_page = 0; |
81 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
81 | + if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) { |
|
82 | 82 | $refresh_page = 1; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $subpanel_definition = $widget_data['subpanel_definition']; |
86 | 86 | $button_definition = $subpanel_definition->get_buttons(); |
87 | - $subpanel_name = $this->module; //"Campaigns";//$subpanel_definition->get_module_name(); |
|
87 | + $subpanel_name = $this->module; //"Campaigns";//$subpanel_definition->get_module_name(); |
|
88 | 88 | if (empty($this->module_name)) { |
89 | 89 | $this->module_name = $subpanel_name; |
90 | 90 | } |
91 | 91 | $link_field_name = $subpanel_definition->get_data_source_name(true); |
92 | - $popup_mode='multiselect'; |
|
93 | - if(isset($widget_data['mode'])){ |
|
94 | - $popup_mode=$widget_data['mode']; |
|
92 | + $popup_mode = 'multiselect'; |
|
93 | + if (isset($widget_data['mode'])) { |
|
94 | + $popup_mode = $widget_data['mode']; |
|
95 | 95 | } |
96 | - if(isset($widget_data['initial_filter_fields'])){ |
|
96 | + if (isset($widget_data['initial_filter_fields'])) { |
|
97 | 97 | if (is_array($widget_data['initial_filter_fields'])) { |
98 | 98 | foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
99 | 99 | if (isset($focus->$value) and !empty($focus->$value)) { |
100 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
100 | + $initial_filter .= "&".$alias.'='.urlencode($focus->$value); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | - $create="true"; |
|
106 | - if(isset($widget_data['create'])){ |
|
107 | - $create=$widget_data['create']; |
|
105 | + $create = "true"; |
|
106 | + if (isset($widget_data['create'])) { |
|
107 | + $create = $widget_data['create']; |
|
108 | 108 | } |
109 | 109 | $return_module = $_REQUEST['module']; |
110 | 110 | $return_action = 'SubPanelViewer'; |
111 | 111 | $return_id = $_REQUEST['record']; |
112 | 112 | |
113 | 113 | //field_to_name_array |
114 | - $fton_array= array('id' => 'subpanel_id'); |
|
115 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
116 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
114 | + $fton_array = array('id' => 'subpanel_id'); |
|
115 | + if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) { |
|
116 | + $fton_array = array_merge($fton_array, $widget_data['field_to_name_array']); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | ); |
133 | 133 | |
134 | 134 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) { |
135 | - $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
135 | + $popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
139 | 139 | |
140 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
141 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
140 | + if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') { |
|
141 | + $initial_filter = "&module_name=".urlencode($widget_data['module']); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
145 | - return '<form action="index.php?module=CampaignLog&action=AddCampaignLog&type=contact">' . "\n" |
|
146 | - . ' <input type="button" name="' . $this->getWidgetId() . '_select_button" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
147 | - . ' title="' . $this->title . '"' |
|
148 | - . ' value="' . $this->value . "\"\n" |
|
145 | + return '<form action="index.php?module=CampaignLog&action=AddCampaignLog&type=contact">'."\n" |
|
146 | + . ' <input type="button" name="'.$this->getWidgetId().'_select_button" id="'.$this->getWidgetId().'" class="button"'."\n" |
|
147 | + . ' title="'.$this->title.'"' |
|
148 | + . ' value="'.$this->value."\"\n" |
|
149 | 149 | . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n"; |
150 | 150 | } |
151 | 151 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | public function queryFilterEmpty($layout_def) |
49 | 49 | { |
50 | 50 | $column = $this->_get_column_select($layout_def); |
51 | - return "(coalesce(" . $this->reporter->db->convert($column, "length") . ",0) = 0 OR $column = '^^')"; |
|
51 | + return "(coalesce(".$this->reporter->db->convert($column, "length").",0) = 0 OR $column = '^^')"; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function queryFilterNot_Empty($layout_def) |
55 | 55 | { |
56 | 56 | $column = $this->_get_column_select($layout_def); |
57 | - return "(coalesce(" . $this->reporter->db->convert($column, "length") . ",0) > 0 AND $column != '^^' )\n"; |
|
57 | + return "(coalesce(".$this->reporter->db->convert($column, "length").",0) > 0 AND $column != '^^' )\n"; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function queryFilteris($layout_def) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | public function queryFilterone_of($layout_def) { |
77 | - $arr = array (); |
|
77 | + $arr = array(); |
|
78 | 78 | foreach ($layout_def['input_name0'] as $value) { |
79 | 79 | $arr[] = $this->reporter->db->quoted($value); |
80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | public function queryFilternot_one_of($layout_def) { |
86 | - $arr = array (); |
|
86 | + $arr = array(); |
|
87 | 87 | foreach ($layout_def['input_name0'] as $value) { |
88 | 88 | $arr[] = $this->reporter->db->quoted($value); |
89 | 89 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | function & displayList($layout_def) { |
96 | - if(!empty($layout_def['column_key'])){ |
|
96 | + if (!empty($layout_def['column_key'])) { |
|
97 | 97 | $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
98 | - }else if(!empty($layout_def['fields'])){ |
|
98 | + } else if (!empty($layout_def['fields'])) { |
|
99 | 99 | $field_def = $layout_def['fields']; |
100 | 100 | } |
101 | 101 | $cell = $this->displayListPlain($layout_def); |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $record = $layout_def['fields'][$key]; |
115 | 115 | $field_name = $field_def['name']; |
116 | 116 | $field_type = $field_def['type']; |
117 | - $div_id = $field_def['module'] ."&$record&$field_name"; |
|
118 | - $str = "<div id='$div_id'>" . $cell . " " |
|
117 | + $div_id = $field_def['module']."&$record&$field_name"; |
|
118 | + $str = "<div id='$div_id'>".$cell." " |
|
119 | 119 | . SugarThemeRegistry::current()->getImage( |
120 | 120 | "edit_inline", |
121 | - "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(" . |
|
121 | + "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(". |
|
122 | 122 | "\"$div_id\",\"$cell\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'" |
123 | 123 | ) |
124 | 124 | . "</div>"; |
@@ -127,25 +127,25 @@ discard block |
||
127 | 127 | return $str; |
128 | 128 | } |
129 | 129 | function & displayListPlain($layout_def) { |
130 | - if(!empty($layout_def['column_key'])){ |
|
130 | + if (!empty($layout_def['column_key'])) { |
|
131 | 131 | $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
132 | - }else if(!empty($layout_def['fields'])){ |
|
132 | + } else if (!empty($layout_def['fields'])) { |
|
133 | 133 | $field_def = $layout_def['fields']; |
134 | 134 | } |
135 | 135 | |
136 | - if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){ |
|
136 | + if (!empty($layout_def['table_key']) && (empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))) { |
|
137 | 137 | $value = $this->_get_list_value($layout_def); |
138 | - }else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){ |
|
138 | + } else if (!empty($layout_def['name']) && !empty($layout_def['fields'])) { |
|
139 | 139 | $key = strtoupper($layout_def['name']); |
140 | 140 | $value = $layout_def['fields'][$key]; |
141 | 141 | } |
142 | 142 | $cell = ''; |
143 | 143 | |
144 | - if(isset($field_def['options'])){ |
|
144 | + if (isset($field_def['options'])) { |
|
145 | 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'])){ |
|
146 | + } else if (isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) { |
|
147 | 147 | global $beanFiles; |
148 | - if(empty($beanFiles)) { |
|
148 | + if (empty($beanFiles)) { |
|
149 | 149 | include('include/modules.php'); |
150 | 150 | } |
151 | 151 | $bean_name = get_singular_bean_name($field_def['module']); |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | |
158 | 158 | //#22632 |
159 | 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)); |
|
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 | 165 | } |
166 | 166 | } |
167 | - $cell = implode(", ",$cell); |
|
167 | + $cell = implode(", ", $cell); |
|
168 | 168 | } |
169 | 169 | return $cell; |
170 | 170 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | $order_by = $this->_get_column_select($layout_def); |
178 | 178 | } |
179 | 179 | $list = array(); |
180 | - if(isset($field_def['options'])) { |
|
180 | + if (isset($field_def['options'])) { |
|
181 | 181 | $list = translate($field_def['options'], $field_def['module']); |
182 | - } elseif(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) { |
|
182 | + } elseif (isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) { |
|
183 | 183 | global $beanFiles; |
184 | - if(empty($beanFiles)) { |
|
184 | + if (empty($beanFiles)) { |
|
185 | 185 | include('include/modules.php'); |
186 | 186 | } |
187 | 187 | $bean_name = get_singular_bean_name($field_def['module']); |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | public function displayInput($layout_def) { |
200 | 200 | global $app_list_strings; |
201 | 201 | |
202 | - if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) { |
|
203 | - if ( isset($layout_def['options']) && is_array($layout_def['options']) ) { |
|
202 | + if (!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) { |
|
203 | + if (isset($layout_def['options']) && is_array($layout_def['options'])) { |
|
204 | 204 | $ops = $layout_def['options']; |
205 | 205 | } |
206 | - elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
|
206 | + elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])) { |
|
207 | 207 | $ops = $app_list_strings[$layout_def['options']]; |
208 | - if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
|
208 | + if (array_key_exists('', $app_list_strings[$layout_def['options']])) { |
|
209 | 209 | unset($ops['']); |
210 | 210 | } |
211 | 211 | } |
212 | - else{ |
|
212 | + else { |
|
213 | 213 | $ops = array(); |
214 | 214 | } |
215 | 215 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $ops = $app_list_strings[$layout_def['options']]; |
218 | 218 | } |
219 | 219 | |
220 | - $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">'; |
|
220 | + $str = '<select multiple="true" size="3" name="'.$layout_def['name'].'[]">'; |
|
221 | 221 | $str .= get_select_options_with_id($ops, $layout_def['input_name0']); |
222 | 222 | $str .= '</select>'; |
223 | 223 | return $str; |