@@ -42,9 +42,9 @@ |
||
42 | 42 | |
43 | 43 | class SugarWidgetFieldDouble extends SugarWidgetFieldInt |
44 | 44 | { |
45 | - function SugarWidgetFieldDouble(&$layout_manager) { |
|
46 | - parent::SugarWidgetFieldInt($layout_manager); |
|
47 | - } |
|
45 | + function SugarWidgetFieldDouble(&$layout_manager) { |
|
46 | + parent::SugarWidgetFieldInt($layout_manager); |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | ?> |
@@ -1,5 +1,5 @@ |
||
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. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -45,83 +45,83 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelRemoveButtonProjects 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 | |
57 | - global $current_user; |
|
57 | + global $current_user; |
|
58 | 58 | |
59 | - $parent_record_id = $_REQUEST['record']; |
|
60 | - $parent_module = $_REQUEST['module']; |
|
59 | + $parent_record_id = $_REQUEST['record']; |
|
60 | + $parent_module = $_REQUEST['module']; |
|
61 | 61 | |
62 | - if ($layout_def['module'] == 'Holidays'){ |
|
63 | - $action = 'DeleteHolidayRelationship'; |
|
64 | - } |
|
65 | - else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts'){ |
|
66 | - $action = 'DeleteResourceRelationship'; |
|
67 | - } |
|
68 | - else{ |
|
69 | - $action = 'DeleteRelationship'; |
|
70 | - } |
|
62 | + if ($layout_def['module'] == 'Holidays'){ |
|
63 | + $action = 'DeleteHolidayRelationship'; |
|
64 | + } |
|
65 | + else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts'){ |
|
66 | + $action = 'DeleteResourceRelationship'; |
|
67 | + } |
|
68 | + else{ |
|
69 | + $action = 'DeleteRelationship'; |
|
70 | + } |
|
71 | 71 | |
72 | - $record = $layout_def['fields']['ID']; |
|
73 | - $current_module=$layout_def['module']; |
|
74 | - $hideremove=false; |
|
72 | + $record = $layout_def['fields']['ID']; |
|
73 | + $current_module=$layout_def['module']; |
|
74 | + $hideremove=false; |
|
75 | 75 | |
76 | - $return_module = $_REQUEST['module']; |
|
77 | - $return_action = 'SubPanelViewer'; |
|
78 | - $subpanel = $layout_def['subpanel_id']; |
|
79 | - $return_id = $_REQUEST['record']; |
|
76 | + $return_module = $_REQUEST['module']; |
|
77 | + $return_action = 'SubPanelViewer'; |
|
78 | + $subpanel = $layout_def['subpanel_id']; |
|
79 | + $return_id = $_REQUEST['record']; |
|
80 | 80 | |
81 | 81 | |
82 | - $focus = new Project(); |
|
82 | + $focus = new Project(); |
|
83 | 83 | |
84 | - $focus->retrieve($return_id); |
|
84 | + $focus->retrieve($return_id); |
|
85 | 85 | |
86 | - if ($current_user->id == $focus->assigned_user_id || is_admin($current_user)){ |
|
87 | - $is_owner = true; |
|
88 | - } |
|
89 | - else{ |
|
90 | - $is_owner = false; |
|
91 | - } |
|
86 | + if ($current_user->id == $focus->assigned_user_id || is_admin($current_user)){ |
|
87 | + $is_owner = true; |
|
88 | + } |
|
89 | + else{ |
|
90 | + $is_owner = false; |
|
91 | + } |
|
92 | 92 | |
93 | - if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
94 | - $linked_field= $layout_def['linked_field_set'] ; |
|
95 | - } else { |
|
96 | - $linked_field = $layout_def['linked_field']; |
|
97 | - } |
|
98 | - $refresh_page = 0; |
|
99 | - if(!empty($layout_def['refresh_page'])){ |
|
100 | - $refresh_page = 1; |
|
101 | - } |
|
102 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
|
93 | + if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
94 | + $linked_field= $layout_def['linked_field_set'] ; |
|
95 | + } else { |
|
96 | + $linked_field = $layout_def['linked_field']; |
|
97 | + } |
|
98 | + $refresh_page = 0; |
|
99 | + if(!empty($layout_def['refresh_page'])){ |
|
100 | + $refresh_page = 1; |
|
101 | + } |
|
102 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
|
103 | 103 | |
104 | - $icon_remove_text = strtolower($app_strings['LBL_ID_FF_REMOVE']); |
|
105 | - $icon_remove_html = SugarThemeRegistry::current()->getImage( 'delete_inline', 'align="absmiddle" border="0"',null,null,'.gif','');//setting alt to blank on purpose on subpanels for 508 |
|
106 | - $remove_url = $layout_def['start_link_wrapper'] |
|
107 | - . "index.php?module=$parent_module" |
|
108 | - . "&action=$action" |
|
109 | - . "&record=$parent_record_id" |
|
110 | - . "&linked_field=$linked_field" |
|
111 | - . "&linked_id=$record" |
|
112 | - . "&return_url=" . urlencode(urlencode($return_url)) |
|
113 | - . "&refresh_page=1" |
|
114 | - . $layout_def['end_link_wrapper']; |
|
115 | - $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
|
116 | - //based on listview since that lets you select records |
|
117 | - if($layout_def['ListView'] && !$hideremove && $is_owner) { |
|
118 | - return '<a href="' . $remove_url . '"' |
|
119 | - . ' class="listViewTdToolsS1"' |
|
120 | - . " onclick=\"return confirm('$remove_confirmation_text');\"" |
|
121 | - . ">$icon_remove_html $icon_remove_text</a>"; |
|
122 | - }else{ |
|
123 | - return ''; |
|
124 | - } |
|
125 | - } |
|
104 | + $icon_remove_text = strtolower($app_strings['LBL_ID_FF_REMOVE']); |
|
105 | + $icon_remove_html = SugarThemeRegistry::current()->getImage( 'delete_inline', 'align="absmiddle" border="0"',null,null,'.gif','');//setting alt to blank on purpose on subpanels for 508 |
|
106 | + $remove_url = $layout_def['start_link_wrapper'] |
|
107 | + . "index.php?module=$parent_module" |
|
108 | + . "&action=$action" |
|
109 | + . "&record=$parent_record_id" |
|
110 | + . "&linked_field=$linked_field" |
|
111 | + . "&linked_id=$record" |
|
112 | + . "&return_url=" . urlencode(urlencode($return_url)) |
|
113 | + . "&refresh_page=1" |
|
114 | + . $layout_def['end_link_wrapper']; |
|
115 | + $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
|
116 | + //based on listview since that lets you select records |
|
117 | + if($layout_def['ListView'] && !$hideremove && $is_owner) { |
|
118 | + return '<a href="' . $remove_url . '"' |
|
119 | + . ' class="listViewTdToolsS1"' |
|
120 | + . " onclick=\"return confirm('$remove_confirmation_text');\"" |
|
121 | + . ">$icon_remove_html $icon_remove_text</a>"; |
|
122 | + }else{ |
|
123 | + return ''; |
|
124 | + } |
|
125 | + } |
|
126 | 126 | } |
127 | 127 | ?> |
128 | 128 | \ No newline at end of file |
@@ -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. |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | $parent_record_id = $_REQUEST['record']; |
60 | 60 | $parent_module = $_REQUEST['module']; |
61 | 61 | |
62 | - if ($layout_def['module'] == 'Holidays'){ |
|
62 | + if ($layout_def['module'] == 'Holidays') { |
|
63 | 63 | $action = 'DeleteHolidayRelationship'; |
64 | 64 | } |
65 | - else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts'){ |
|
65 | + else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts') { |
|
66 | 66 | $action = 'DeleteResourceRelationship'; |
67 | 67 | } |
68 | - else{ |
|
68 | + else { |
|
69 | 69 | $action = 'DeleteRelationship'; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $record = $layout_def['fields']['ID']; |
73 | - $current_module=$layout_def['module']; |
|
74 | - $hideremove=false; |
|
73 | + $current_module = $layout_def['module']; |
|
74 | + $hideremove = false; |
|
75 | 75 | |
76 | 76 | $return_module = $_REQUEST['module']; |
77 | 77 | $return_action = 'SubPanelViewer'; |
@@ -83,43 +83,43 @@ discard block |
||
83 | 83 | |
84 | 84 | $focus->retrieve($return_id); |
85 | 85 | |
86 | - if ($current_user->id == $focus->assigned_user_id || is_admin($current_user)){ |
|
86 | + if ($current_user->id == $focus->assigned_user_id || is_admin($current_user)) { |
|
87 | 87 | $is_owner = true; |
88 | 88 | } |
89 | - else{ |
|
89 | + else { |
|
90 | 90 | $is_owner = false; |
91 | 91 | } |
92 | 92 | |
93 | 93 | if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
94 | - $linked_field= $layout_def['linked_field_set'] ; |
|
94 | + $linked_field = $layout_def['linked_field_set']; |
|
95 | 95 | } else { |
96 | 96 | $linked_field = $layout_def['linked_field']; |
97 | 97 | } |
98 | 98 | $refresh_page = 0; |
99 | - if(!empty($layout_def['refresh_page'])){ |
|
99 | + if (!empty($layout_def['refresh_page'])) { |
|
100 | 100 | $refresh_page = 1; |
101 | 101 | } |
102 | 102 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
103 | 103 | |
104 | 104 | $icon_remove_text = strtolower($app_strings['LBL_ID_FF_REMOVE']); |
105 | - $icon_remove_html = SugarThemeRegistry::current()->getImage( 'delete_inline', 'align="absmiddle" border="0"',null,null,'.gif','');//setting alt to blank on purpose on subpanels for 508 |
|
105 | + $icon_remove_html = SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', ''); //setting alt to blank on purpose on subpanels for 508 |
|
106 | 106 | $remove_url = $layout_def['start_link_wrapper'] |
107 | 107 | . "index.php?module=$parent_module" |
108 | 108 | . "&action=$action" |
109 | 109 | . "&record=$parent_record_id" |
110 | 110 | . "&linked_field=$linked_field" |
111 | 111 | . "&linked_id=$record" |
112 | - . "&return_url=" . urlencode(urlencode($return_url)) |
|
112 | + . "&return_url=".urlencode(urlencode($return_url)) |
|
113 | 113 | . "&refresh_page=1" |
114 | 114 | . $layout_def['end_link_wrapper']; |
115 | 115 | $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
116 | 116 | //based on listview since that lets you select records |
117 | - if($layout_def['ListView'] && !$hideremove && $is_owner) { |
|
118 | - return '<a href="' . $remove_url . '"' |
|
117 | + if ($layout_def['ListView'] && !$hideremove && $is_owner) { |
|
118 | + return '<a href="'.$remove_url.'"' |
|
119 | 119 | . ' class="listViewTdToolsS1"' |
120 | 120 | . " onclick=\"return confirm('$remove_confirmation_text');\"" |
121 | 121 | . ">$icon_remove_html $icon_remove_text</a>"; |
122 | - }else{ |
|
122 | + } else { |
|
123 | 123 | return ''; |
124 | 124 | } |
125 | 125 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -61,11 +63,9 @@ discard block |
||
61 | 63 | |
62 | 64 | if ($layout_def['module'] == 'Holidays'){ |
63 | 65 | $action = 'DeleteHolidayRelationship'; |
64 | - } |
|
65 | - else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts'){ |
|
66 | + } else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts'){ |
|
66 | 67 | $action = 'DeleteResourceRelationship'; |
67 | - } |
|
68 | - else{ |
|
68 | + } else{ |
|
69 | 69 | $action = 'DeleteRelationship'; |
70 | 70 | } |
71 | 71 | |
@@ -85,8 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | if ($current_user->id == $focus->assigned_user_id || is_admin($current_user)){ |
87 | 87 | $is_owner = true; |
88 | - } |
|
89 | - else{ |
|
88 | + } else{ |
|
90 | 89 | $is_owner = false; |
91 | 90 | } |
92 | 91 | |
@@ -119,7 +118,7 @@ discard block |
||
119 | 118 | . ' class="listViewTdToolsS1"' |
120 | 119 | . " onclick=\"return confirm('$remove_confirmation_text');\"" |
121 | 120 | . ">$icon_remove_html $icon_remove_text</a>"; |
122 | - }else{ |
|
121 | + } else{ |
|
123 | 122 | return ''; |
124 | 123 | } |
125 | 124 | } |
@@ -41,26 +41,26 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | class SugarWidgetFieldMultiEnum extends SugarWidgetFieldEnum { |
44 | - public function queryFilternot_one_of(&$layout_def) { |
|
45 | - $arr = array (); |
|
46 | - foreach ($layout_def['input_name0'] as $value) { |
|
47 | - array_push($arr, "'".$GLOBALS['db']->quote($value)."'"); |
|
48 | - } |
|
49 | - $reporter = $this->layout_manager->getAttribute("reporter"); |
|
44 | + public function queryFilternot_one_of(&$layout_def) { |
|
45 | + $arr = array (); |
|
46 | + foreach ($layout_def['input_name0'] as $value) { |
|
47 | + array_push($arr, "'".$GLOBALS['db']->quote($value)."'"); |
|
48 | + } |
|
49 | + $reporter = $this->layout_manager->getAttribute("reporter"); |
|
50 | 50 | |
51 | - $col_name = $this->_get_column_select($layout_def) . " NOT LIKE " ; |
|
52 | - $arr_count = count($arr); |
|
53 | - $query = ""; |
|
54 | - foreach($arr as $key=>$val) { |
|
55 | - $query .= $col_name; |
|
56 | - $value = preg_replace("/^'/", "'%", $val, 1); |
|
57 | - $value = preg_replace("/'$/", "%'", $value, 1); |
|
58 | - $query .= $value; |
|
59 | - if ($key != ($arr_count - 1)) |
|
60 | - $query.= " OR " ; |
|
61 | - } |
|
62 | - return '('.$query.')'; |
|
63 | - } |
|
51 | + $col_name = $this->_get_column_select($layout_def) . " NOT LIKE " ; |
|
52 | + $arr_count = count($arr); |
|
53 | + $query = ""; |
|
54 | + foreach($arr as $key=>$val) { |
|
55 | + $query .= $col_name; |
|
56 | + $value = preg_replace("/^'/", "'%", $val, 1); |
|
57 | + $value = preg_replace("/'$/", "%'", $value, 1); |
|
58 | + $query .= $value; |
|
59 | + if ($key != ($arr_count - 1)) |
|
60 | + $query.= " OR " ; |
|
61 | + } |
|
62 | + return '('.$query.')'; |
|
63 | + } |
|
64 | 64 | |
65 | 65 | public function queryFilterone_of(&$layout_def) { |
66 | 66 | //Fix for inaccurate filtering of contacts in Contacts dashlet on multiselects. |
@@ -72,47 +72,47 @@ discard block |
||
72 | 72 | array_push($arr, "'^^'"); |
73 | 73 | } |
74 | 74 | } |
75 | - $reporter = $this->layout_manager->getAttribute("reporter"); |
|
75 | + $reporter = $this->layout_manager->getAttribute("reporter"); |
|
76 | 76 | |
77 | - $col_name = $this->_get_column_select($layout_def) . " LIKE " ; |
|
78 | - $arr_count = count($arr); |
|
79 | - $query = ""; |
|
80 | - foreach($arr as $key=>$val) { |
|
81 | - $query .= $col_name; |
|
82 | - $value = preg_replace("/^'/", "'%", $val, 1); |
|
83 | - $value = preg_replace("/'$/", "%'", $value, 1); |
|
84 | - $query .= $value; |
|
85 | - if ($key != ($arr_count - 1)) |
|
86 | - $query.= " OR " ; |
|
87 | - } |
|
88 | - return '('.$query.')'; |
|
89 | - } |
|
77 | + $col_name = $this->_get_column_select($layout_def) . " LIKE " ; |
|
78 | + $arr_count = count($arr); |
|
79 | + $query = ""; |
|
80 | + foreach($arr as $key=>$val) { |
|
81 | + $query .= $col_name; |
|
82 | + $value = preg_replace("/^'/", "'%", $val, 1); |
|
83 | + $value = preg_replace("/'$/", "%'", $value, 1); |
|
84 | + $query .= $value; |
|
85 | + if ($key != ($arr_count - 1)) |
|
86 | + $query.= " OR " ; |
|
87 | + } |
|
88 | + return '('.$query.')'; |
|
89 | + } |
|
90 | 90 | |
91 | - public function queryFilteris($layout_def) { |
|
92 | - $input_name0 = $layout_def['input_name0']; |
|
93 | - if (is_array($layout_def['input_name0'])) { |
|
94 | - $input_name0 = $layout_def['input_name0'][0]; |
|
95 | - } |
|
91 | + public function queryFilteris($layout_def) { |
|
92 | + $input_name0 = $layout_def['input_name0']; |
|
93 | + if (is_array($layout_def['input_name0'])) { |
|
94 | + $input_name0 = $layout_def['input_name0'][0]; |
|
95 | + } |
|
96 | 96 | |
97 | - // Bug 40022 |
|
98 | - // IS filter doesn't add the carets (^) to multienum custom field values |
|
99 | - $input_name0 = $this->encodeMultienumCustom($layout_def, $input_name0); |
|
97 | + // Bug 40022 |
|
98 | + // IS filter doesn't add the carets (^) to multienum custom field values |
|
99 | + $input_name0 = $this->encodeMultienumCustom($layout_def, $input_name0); |
|
100 | 100 | |
101 | - return $this->_get_column_select($layout_def)." = ".$this->reporter->db->quoted($input_name0)."\n"; |
|
102 | - } |
|
101 | + return $this->_get_column_select($layout_def)." = ".$this->reporter->db->quoted($input_name0)."\n"; |
|
102 | + } |
|
103 | 103 | |
104 | - public function queryFilteris_not($layout_def) { |
|
105 | - $input_name0 = $layout_def['input_name0']; |
|
106 | - if (is_array($layout_def['input_name0'])) { |
|
107 | - $input_name0 = $layout_def['input_name0'][0]; |
|
108 | - } |
|
104 | + public function queryFilteris_not($layout_def) { |
|
105 | + $input_name0 = $layout_def['input_name0']; |
|
106 | + if (is_array($layout_def['input_name0'])) { |
|
107 | + $input_name0 = $layout_def['input_name0'][0]; |
|
108 | + } |
|
109 | 109 | |
110 | - // Bug 50549 |
|
111 | - // IS NOT filter doesn't add the carets (^) to multienum custom field values |
|
112 | - $input_name0 = $this->encodeMultienumCustom($layout_def, $input_name0); |
|
110 | + // Bug 50549 |
|
111 | + // IS NOT filter doesn't add the carets (^) to multienum custom field values |
|
112 | + $input_name0 = $this->encodeMultienumCustom($layout_def, $input_name0); |
|
113 | 113 | |
114 | - return $this->_get_column_select($layout_def)." <> ".$this->reporter->db->quoted($input_name0)."\n"; |
|
115 | - } |
|
114 | + return $this->_get_column_select($layout_def)." <> ".$this->reporter->db->quoted($input_name0)."\n"; |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Returns an OrderBy query for multi-select. We treat multi-select the same as a normal field because |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | * @return string |
132 | 132 | */ |
133 | 133 | private function encodeMultienumCustom($layout_def, $value) { |
134 | - $field_def = $this->reporter->getFieldDefFromLayoutDef($layout_def); |
|
135 | - // Check if it is a custom field |
|
136 | - if (!empty($field_def['source']) && ($field_def['source'] == 'custom_fields' || ($field_def['source'] == 'non-db' && !empty($field_def['ext2']) && !empty($field_def['id']))) && !empty($field_def['real_table'])) |
|
137 | - { |
|
138 | - $value = encodeMultienumValue(array($value)); |
|
139 | - } |
|
140 | - return $value; |
|
134 | + $field_def = $this->reporter->getFieldDefFromLayoutDef($layout_def); |
|
135 | + // Check if it is a custom field |
|
136 | + if (!empty($field_def['source']) && ($field_def['source'] == 'custom_fields' || ($field_def['source'] == 'non-db' && !empty($field_def['ext2']) && !empty($field_def['id']))) && !empty($field_def['real_table'])) |
|
137 | + { |
|
138 | + $value = encodeMultienumValue(array($value)); |
|
139 | + } |
|
140 | + return $value; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | ?> |
@@ -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,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -56,8 +58,9 @@ discard block |
||
56 | 58 | $value = preg_replace("/^'/", "'%", $val, 1); |
57 | 59 | $value = preg_replace("/'$/", "%'", $value, 1); |
58 | 60 | $query .= $value; |
59 | - if ($key != ($arr_count - 1)) |
|
60 | - $query.= " OR " ; |
|
61 | + if ($key != ($arr_count - 1)) { |
|
62 | + $query.= " OR " ; |
|
63 | + } |
|
61 | 64 | } |
62 | 65 | return '('.$query.')'; |
63 | 66 | } |
@@ -68,7 +71,7 @@ discard block |
||
68 | 71 | foreach ($layout_def['input_name0'] as $value) { |
69 | 72 | if($value != ""){ |
70 | 73 | array_push($arr, "'".$GLOBALS['db']->quote($value)."'"); |
71 | - }else{ |
|
74 | + } else{ |
|
72 | 75 | array_push($arr, "'^^'"); |
73 | 76 | } |
74 | 77 | } |
@@ -82,8 +85,9 @@ discard block |
||
82 | 85 | $value = preg_replace("/^'/", "'%", $val, 1); |
83 | 86 | $value = preg_replace("/'$/", "%'", $value, 1); |
84 | 87 | $query .= $value; |
85 | - if ($key != ($arr_count - 1)) |
|
86 | - $query.= " OR " ; |
|
88 | + if ($key != ($arr_count - 1)) { |
|
89 | + $query.= " OR " ; |
|
90 | + } |
|
87 | 91 | } |
88 | 92 | return '('.$query.')'; |
89 | 93 | } |
@@ -41,53 +41,53 @@ |
||
41 | 41 | |
42 | 42 | class SugarWidgetFieldVarchar extends SugarWidgetReportField |
43 | 43 | { |
44 | - function SugarWidgetFieldVarchar(&$layout_manager) |
|
45 | - { |
|
44 | + function SugarWidgetFieldVarchar(&$layout_manager) |
|
45 | + { |
|
46 | 46 | parent::SugarWidgetReportField($layout_manager); |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - function queryFilterEquals(&$layout_def) |
|
50 | - { |
|
51 | - return $this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
|
52 | - } |
|
49 | + function queryFilterEquals(&$layout_def) |
|
50 | + { |
|
51 | + return $this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
|
52 | + } |
|
53 | 53 | |
54 | - function queryFilterNot_Equals_Str(&$layout_def) |
|
55 | - { |
|
56 | - return $this->_get_column_select($layout_def)."!='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
|
57 | - } |
|
54 | + function queryFilterNot_Equals_Str(&$layout_def) |
|
55 | + { |
|
56 | + return $this->_get_column_select($layout_def)."!='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
|
57 | + } |
|
58 | 58 | |
59 | - function queryFilterContains(&$layout_def) |
|
60 | - { |
|
61 | - return $this->_get_column_select($layout_def)." LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n"; |
|
62 | - } |
|
63 | - function queryFilterdoes_not_contain(&$layout_def) |
|
64 | - { |
|
65 | - return $this->_get_column_select($layout_def)." NOT LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n"; |
|
66 | - } |
|
59 | + function queryFilterContains(&$layout_def) |
|
60 | + { |
|
61 | + return $this->_get_column_select($layout_def)." LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n"; |
|
62 | + } |
|
63 | + function queryFilterdoes_not_contain(&$layout_def) |
|
64 | + { |
|
65 | + return $this->_get_column_select($layout_def)." NOT LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n"; |
|
66 | + } |
|
67 | 67 | |
68 | - function queryFilterStarts_With(&$layout_def) |
|
69 | - { |
|
70 | - return $this->_get_column_select($layout_def)." LIKE '".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n"; |
|
71 | - } |
|
68 | + function queryFilterStarts_With(&$layout_def) |
|
69 | + { |
|
70 | + return $this->_get_column_select($layout_def)." LIKE '".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n"; |
|
71 | + } |
|
72 | 72 | |
73 | - function queryFilterEnds_With(&$layout_def) |
|
74 | - { |
|
75 | - return $this->_get_column_select($layout_def)." LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
|
76 | - } |
|
73 | + function queryFilterEnds_With(&$layout_def) |
|
74 | + { |
|
75 | + return $this->_get_column_select($layout_def)." LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
|
76 | + } |
|
77 | 77 | |
78 | - function queryFilterone_of(&$layout_def) |
|
79 | - { |
|
78 | + function queryFilterone_of(&$layout_def) |
|
79 | + { |
|
80 | 80 | foreach($layout_def['input_name0'] as $key => $value) { |
81 | 81 | $layout_def['input_name0'][$key] = $GLOBALS['db']->quote($value); |
82 | 82 | } |
83 | 83 | return $this->_get_column_select($layout_def) . " IN ('" . implode("','", $layout_def['input_name0']) . "')\n"; |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - function displayInput(&$layout_def) |
|
87 | - { |
|
88 | - $str = '<input type="text" size="20" value="' . $layout_def['input_name0'] . '" name="' . $layout_def['name'] . '">'; |
|
89 | - return $str; |
|
90 | - } |
|
86 | + function displayInput(&$layout_def) |
|
87 | + { |
|
88 | + $str = '<input type="text" size="20" value="' . $layout_def['input_name0'] . '" name="' . $layout_def['name'] . '">'; |
|
89 | + return $str; |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | ?> |
@@ -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,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -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 | { |
@@ -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,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -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 |
@@ -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,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * getSubpanelWidgetId |
68 | 68 | * This is a utility function to return a widget's unique id |
69 | - * @return id String label of the widget's unique id |
|
69 | + * @return string String label of the widget's unique id |
|
70 | 70 | */ |
71 | 71 | public function getWidgetId() { |
72 | 72 | return $this->widget_id; |
@@ -100,6 +100,7 @@ discard block |
||
100 | 100 | * argument exceed 28 charcters, it creates an alias using the first 22 characters of the column_name |
101 | 101 | * plus an md5 of the first 6 characters of the lowercased column_name value. |
102 | 102 | * |
103 | + * @param string $column_name |
|
103 | 104 | */ |
104 | 105 | protected function getTruncatedColumnAlias($column_name) |
105 | 106 | { |
@@ -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 | } |
@@ -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,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -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 { |
@@ -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,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -49,18 +51,15 @@ discard block |
||
49 | 51 | if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) { |
50 | 52 | if ( is_array($layout_def['options']) ) { |
51 | 53 | $ops = $layout_def['options']; |
52 | - } |
|
53 | - elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
|
54 | + } elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
|
54 | 55 | $ops = $app_list_strings[$layout_def['options']]; |
55 | 56 | if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
56 | 57 | unset($ops['']); |
57 | 58 | } |
58 | - } |
|
59 | - else{ |
|
59 | + } else{ |
|
60 | 60 | $ops = array(); |
61 | 61 | } |
62 | - } |
|
63 | - else { |
|
62 | + } else { |
|
64 | 63 | $ops = $app_list_strings[$layout_def['options']]; |
65 | 64 | } |
66 | 65 |
@@ -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 | } |
@@ -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,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -184,19 +186,20 @@ discard block |
||
184 | 186 | function queryOrderBy($layout_def) |
185 | 187 | { |
186 | 188 | $field_def = array(); |
187 | - if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
189 | + if(!empty($this->reporter->all_fields[$layout_def['column_key']])) { |
|
190 | + $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
191 | + } |
|
188 | 192 | |
189 | 193 | if (!empty($layout_def['group_function'])) |
190 | 194 | { |
191 | 195 | $order_by = $this->_get_column_alias($layout_def); |
192 | - } |
|
193 | - elseif (!empty($field_def['sort_on'])) |
|
196 | + } elseif (!empty($field_def['sort_on'])) |
|
194 | 197 | { |
195 | 198 | $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']; |
|
198 | - } |
|
199 | - else { |
|
199 | + if(!empty($field_def['sort_on2'])) { |
|
200 | + $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2']; |
|
201 | + } |
|
202 | + } else { |
|
200 | 203 | $order_by = $this->_get_column_alias($layout_def)." \n"; |
201 | 204 | } |
202 | 205 |
@@ -285,6 +285,9 @@ |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | + /** |
|
289 | + * @return string |
|
290 | + */ |
|
288 | 291 | function _get_column_alias($layout_def) |
289 | 292 | { |
290 | 293 | $alias_arr = array(); |