@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } else { |
238 | 238 | $header_URL = "Location: {$redirect_url}"; |
239 | 239 | |
240 | - if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
240 | + if (preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
241 | 241 | $href = $matches[1]; |
242 | 242 | SugarApplication::redirect($href); |
243 | 243 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } else { |
274 | 274 | $header_URL = "Location: {$_POST['redirect']}"; |
275 | 275 | |
276 | - if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
276 | + if (preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
277 | 277 | $href = $matches[1]; |
278 | 278 | SugarApplication::redirect($href); |
279 | 279 | } |
@@ -240,8 +240,7 @@ discard block |
||
240 | 240 | if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
241 | 241 | $href = $matches[1]; |
242 | 242 | SugarApplication::redirect($href); |
243 | - } |
|
244 | - else { |
|
243 | + } else { |
|
245 | 244 | header($header_URL); |
246 | 245 | } |
247 | 246 | |
@@ -276,8 +275,7 @@ discard block |
||
276 | 275 | if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
277 | 276 | $href = $matches[1]; |
278 | 277 | SugarApplication::redirect($href); |
279 | - } |
|
280 | - else { |
|
278 | + } else { |
|
281 | 279 | header($header_URL); |
282 | 280 | } |
283 | 281 |
@@ -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,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | function getTemplateValidationMessages($templateId) { |
44 | 44 | $msgs = array(); |
45 | - if(!$templateId) { |
|
45 | + if (!$templateId) { |
|
46 | 46 | $msgs[] = 'LBL_NO_SELECTED_TEMPLATE'; |
47 | 47 | } |
48 | 48 | else { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $campaignId = $db->quote($_POST['campaignId']); |
65 | 65 | $marketingId = $db->quote($_POST['marketingId']); |
66 | 66 | $func = isset($_REQUEST['func']) ? $_REQUEST['func'] : null; |
67 | -if($func == 'getTemplateValidation') { |
|
67 | +if ($func == 'getTemplateValidation') { |
|
68 | 68 | if (!empty($_POST['templateId'])) { |
69 | 69 | $templateId = $db->quote($_POST['templateId']); |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (!$marketingId) { |
89 | 89 | if (!empty($_SESSION['campaignWizard'][$campaignId]['defaultSelectedMarketingId']) && $func != 'createEmailMarketing') { |
90 | 90 | $marketingId = $_SESSION['campaignWizard'][$campaignId]['defaultSelectedMarketingId']; |
91 | - } else if($func != 'createEmailMarketing') { |
|
91 | + } else if ($func != 'createEmailMarketing') { |
|
92 | 92 | $marketing = new EmailMarketing(); |
93 | 93 | $marketing->save(); |
94 | 94 | $marketingId = $marketing->id; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if (!empty($_POST['templateId'])) { |
108 | 108 | $marketing->template_id = $templateId; |
109 | 109 | } |
110 | - if($func != 'createEmailMarketing') { |
|
110 | + if ($func != 'createEmailMarketing') { |
|
111 | 111 | $marketing->save(); |
112 | 112 | } |
113 | 113 |
@@ -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. |
@@ -44,8 +46,7 @@ discard block |
||
44 | 46 | $msgs = array(); |
45 | 47 | if(!$templateId) { |
46 | 48 | $msgs[] = 'LBL_NO_SELECTED_TEMPLATE'; |
47 | - } |
|
48 | - else { |
|
49 | + } else { |
|
49 | 50 | $template = new EmailTemplate(); |
50 | 51 | $template->retrieve($templateId); |
51 | 52 | if (!$template->subject) { |
@@ -67,8 +68,7 @@ discard block |
||
67 | 68 | if($func == 'getTemplateValidation') { |
68 | 69 | if (!empty($_POST['templateId'])) { |
69 | 70 | $templateId = $db->quote($_POST['templateId']); |
70 | - } |
|
71 | - else { |
|
71 | + } else { |
|
72 | 72 | if (!$marketingId) { |
73 | 73 | if (!empty($_SESSION['campaignWizard'][$campaignId]['defaultSelectedMarketingId']) && $func != 'createEmailMarketing') { |
74 | 74 | $marketingId = $_SESSION['campaignWizard'][$campaignId]['defaultSelectedMarketingId']; |
@@ -83,8 +83,7 @@ discard block |
||
83 | 83 | $return['marketingValidationMessages'] = $marketing->validate(); |
84 | 84 | |
85 | 85 | echo json_encode($return); |
86 | -} |
|
87 | -else { |
|
86 | +} else { |
|
88 | 87 | if (!$marketingId) { |
89 | 88 | if (!empty($_SESSION['campaignWizard'][$campaignId]['defaultSelectedMarketingId']) && $func != 'createEmailMarketing') { |
90 | 89 | $marketingId = $_SESSION['campaignWizard'][$campaignId]['defaultSelectedMarketingId']; |
@@ -108,23 +108,23 @@ |
||
108 | 108 | $json = getJSONobj(); |
109 | 109 | // Users Popup |
110 | 110 | $popup_request_data = array( |
111 | - 'call_back_function' => 'set_return', |
|
112 | - 'form_name' => 'WebToLeadCreation', |
|
113 | - 'field_to_name_array' => array( |
|
114 | - 'id' => 'assigned_user_id', |
|
115 | - 'user_name' => 'assigned_user_name', |
|
116 | - ), |
|
117 | - ); |
|
111 | + 'call_back_function' => 'set_return', |
|
112 | + 'form_name' => 'WebToLeadCreation', |
|
113 | + 'field_to_name_array' => array( |
|
114 | + 'id' => 'assigned_user_id', |
|
115 | + 'user_name' => 'assigned_user_name', |
|
116 | + ), |
|
117 | + ); |
|
118 | 118 | $xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data)); |
119 | 119 | |
120 | 120 | //Campaigns popup |
121 | 121 | $popup_request_data = array( |
122 | - 'call_back_function' => 'set_return', |
|
123 | - 'form_name' => 'WebToLeadCreation', |
|
124 | - 'field_to_name_array' => array( |
|
125 | - 'id' => 'campaign_id', |
|
126 | - 'name' => 'campaign_name', |
|
127 | - ), |
|
122 | + 'call_back_function' => 'set_return', |
|
123 | + 'form_name' => 'WebToLeadCreation', |
|
124 | + 'field_to_name_array' => array( |
|
125 | + 'id' => 'campaign_id', |
|
126 | + 'name' => 'campaign_name', |
|
127 | + ), |
|
128 | 128 | ); |
129 | 129 | $encoded_users_popup_request_data = $json->encode($popup_request_data); |
130 | 130 | $xtpl->assign('encoded_campaigns_popup_request_data' , $json->encode($popup_request_data)); |
@@ -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. |
@@ -51,28 +51,28 @@ discard block |
||
51 | 51 | |
52 | 52 | require_once('modules/Campaigns/utils.php'); |
53 | 53 | |
54 | -global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map,$import_file_name, $theme; |
|
54 | +global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map, $import_file_name, $theme; |
|
55 | 55 | |
56 | -$xtpl=new XTemplate ('modules/Campaigns/WebToLeadCreation.html'); |
|
56 | +$xtpl = new XTemplate('modules/Campaigns/WebToLeadCreation.html'); |
|
57 | 57 | $xtpl->assign("MOD", $mod_strings); |
58 | 58 | $xtpl->assign("APP", $app_strings); |
59 | -if(isset($_REQUEST['module'])) |
|
59 | +if (isset($_REQUEST['module'])) |
|
60 | 60 | { |
61 | 61 | $xtpl->assign("MODULE", $_REQUEST['module']); |
62 | 62 | } |
63 | -if(isset($_REQUEST['return_module'])) |
|
63 | +if (isset($_REQUEST['return_module'])) |
|
64 | 64 | { |
65 | 65 | $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']); |
66 | 66 | } |
67 | -if(isset($_REQUEST['return_id'])) |
|
67 | +if (isset($_REQUEST['return_id'])) |
|
68 | 68 | { |
69 | 69 | $xtpl->assign("RETURN_ID", $_REQUEST['return_id']); |
70 | 70 | } |
71 | -if(isset($_REQUEST['return_id'])) |
|
71 | +if (isset($_REQUEST['return_id'])) |
|
72 | 72 | { |
73 | 73 | $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']); |
74 | 74 | } |
75 | -if(isset($_REQUEST['record'])) |
|
75 | +if (isset($_REQUEST['record'])) |
|
76 | 76 | { |
77 | 77 | $xtpl->assign("RECORD", $_REQUEST['record']); |
78 | 78 | } |
@@ -86,21 +86,21 @@ discard block |
||
86 | 86 | |
87 | 87 | $beanList = filterFieldsFromBeans($subclasses); |
88 | 88 | |
89 | -$xtpl->assign("BEAN_LIST",json_encode($beanList)); |
|
89 | +$xtpl->assign("BEAN_LIST", json_encode($beanList)); |
|
90 | 90 | |
91 | 91 | $personTypeList = "<select id='personTypeSelect'>"; |
92 | -if(count($beanList) > 0) |
|
92 | +if (count($beanList) > 0) |
|
93 | 93 | { |
94 | - $count=0; |
|
95 | - foreach($beanList as $b) |
|
94 | + $count = 0; |
|
95 | + foreach ($beanList as $b) |
|
96 | 96 | { |
97 | - $personTypeList.="<option value='".$count."'>".$b->name."</option>"; |
|
97 | + $personTypeList .= "<option value='".$count."'>".$b->name."</option>"; |
|
98 | 98 | $count++; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | else |
102 | 102 | { |
103 | - $personTypeList.="<option value='noPerson'>No matching types</option>"; |
|
103 | + $personTypeList .= "<option value='noPerson'>No matching types</option>"; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $site_url = $sugar_config['site_url']; |
@@ -127,18 +127,18 @@ discard block |
||
127 | 127 | ), |
128 | 128 | ); |
129 | 129 | $encoded_users_popup_request_data = $json->encode($popup_request_data); |
130 | -$xtpl->assign('encoded_campaigns_popup_request_data' , $json->encode($popup_request_data)); |
|
130 | +$xtpl->assign('encoded_campaigns_popup_request_data', $json->encode($popup_request_data)); |
|
131 | 131 | |
132 | 132 | $field_defs_js = "var field_defs = {'Contacts':["; |
133 | 133 | |
134 | -$xtpl->assign("WEB_POST_URL",$web_post_url); |
|
134 | +$xtpl->assign("WEB_POST_URL", $web_post_url); |
|
135 | 135 | |
136 | 136 | if (empty($focus->assigned_user_id) && empty($focus->id)) $focus->assigned_user_id = $current_user->id; |
137 | 137 | if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name; |
138 | 138 | $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name); |
139 | -$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id ); |
|
139 | +$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); |
|
140 | 140 | |
141 | -$xtpl->assign("REDIRECT_URL_DEFAULT",'http://'); |
|
141 | +$xtpl->assign("REDIRECT_URL_DEFAULT", 'http://'); |
|
142 | 142 | |
143 | 143 | $xtpl->parse("main"); |
144 | 144 | $xtpl->out("main"); |
@@ -148,71 +148,71 @@ discard block |
||
148 | 148 | { |
149 | 149 | global $app_strings; |
150 | 150 | $formattedBeans = array(); |
151 | - foreach($beans as $b) |
|
151 | + foreach ($beans as $b) |
|
152 | 152 | { |
153 | 153 | $formattedFields = array(); |
154 | 154 | //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field |
155 | - if(isset($b->field_defs['webtolead_email1']) && isset($b->field_defs['email1']) && isset($b->field_defs['email1']['required'])){ |
|
155 | + if (isset($b->field_defs['webtolead_email1']) && isset($b->field_defs['email1']) && isset($b->field_defs['email1']['required'])) { |
|
156 | 156 | $b->field_defs['webtolead_email1']['required'] = $b->field_defs['email1']['required']; |
157 | 157 | } |
158 | 158 | |
159 | - foreach($b->field_defs as $field_def) |
|
159 | + foreach ($b->field_defs as $field_def) |
|
160 | 160 | { |
161 | 161 | $email_fields = false; |
162 | - if($field_def['name']== 'email1' || $field_def['name']== 'email2') |
|
162 | + if ($field_def['name'] == 'email1' || $field_def['name'] == 'email2') |
|
163 | 163 | { |
164 | 164 | $email_fields = true; |
165 | 165 | } |
166 | - if($field_def['name']!= 'account_name'){ |
|
167 | - if( ( $field_def['type'] == 'relate' && empty($field_def['custom_type']) ) |
|
168 | - || $field_def['type'] == 'assigned_user_name' || $field_def['type'] =='link' || $field_def['type'] =='function' |
|
169 | - || (isset($field_def['source']) && $field_def['source']=='non-db' && !$email_fields) || $field_def['type'] == 'id') |
|
166 | + if ($field_def['name'] != 'account_name') { |
|
167 | + if (($field_def['type'] == 'relate' && empty($field_def['custom_type'])) |
|
168 | + || $field_def['type'] == 'assigned_user_name' || $field_def['type'] == 'link' || $field_def['type'] == 'function' |
|
169 | + || (isset($field_def['source']) && $field_def['source'] == 'non-db' && !$email_fields) || $field_def['type'] == 'id') |
|
170 | 170 | { |
171 | 171 | continue; |
172 | 172 | } |
173 | 173 | } |
174 | - if($field_def['name']== 'deleted' || $field_def['name']=='converted' || $field_def['name']=='date_entered' |
|
175 | - || $field_def['name']== 'date_modified' || $field_def['name']=='modified_user_id' |
|
176 | - || $field_def['name']=='assigned_user_id' || $field_def['name']=='created_by' |
|
177 | - || $field_def['name']=='team_id') |
|
174 | + if ($field_def['name'] == 'deleted' || $field_def['name'] == 'converted' || $field_def['name'] == 'date_entered' |
|
175 | + || $field_def['name'] == 'date_modified' || $field_def['name'] == 'modified_user_id' |
|
176 | + || $field_def['name'] == 'assigned_user_id' || $field_def['name'] == 'created_by' |
|
177 | + || $field_def['name'] == 'team_id') |
|
178 | 178 | { |
179 | 179 | continue; |
180 | 180 | } |
181 | 181 | |
182 | 182 | //If the field is hidden in the studio settings, then do not show |
183 | - if(isset($field_def['studio']) && isset($field_def['studio']['editview']) && $field_def['studio']['editview']=== false ) |
|
183 | + if (isset($field_def['studio']) && isset($field_def['studio']['editview']) && $field_def['studio']['editview'] === false) |
|
184 | 184 | { |
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
188 | 188 | |
189 | - $field_def['vname'] = preg_replace('/:$/','',translate($field_def['vname'], $b->module_dir)); |
|
189 | + $field_def['vname'] = preg_replace('/:$/', '', translate($field_def['vname'], $b->module_dir)); |
|
190 | 190 | |
191 | 191 | //$cols_name = "{'".$field_def['vname']."'}"; |
192 | 192 | $col_arr = array(); |
193 | - if((isset($field_def['required']) && $field_def['required'] != null && $field_def['required'] != 0) |
|
194 | - || $field_def['name']=='last_name' |
|
195 | - ){ |
|
196 | - $cols_name=$field_def['vname'].' '.$app_strings['LBL_REQUIRED_SYMBOL']; |
|
197 | - $col_arr[0]=$cols_name; |
|
198 | - $col_arr[1]=$field_def['name']; |
|
199 | - $col_arr[2]=true; |
|
193 | + if ((isset($field_def['required']) && $field_def['required'] != null && $field_def['required'] != 0) |
|
194 | + || $field_def['name'] == 'last_name' |
|
195 | + ) { |
|
196 | + $cols_name = $field_def['vname'].' '.$app_strings['LBL_REQUIRED_SYMBOL']; |
|
197 | + $col_arr[0] = $cols_name; |
|
198 | + $col_arr[1] = $field_def['name']; |
|
199 | + $col_arr[2] = true; |
|
200 | 200 | } |
201 | - else{ |
|
202 | - $cols_name=$field_def['vname']; |
|
203 | - $col_arr[0]=$cols_name; |
|
204 | - $col_arr[1]=$field_def['name']; |
|
201 | + else { |
|
202 | + $cols_name = $field_def['vname']; |
|
203 | + $col_arr[0] = $cols_name; |
|
204 | + $col_arr[1] = $field_def['name']; |
|
205 | 205 | } |
206 | - if (! in_array($cols_name, $formattedFields)) |
|
206 | + if (!in_array($cols_name, $formattedFields)) |
|
207 | 207 | { |
208 | - array_push($formattedFields,$col_arr); |
|
208 | + array_push($formattedFields, $col_arr); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | 212 | $holder = new stdClass(); |
213 | 213 | $holder->name = $b->object_name; |
214 | 214 | $holder->fields = $formattedFields; |
215 | - $holder->moduleKnownAs = translate($b->module_name,'LBL_MODULE_NAME'); |
|
215 | + $holder->moduleKnownAs = translate($b->module_name, 'LBL_MODULE_NAME'); |
|
216 | 216 | $holder->moduleDir = $b->module_dir; |
217 | 217 | $holder->moduleName = $b->module_name; |
218 | 218 | $formattedBeans[] = $holder; |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | function getListOfExtendingClasses($superclass) |
230 | 230 | { |
231 | 231 | $subclasses = array(); |
232 | - foreach($GLOBALS['moduleList'] as $mod) |
|
232 | + foreach ($GLOBALS['moduleList'] as $mod) |
|
233 | 233 | { |
234 | 234 | $item = BeanFactory::getBean($mod); |
235 | - if($item && is_subclass_of($item,$superclass)) |
|
235 | + if ($item && is_subclass_of($item, $superclass)) |
|
236 | 236 | $subclasses[] = $item; |
237 | 237 | } |
238 | 238 | return $subclasses; |
@@ -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. |
@@ -97,8 +99,7 @@ discard block |
||
97 | 99 | $personTypeList.="<option value='".$count."'>".$b->name."</option>"; |
98 | 100 | $count++; |
99 | 101 | } |
100 | -} |
|
101 | -else |
|
102 | +} else |
|
102 | 103 | { |
103 | 104 | $personTypeList.="<option value='noPerson'>No matching types</option>"; |
104 | 105 | } |
@@ -133,8 +134,12 @@ discard block |
||
133 | 134 | |
134 | 135 | $xtpl->assign("WEB_POST_URL",$web_post_url); |
135 | 136 | |
136 | -if (empty($focus->assigned_user_id) && empty($focus->id)) $focus->assigned_user_id = $current_user->id; |
|
137 | -if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name; |
|
137 | +if (empty($focus->assigned_user_id) && empty($focus->id)) { |
|
138 | + $focus->assigned_user_id = $current_user->id; |
|
139 | +} |
|
140 | +if (empty($focus->assigned_name) && empty($focus->id)) { |
|
141 | + $focus->assigned_user_name = $current_user->user_name; |
|
142 | +} |
|
138 | 143 | $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name); |
139 | 144 | $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id ); |
140 | 145 | |
@@ -197,8 +202,7 @@ discard block |
||
197 | 202 | $col_arr[0]=$cols_name; |
198 | 203 | $col_arr[1]=$field_def['name']; |
199 | 204 | $col_arr[2]=true; |
200 | - } |
|
201 | - else{ |
|
205 | + } else{ |
|
202 | 206 | $cols_name=$field_def['vname']; |
203 | 207 | $col_arr[0]=$cols_name; |
204 | 208 | $col_arr[1]=$field_def['name']; |
@@ -232,8 +236,9 @@ discard block |
||
232 | 236 | foreach($GLOBALS['moduleList'] as $mod) |
233 | 237 | { |
234 | 238 | $item = BeanFactory::getBean($mod); |
235 | - if($item && is_subclass_of($item,$superclass)) |
|
236 | - $subclasses[] = $item; |
|
239 | + if($item && is_subclass_of($item,$superclass)) { |
|
240 | + $subclasses[] = $item; |
|
241 | + } |
|
237 | 242 | } |
238 | 243 | return $subclasses; |
239 | 244 | } |
@@ -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. |
@@ -60,22 +60,22 @@ discard block |
||
60 | 60 | //name is used as key in post, it is also used in creation of summary page for wizard, |
61 | 61 | //so let's clean up the posting so we can reuse the save functionality for inbound emails and |
62 | 62 | //from existing save.php's |
63 | - foreach($camp_steps as $step){ |
|
63 | + foreach ($camp_steps as $step) { |
|
64 | 64 | clean_up_post($step); |
65 | 65 | } |
66 | 66 | /**************************** Save general Email Setup *****************************/ |
67 | 67 | |
68 | 68 | //we do not need to track location if location type is not set |
69 | -if(isset($_POST['tracking_entities_location_type'])) { |
|
69 | +if (isset($_POST['tracking_entities_location_type'])) { |
|
70 | 70 | if ($_POST['tracking_entities_location_type'] != '2') { |
71 | 71 | unset($_POST['tracking_entities_location']); |
72 | 72 | unset($_POST['tracking_entities_location_type']); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | //if the check box is empty, then set it to 0 |
76 | -if(!isset($_POST['mail_smtpauth_req'])) { $_POST['mail_smtpauth_req'] = 0; } |
|
76 | +if (!isset($_POST['mail_smtpauth_req'])) { $_POST['mail_smtpauth_req'] = 0; } |
|
77 | 77 | //default ssl use to false |
78 | -if(!isset($_POST['mail_smtpssl'])) { $_POST['mail_smtpssl'] = 0; } |
|
78 | +if (!isset($_POST['mail_smtpssl'])) { $_POST['mail_smtpssl'] = 0; } |
|
79 | 79 | //reuse existing saveconfig functionality |
80 | 80 | $focus->saveConfig(); |
81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | /**************************** Add New Monitored Box *****************************/ |
85 | 85 | //perform this if the option to create new mail box has been checked |
86 | -if(isset($_REQUEST['wiz_new_mbox']) && ($_REQUEST['wiz_new_mbox']=='1')){ |
|
86 | +if (isset($_REQUEST['wiz_new_mbox']) && ($_REQUEST['wiz_new_mbox'] == '1')) { |
|
87 | 87 | |
88 | 88 | //Populate the Request variables that inboundemail expects |
89 | 89 | $_REQUEST['mark_read'] = 1; |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | require_once('modules/InboundEmail/Save.php'); |
97 | 97 | |
98 | 98 | } |
99 | - if (!empty($_REQUEST['error'])){ |
|
99 | + if (!empty($_REQUEST['error'])) { |
|
100 | 100 | //an error was found during inbound save. This means the save was allowed but the inbound box had problems, return user to wizard |
101 | 101 | //and display error message |
102 | 102 | $header_URL = "Location: index.php?action=WizardEmailSetup&module=Campaigns&error=true"; |
103 | 103 | |
104 | - if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
104 | + if (preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
105 | 105 | $href = $matches[1]; |
106 | 106 | SugarApplication::redirect($href); |
107 | 107 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | header($headers); |
110 | 110 | } |
111 | 111 | |
112 | - }else{ |
|
112 | + } else { |
|
113 | 113 | //set navigation details |
114 | 114 | $header_URL = "Location: index.php?action=index&module=Campaigns"; |
115 | 115 | |
116 | - if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
116 | + if (preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
117 | 117 | $href = $matches[1]; |
118 | 118 | SugarApplication::redirect($href); |
119 | 119 | } |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | * which does not expect the prefix, and still use the generic create summary functionality in wizard, which |
130 | 130 | * does expect the prefix. |
131 | 131 | */ |
132 | -function clean_up_post($prefix){ |
|
132 | +function clean_up_post($prefix) { |
|
133 | 133 | |
134 | 134 | foreach ($_REQUEST as $key => $val) { |
135 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
136 | - $newkey =substr($key, strlen($prefix)) ; |
|
135 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
136 | + $newkey = substr($key, strlen($prefix)); |
|
137 | 137 | $_REQUEST[$newkey] = $val; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | foreach ($_POST as $key => $val) { |
142 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
143 | - $newkey =substr($key, strlen($prefix)) ; |
|
142 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
143 | + $newkey = substr($key, strlen($prefix)); |
|
144 | 144 | $_POST[$newkey] = $val; |
145 | 145 | |
146 | 146 | } |
@@ -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. |
@@ -104,20 +106,18 @@ discard block |
||
104 | 106 | if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
105 | 107 | $href = $matches[1]; |
106 | 108 | SugarApplication::redirect($href); |
107 | - } |
|
108 | - else { |
|
109 | + } else { |
|
109 | 110 | header($headers); |
110 | 111 | } |
111 | 112 | |
112 | - }else{ |
|
113 | + } else{ |
|
113 | 114 | //set navigation details |
114 | 115 | $header_URL = "Location: index.php?action=index&module=Campaigns"; |
115 | 116 | |
116 | 117 | if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
117 | 118 | $href = $matches[1]; |
118 | 119 | SugarApplication::redirect($href); |
119 | - } |
|
120 | - else { |
|
120 | + } else { |
|
121 | 121 | header($header_URL); |
122 | 122 | } |
123 | 123 |
@@ -23,14 +23,14 @@ |
||
23 | 23 | |
24 | 24 | private function getWizardMenuItemHTML($i, $label, $link = false) |
25 | 25 | { |
26 | - if($i >= 4) { |
|
26 | + if ($i >= 4) { |
|
27 | 27 | parse_str($link, $args); |
28 | - if(empty($args['marketing_id'])) { |
|
28 | + if (empty($args['marketing_id'])) { |
|
29 | 29 | $link = false; |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - if($link != false) { |
|
33 | + if ($link != false) { |
|
34 | 34 | $html = '<li id="nav_step'.$i.'" class="nav-steps" data-nav-step="'.$i.'" data-nav-url="'.$link.'"><div>'.$label.'</div></li>'; |
35 | 35 | } else { |
36 | 36 | $html = '<li id="nav_step'.$i.'" class="nav-steps" data-nav-step="'.$i.'" data-nav-url=""><div>'.$label.'</div></li>'; |
@@ -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. |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | $master = 'save'; |
54 | 54 | if (isset($_REQUEST['wiz_home_next_step']) && !empty($_REQUEST['wiz_home_next_step'])) { |
55 | 55 | |
56 | - if($_REQUEST['wiz_home_next_step']==3){ |
|
56 | + if ($_REQUEST['wiz_home_next_step'] == 3) { |
|
57 | 57 | //user has chosen to save and schedule this campaign for email |
58 | 58 | $master = 'send'; |
59 | - }elseif($_REQUEST['wiz_home_next_step']==2){ |
|
59 | + }elseif ($_REQUEST['wiz_home_next_step'] == 2) { |
|
60 | 60 | //user has chosen to save and send this campaign in test mode |
61 | 61 | $master = 'test'; |
62 | - }else{ |
|
62 | + } else { |
|
63 | 63 | //user has chosen to simply save |
64 | - $master = 'save'; |
|
64 | + $master = 'save'; |
|
65 | 65 | } |
66 | 66 | |
67 | -}else{ |
|
67 | +} else { |
|
68 | 68 | //default to just saving and exiting wizard |
69 | 69 | $master = 'save'; |
70 | 70 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | $marketing->retrieve($_REQUEST['record']); |
79 | 79 | } |
80 | 80 | else { |
81 | - if(!empty($_SESSION['campaignWizard'][$_REQUEST['campaign_id']]['defaultSelectedMarketingId'])) { |
|
81 | + if (!empty($_SESSION['campaignWizard'][$_REQUEST['campaign_id']]['defaultSelectedMarketingId'])) { |
|
82 | 82 | $marketing->retrieve($_SESSION['campaignWizard'][$_REQUEST['campaign_id']]['defaultSelectedMarketingId']); |
83 | 83 | } |
84 | 84 | } |
85 | -if(!$marketing->ACLAccess('Save')){ |
|
85 | +if (!$marketing->ACLAccess('Save')) { |
|
86 | 86 | ACLController::displayNoAccess(true); |
87 | 87 | sugar_cleanup(true); |
88 | 88 | } |
@@ -95,40 +95,40 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | foreach ($_REQUEST as $key => $val) { |
98 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
99 | - $newkey =substr($key, strlen($prefix)) ; |
|
98 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
99 | + $newkey = substr($key, strlen($prefix)); |
|
100 | 100 | $_REQUEST[$newkey] = $val; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | 104 | foreach ($_REQUEST as $key => $val) { |
105 | - if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){ |
|
106 | - $newkey =substr($key, strlen($prefix)) ; |
|
105 | + if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) { |
|
106 | + $newkey = substr($key, strlen($prefix)); |
|
107 | 107 | $_REQUEST[$newkey] = $val; |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | -if(!empty($_REQUEST['meridiem'])){ |
|
112 | - $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'],$timedate->get_time_format(), $_REQUEST['meridiem']); |
|
111 | +if (!empty($_REQUEST['meridiem'])) { |
|
112 | + $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'], $timedate->get_time_format(), $_REQUEST['meridiem']); |
|
113 | 113 | } |
114 | 114 | |
115 | -if(empty($_REQUEST['time_start'])) { |
|
116 | - $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00'; |
|
115 | +if (empty($_REQUEST['time_start'])) { |
|
116 | + $_REQUEST['date_start'] = $_REQUEST['date_start'].' 00:00'; |
|
117 | 117 | } else { |
118 | - $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start']; |
|
118 | + $_REQUEST['date_start'] = $_REQUEST['date_start'].' '.$_REQUEST['time_start']; |
|
119 | 119 | } |
120 | 120 | |
121 | -foreach($marketing->column_fields as $field) |
|
121 | +foreach ($marketing->column_fields as $field) |
|
122 | 122 | { |
123 | 123 | if ($field == 'all_prospect_lists') { |
124 | - if(isset($_REQUEST[$field]) && $_REQUEST[$field]='on' ) |
|
124 | + if (isset($_REQUEST[$field]) && $_REQUEST[$field] = 'on') |
|
125 | 125 | { |
126 | 126 | $marketing->$field = 1; |
127 | 127 | } else { |
128 | 128 | $marketing->$field = 0; |
129 | 129 | } |
130 | - }else { |
|
131 | - if(isset($_REQUEST[$field])) |
|
130 | + } else { |
|
131 | + if (isset($_REQUEST[$field])) |
|
132 | 132 | { |
133 | 133 | $value = $_REQUEST[$field]; |
134 | 134 | $marketing->$field = trim($value); |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | -foreach($marketing->additional_column_fields as $field) |
|
139 | +foreach ($marketing->additional_column_fields as $field) |
|
140 | 140 | { |
141 | - if(isset($_REQUEST[$field])) |
|
141 | + if (isset($_REQUEST[$field])) |
|
142 | 142 | { |
143 | 143 | $value = $_REQUEST[$field]; |
144 | 144 | $marketing->$field = $value; |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | |
151 | 151 | //add prospect lists to campaign. |
152 | 152 | $marketing->load_relationship('prospectlists'); |
153 | -$prospectlists=$marketing->prospectlists->get(); |
|
154 | -if ($marketing->all_prospect_lists==1) { |
|
153 | +$prospectlists = $marketing->prospectlists->get(); |
|
154 | +if ($marketing->all_prospect_lists == 1) { |
|
155 | 155 | //remove all related prospect lists. |
156 | 156 | if (!empty($prospectlists)) { |
157 | 157 | $marketing->prospectlists->delete($marketing->id); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (isset($_REQUEST['message_for']) && is_array($_REQUEST['message_for'])) { |
161 | 161 | foreach ($_REQUEST['message_for'] as $prospect_list_id) { |
162 | 162 | |
163 | - $key=array_search($prospect_list_id,$prospectlists); |
|
163 | + $key = array_search($prospect_list_id, $prospectlists); |
|
164 | 164 | if ($key === null or $key === false) { |
165 | 165 | $marketing->prospectlists->add($prospect_list_id); |
166 | 166 | } else { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | if (count($prospectlists) != 0) { |
171 | 171 | foreach ($prospectlists as $key=>$list_id) { |
172 | - $marketing->prospectlists->delete($marketing->id,$list_id); |
|
172 | + $marketing->prospectlists->delete($marketing->id, $list_id); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -179,21 +179,21 @@ discard block |
||
179 | 179 | $mass[] = $marketing->id; |
180 | 180 | //if sending an email was chosen, set all the needed variables for queuing campaign |
181 | 181 | |
182 | -if($master !='save'){ |
|
183 | - $_REQUEST['mass']= $mass; |
|
184 | - $_POST['mass']=$mass; |
|
185 | - $_REQUEST['record'] =$marketing->campaign_id; |
|
186 | - $_POST['record']=$marketing->campaign_id; |
|
182 | +if ($master != 'save') { |
|
183 | + $_REQUEST['mass'] = $mass; |
|
184 | + $_POST['mass'] = $mass; |
|
185 | + $_REQUEST['record'] = $marketing->campaign_id; |
|
186 | + $_POST['record'] = $marketing->campaign_id; |
|
187 | 187 | $_REQUEST['mode'] = $master; |
188 | 188 | $_POST['mode'] = $master; |
189 | - $_REQUEST['from_wiz']= 'true'; |
|
189 | + $_REQUEST['from_wiz'] = 'true'; |
|
190 | 190 | require_once('modules/Campaigns/QueueCampaign.php'); |
191 | 191 | } |
192 | 192 | |
193 | -if(isset($_REQUEST['show_wizard_summary']) && $_REQUEST['show_wizard_summary']) { |
|
193 | +if (isset($_REQUEST['show_wizard_summary']) && $_REQUEST['show_wizard_summary']) { |
|
194 | 194 | |
195 | - if( (isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) || |
|
196 | - (isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) ) { |
|
195 | + if ((isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) || |
|
196 | + (isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule'])) { |
|
197 | 197 | // set correct post variables.. |
198 | 198 | $_POST['module'] = 'Campaigns'; |
199 | 199 | $_POST['action'] = 'QueueCampaign'; |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | $_POST['direct_step'] = '1'; |
206 | 206 | //$_POST['campaign_id'] = ''; |
207 | 207 | $_POST['wiz_mass'] = $marketing->id; |
208 | - if(isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) { |
|
208 | + if (isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) { |
|
209 | 209 | $_POST['mode'] = 'test'; |
210 | 210 | } |
211 | - else if(isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) { |
|
211 | + else if (isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) { |
|
212 | 212 | $_POST['mode'] = 'send'; |
213 | 213 | $_SESSION['msg'] = 'LBL_EMAILS_SCHEDULED'; |
214 | 214 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | exit; |
223 | 223 | } |
224 | 224 | |
225 | - $header_URL = "Location: index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id=" . $marketing->campaign_id . "&campaign_id=" . $marketing->campaign_id . "&jump=3&marketing_id=" . $marketing->id; |
|
225 | + $header_URL = "Location: index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id=".$marketing->campaign_id."&campaign_id=".$marketing->campaign_id."&jump=3&marketing_id=".$marketing->id; |
|
226 | 226 | } |
227 | 227 | else { |
228 | 228 | $header_URL = "Location: index.php?action=WizardHome&module=Campaigns&record=".$marketing->campaign_id; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $GLOBALS['log']->debug("about to post header URL of: $header_URL"); |
232 | 232 | |
233 | -if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
233 | +if (preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
|
234 | 234 | $href = $matches[1]; |
235 | 235 | SugarApplication::redirect($href); |
236 | 236 | } |
@@ -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,15 +58,15 @@ discard block |
||
56 | 58 | if($_REQUEST['wiz_home_next_step']==3){ |
57 | 59 | //user has chosen to save and schedule this campaign for email |
58 | 60 | $master = 'send'; |
59 | - }elseif($_REQUEST['wiz_home_next_step']==2){ |
|
61 | + } elseif($_REQUEST['wiz_home_next_step']==2){ |
|
60 | 62 | //user has chosen to save and send this campaign in test mode |
61 | 63 | $master = 'test'; |
62 | - }else{ |
|
64 | + } else{ |
|
63 | 65 | //user has chosen to simply save |
64 | 66 | $master = 'save'; |
65 | 67 | } |
66 | 68 | |
67 | -}else{ |
|
69 | +} else{ |
|
68 | 70 | //default to just saving and exiting wizard |
69 | 71 | $master = 'save'; |
70 | 72 | } |
@@ -76,8 +78,7 @@ discard block |
||
76 | 78 | $marketing = new EmailMarketing(); |
77 | 79 | if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) { |
78 | 80 | $marketing->retrieve($_REQUEST['record']); |
79 | -} |
|
80 | -else { |
|
81 | +} else { |
|
81 | 82 | if(!empty($_SESSION['campaignWizard'][$_REQUEST['campaign_id']]['defaultSelectedMarketingId'])) { |
82 | 83 | $marketing->retrieve($_SESSION['campaignWizard'][$_REQUEST['campaign_id']]['defaultSelectedMarketingId']); |
83 | 84 | } |
@@ -89,8 +90,7 @@ discard block |
||
89 | 90 | |
90 | 91 | if (!empty($_REQUEST['assigned_user_id']) && ($marketing->assigned_user_id != $_REQUEST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) { |
91 | 92 | $check_notify = TRUE; |
92 | -} |
|
93 | -else { |
|
93 | +} else { |
|
94 | 94 | $check_notify = FALSE; |
95 | 95 | } |
96 | 96 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } else { |
128 | 128 | $marketing->$field = 0; |
129 | 129 | } |
130 | - }else { |
|
130 | + } else { |
|
131 | 131 | if(isset($_REQUEST[$field])) |
132 | 132 | { |
133 | 133 | $value = $_REQUEST[$field]; |
@@ -207,12 +207,10 @@ discard block |
||
207 | 207 | $_POST['wiz_mass'] = $marketing->id; |
208 | 208 | if(isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) { |
209 | 209 | $_POST['mode'] = 'test'; |
210 | - } |
|
211 | - else if(isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) { |
|
210 | + } else if(isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) { |
|
212 | 211 | $_POST['mode'] = 'send'; |
213 | 212 | $_SESSION['msg'] = 'LBL_EMAILS_SCHEDULED'; |
214 | - } |
|
215 | - else { |
|
213 | + } else { |
|
216 | 214 | throw new Exception('request error'); |
217 | 215 | } |
218 | 216 | |
@@ -223,8 +221,7 @@ discard block |
||
223 | 221 | } |
224 | 222 | |
225 | 223 | $header_URL = "Location: index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id=" . $marketing->campaign_id . "&campaign_id=" . $marketing->campaign_id . "&jump=3&marketing_id=" . $marketing->id; |
226 | -} |
|
227 | -else { |
|
224 | +} else { |
|
228 | 225 | $header_URL = "Location: index.php?action=WizardHome&module=Campaigns&record=".$marketing->campaign_id; |
229 | 226 | } |
230 | 227 | |
@@ -233,8 +230,7 @@ discard block |
||
233 | 230 | if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) { |
234 | 231 | $href = $matches[1]; |
235 | 232 | SugarApplication::redirect($href); |
236 | -} |
|
237 | -else { |
|
233 | +} else { |
|
238 | 234 | header($header_URL); |
239 | 235 | } |
240 | 236 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | // -- fields |
120 | 120 | |
121 | 121 | private static function getFieldLabelHTML($fieldLabel, $fieldRequired, $webRequiredSymbol) { |
122 | - $html = '<label>' . $fieldLabel . ($fieldRequired ? "<span class='required'>$webRequiredSymbol</span>" : '') . '</label>'; |
|
122 | + $html = '<label>'.$fieldLabel.($fieldRequired ? "<span class='required'>$webRequiredSymbol</span>" : '').'</label>'; |
|
123 | 123 | return $html; |
124 | 124 | } |
125 | 125 | |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | |
138 | 138 | $html .= self::getFieldLabelHTML($fieldLabel, $fieldRequired, $webRequiredSymbol); |
139 | 139 | |
140 | - if(isset($lead->field_defs[$colsField]['isMultiSelect']) && $lead->field_defs[$colsField]['isMultiSelect'] ==1){ |
|
140 | + if (isset($lead->field_defs[$colsField]['isMultiSelect']) && $lead->field_defs[$colsField]['isMultiSelect'] == 1) { |
|
141 | 141 | $html .= self::getFieldEnumMultiSelectHTML($fieldName, $leadOptions, $fieldRequired); |
142 | - }elseif(ifRadioButton($lead->field_defs[$colsField]['name'])){ |
|
142 | + }elseif (ifRadioButton($lead->field_defs[$colsField]['name'])) { |
|
143 | 143 | $html .= self::getFieldEnumRadioGroupHTML($appListStringsFieldOptions, $lead, $fieldName, $colsField, $fieldRequired); |
144 | - }else{ |
|
144 | + } else { |
|
145 | 145 | $html .= self::getFieldEnumSelectHTML($fieldName, $leadOptions, $fieldRequired); |
146 | 146 | } |
147 | 147 | return $html; |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | private static function getFieldEnumRadioGroupHTML($appListStringsFieldOptions, $lead, $fieldName, $colsField, $fieldRequired) { |
157 | 157 | $_required = $fieldRequired ? ' required' : ''; |
158 | 158 | $html = ''; |
159 | - foreach($appListStringsFieldOptions as $field_option_key => $field_option){ |
|
160 | - if($field_option != null){ |
|
161 | - if(!empty($lead->$fieldName) && in_array($field_option_key,unencodeMultienum($lead->$fieldName))) { |
|
159 | + foreach ($appListStringsFieldOptions as $field_option_key => $field_option) { |
|
160 | + if ($field_option != null) { |
|
161 | + if (!empty($lead->$fieldName) && in_array($field_option_key, unencodeMultienum($lead->$fieldName))) { |
|
162 | 162 | $_checked = ' checked'; |
163 | 163 | } |
164 | 164 | else { |
165 | 165 | $_checked = ''; |
166 | 166 | } |
167 | - $html .="<input id=\"{$colsField}_$field_option_key\" name=\"$colsField\" value=\"$field_option_key\" type=\"radio\"$_checked$_required>"; |
|
167 | + $html .= "<input id=\"{$colsField}_$field_option_key\" name=\"$colsField\" value=\"$field_option_key\" type=\"radio\"$_checked$_required>"; |
|
168 | 168 | // todo ??? --> |
169 | - $html .="<span ='document.getElementById('".$lead->field_defs[$colsField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>"; |
|
169 | + $html .= "<span ='document.getElementById('".$lead->field_defs[$colsField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>"; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | return $html; |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | // char strings |
200 | 200 | |
201 | 201 | private static function getFieldCharsHTML($fieldName, $fieldLabel, $fieldRequired, $webRequiredSymbol) { |
202 | - $isRequired = $fieldName=='last_name' || $fieldRequired; |
|
202 | + $isRequired = $fieldName == 'last_name' || $fieldRequired; |
|
203 | 203 | $_required = $isRequired ? ' required' : ''; |
204 | 204 | $html = self::getFieldLabelHTML($fieldLabel, $isRequired, $webRequiredSymbol); |
205 | - $_type = $fieldName=='email1'||$fieldName=='email2' ? 'email' : 'text'; |
|
205 | + $_type = $fieldName == 'email1' || $fieldName == 'email2' ? 'email' : 'text'; |
|
206 | 206 | $html .= "<input id=\"$fieldName\" name=\"$fieldName\" type=\"$_type\"$_required>"; |
207 | 207 | return $html; |
208 | 208 | } |
@@ -239,64 +239,64 @@ discard block |
||
239 | 239 | private static function getFormTwoColumns($request, $formCols) { |
240 | 240 | $colsFirst = isset($request[$formCols[0]]) ? $request[$formCols[0]] : null; |
241 | 241 | $colsSecond = isset($request[$formCols[1]]) ? $request[$formCols[1]] : null; |
242 | - if(!empty($colsFirst) && !empty($colsSecond)){ |
|
243 | - if(count($colsFirst) < count($colsSecond)){ |
|
244 | - $columns= count($colsSecond); |
|
242 | + if (!empty($colsFirst) && !empty($colsSecond)) { |
|
243 | + if (count($colsFirst) < count($colsSecond)) { |
|
244 | + $columns = count($colsSecond); |
|
245 | 245 | } |
246 | - if(count($colsFirst) > count($colsSecond) || count($colsFirst) == count($colsSecond)){ |
|
247 | - $columns= count($colsFirst); |
|
246 | + if (count($colsFirst) > count($colsSecond) || count($colsFirst) == count($colsSecond)) { |
|
247 | + $columns = count($colsFirst); |
|
248 | 248 | } |
249 | 249 | } |
250 | - else if(!empty($colsFirst)){ |
|
251 | - $columns= count($colsFirst); |
|
250 | + else if (!empty($colsFirst)) { |
|
251 | + $columns = count($colsFirst); |
|
252 | 252 | } |
253 | - else if(!empty($colsSecond)){ |
|
254 | - $columns= count($colsSecond); |
|
253 | + else if (!empty($colsSecond)) { |
|
254 | + $columns = count($colsSecond); |
|
255 | 255 | } |
256 | 256 | return $columns; |
257 | 257 | } |
258 | 258 | |
259 | 259 | private static function getBooleanFields($boolFields) { |
260 | - $boolean_fields=''; |
|
261 | - if($boolFields != null ){ |
|
262 | - foreach($boolFields as $boo){ |
|
263 | - $boolean_fields=$boolean_fields.$boo.';'; |
|
260 | + $boolean_fields = ''; |
|
261 | + if ($boolFields != null) { |
|
262 | + foreach ($boolFields as $boo) { |
|
263 | + $boolean_fields = $boolean_fields.$boo.';'; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | return $boolean_fields; |
267 | 267 | } |
268 | 268 | |
269 | 269 | private static function getArrayOfFieldInfo($lead, $colsField, &$requiredFields) { |
270 | - $field_vname= preg_replace('/:$/','',translate($lead->field_defs[$colsField]['vname'], $lead->module_dir)); |
|
271 | - $field_name= $colsField; |
|
272 | - $field_label = $field_vname .": "; |
|
273 | - if(isset($lead->field_defs[$colsField]['custom_type']) && $lead->field_defs[$colsField]['custom_type'] != null){ |
|
274 | - $field_type= $lead->field_defs[$colsField]['custom_type']; |
|
270 | + $field_vname = preg_replace('/:$/', '', translate($lead->field_defs[$colsField]['vname'], $lead->module_dir)); |
|
271 | + $field_name = $colsField; |
|
272 | + $field_label = $field_vname.": "; |
|
273 | + if (isset($lead->field_defs[$colsField]['custom_type']) && $lead->field_defs[$colsField]['custom_type'] != null) { |
|
274 | + $field_type = $lead->field_defs[$colsField]['custom_type']; |
|
275 | 275 | } |
276 | - else{ |
|
277 | - $field_type= $lead->field_defs[$colsField]['type']; |
|
276 | + else { |
|
277 | + $field_type = $lead->field_defs[$colsField]['type']; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field |
281 | - if($colsField == 'webtolead_email1' && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])){ |
|
281 | + if ($colsField == 'webtolead_email1' && isset($lead->field_defs['email1']) && isset($lead->field_defs['email1']['required'])) { |
|
282 | 282 | $lead->field_defs['webtolead_email1']['required'] = $lead->field_defs['email1']['required']; |
283 | 283 | } |
284 | 284 | |
285 | 285 | $field_required = ''; |
286 | - if(isset($lead->field_defs[$colsField]['required']) && $lead->field_defs[$colsField]['required'] != null |
|
287 | - && $lead->field_defs[$colsField]['required'] != 0){ |
|
286 | + if (isset($lead->field_defs[$colsField]['required']) && $lead->field_defs[$colsField]['required'] != null |
|
287 | + && $lead->field_defs[$colsField]['required'] != 0) { |
|
288 | 288 | $field_required = $lead->field_defs[$colsField]['required']; |
289 | - if (! in_array($lead->field_defs[$colsField]['name'], $requiredFields)){ |
|
290 | - array_push($requiredFields,$lead->field_defs[$colsField]['name']); |
|
289 | + if (!in_array($lead->field_defs[$colsField]['name'], $requiredFields)) { |
|
290 | + array_push($requiredFields, $lead->field_defs[$colsField]['name']); |
|
291 | 291 | } |
292 | 292 | } |
293 | - if($lead->field_defs[$colsField]['name']=='last_name'){ |
|
294 | - if (! in_array($lead->field_defs[$colsField]['name'], $requiredFields)){ |
|
295 | - array_push($requiredFields,$lead->field_defs[$colsField]['name']); |
|
293 | + if ($lead->field_defs[$colsField]['name'] == 'last_name') { |
|
294 | + if (!in_array($lead->field_defs[$colsField]['name'], $requiredFields)) { |
|
295 | + array_push($requiredFields, $lead->field_defs[$colsField]['name']); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | $field_options = null; |
299 | - if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum') $field_options= $lead->field_defs[$colsField]['options']; |
|
299 | + if ($field_type == 'multienum' || $field_type == 'enum' || $field_type == 'radioenum') $field_options = $lead->field_defs[$colsField]['options']; |
|
300 | 300 | return array($field_name, $field_label, $field_type, $field_required, $field_options); |
301 | 301 | } |
302 | 302 | |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | |
335 | 335 | $required_fields = array(); |
336 | 336 | $bool_fields = array(); |
337 | - for($i= 0; $i<$columns;$i++){ |
|
337 | + for ($i = 0; $i < $columns; $i++) { |
|
338 | 338 | |
339 | 339 | $colsFields = array(); |
340 | - foreach($formCols as $k => $formCol) { |
|
340 | + foreach ($formCols as $k => $formCol) { |
|
341 | 341 | $colsFields[$k] = !empty($request[$formCol][$i]) ? $request[$formCol][$i] : null; |
342 | 342 | } |
343 | 343 | |
344 | - if($colsFieldCount = count($formCols)) { |
|
344 | + if ($colsFieldCount = count($formCols)) { |
|
345 | 345 | |
346 | 346 | $colHtml = ''; |
347 | 347 | $foundField = false; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | } |
398 | 398 | |
399 | - if($foundField) { |
|
399 | + if ($foundField) { |
|
400 | 400 | $Web_To_Lead_Form_html .= self::getRowStartHTML(); |
401 | 401 | $Web_To_Lead_Form_html .= $colHtml; |
402 | 402 | $Web_To_Lead_Form_html .= self:: getRowFinishHTML(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | global $sugar_config; |
65 | 65 | $this->module = (!empty($module)) ? $module : ((isset($_REQUEST['module']) && !empty($_REQUEST['module'])) ? $_REQUEST ['module'] : ''); |
66 | 66 | $this->base_path = "custom/Extension/modules/{$this->module}/Ext/Vardefs"; |
67 | - if(isset($sugar_config['dbconfig'])) { |
|
67 | + if (isset($sugar_config['dbconfig'])) { |
|
68 | 68 | $this->db = DBManagerFactory::getInstance(); |
69 | 69 | } |
70 | 70 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function setLabel($language = 'en_us', $key, $value) |
135 | 135 | { |
136 | - $params ['label_' . $key] = $value; |
|
136 | + $params ['label_'.$key] = $value; |
|
137 | 137 | require_once 'modules/ModuleBuilder/parsers/parser.label.php'; |
138 | 138 | $parser = new ParserLabel($this->module); |
139 | 139 | $parser->handleSave($params, $language); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | return false; |
169 | 169 | } |
170 | 170 | |
171 | - $GLOBALS['log']->debug('rebuilding cache for ' . $module); |
|
171 | + $GLOBALS['log']->debug('rebuilding cache for '.$module); |
|
172 | 172 | $query = "SELECT * FROM fields_meta_data WHERE $where deleted = 0"; |
173 | 173 | |
174 | 174 | $result = $this->db->query($query); |
@@ -336,20 +336,20 @@ discard block |
||
336 | 336 | } |
337 | 337 | } |
338 | 338 | } |
339 | - $join = ' LEFT JOIN ' . $this->bean->table_name . '_cstm ON ' . $this->bean->table_name . '.id = ' . $this->bean->table_name . '_cstm.id_c '; |
|
339 | + $join = ' LEFT JOIN '.$this->bean->table_name.'_cstm ON '.$this->bean->table_name.'.id = '.$this->bean->table_name.'_cstm.id_c '; |
|
340 | 340 | |
341 | 341 | if ($includeRelates) { |
342 | 342 | $jtAlias = 'relJoin'; |
343 | 343 | $jtCount = 1; |
344 | 344 | foreach ($this->bean->field_defs as $name => $field) { |
345 | 345 | if ($field['type'] == 'relate' && isset($field['custom_module'])) { |
346 | - $relateJoinInfo = $this->getRelateJoin($field, $jtAlias . $jtCount); |
|
346 | + $relateJoinInfo = $this->getRelateJoin($field, $jtAlias.$jtCount); |
|
347 | 347 | $select .= $relateJoinInfo['select']; |
348 | 348 | $join .= $relateJoinInfo['from']; |
349 | 349 | //bug 27654 martin |
350 | 350 | if ($where) { |
351 | - $pattern = '/' . $field['name'] . '\slike/i'; |
|
352 | - $replacement = $relateJoinInfo['name_field'] . ' like'; |
|
351 | + $pattern = '/'.$field['name'].'\slike/i'; |
|
352 | + $replacement = $relateJoinInfo['name_field'].' like'; |
|
353 | 353 | $where = preg_replace($pattern, $replacement, $where); |
354 | 354 | } |
355 | 355 | ++$jtCount; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $name_field = $this->db->concat($joinTableAlias, $name_field_def['db_concat_fields']); |
386 | 386 | } //If the name field is non-db, we need to find another field to display |
387 | 387 | elseif (!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == 'non-db' && !empty($field_def['rname'])) { |
388 | - $name_field = "$joinTableAlias." . $field_def['rname']; |
|
388 | + $name_field = "$joinTableAlias.".$field_def['rname']; |
|
389 | 389 | } else { |
390 | 390 | $name_field = "$joinTableAlias.name"; |
391 | 391 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $relID = $field_def['id_name']; |
395 | 395 | $ret_array['rel_table'] = $rel_table; |
396 | 396 | $ret_array['name_field'] = $name_field; |
397 | - $ret_array['select'] = ($withIdName ? ", {$tableName}.{$relID}" : '') . ", {$name_field} {$field_def['name']} "; |
|
397 | + $ret_array['select'] = ($withIdName ? ", {$tableName}.{$relID}" : '').", {$name_field} {$field_def['name']} "; |
|
398 | 398 | $ret_array['from'] = " LEFT JOIN $rel_table $joinTableAlias ON $tableName.$relID = $joinTableAlias.id" |
399 | 399 | . " AND $joinTableAlias.deleted=0 "; |
400 | 400 | |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | if ($this->bean->hasCustomFields() && isset($this->bean->id)) { |
444 | 444 | $query = ''; |
445 | 445 | if ($isUpdate) { |
446 | - $query = 'UPDATE ' . $this->bean->table_name . '_cstm SET '; |
|
446 | + $query = 'UPDATE '.$this->bean->table_name.'_cstm SET '; |
|
447 | 447 | } |
448 | - $queryInsert = 'INSERT INTO ' . $this->bean->table_name . '_cstm (id_c'; |
|
449 | - $values = "('" . $this->bean->id . "'"; |
|
448 | + $queryInsert = 'INSERT INTO '.$this->bean->table_name.'_cstm (id_c'; |
|
449 | + $values = "('".$this->bean->id."'"; |
|
450 | 450 | $first = true; |
451 | 451 | foreach ($this->bean->field_defs as $name => $field) { |
452 | 452 | if (empty($field['source']) || $field['source'] != 'custom_fields') { |
@@ -484,18 +484,18 @@ discard block |
||
484 | 484 | } |
485 | 485 | if ($isUpdate) { |
486 | 486 | if ($first) { |
487 | - $query .= " $name=$quote" . $this->db->quote($val) . "$quote"; |
|
487 | + $query .= " $name=$quote".$this->db->quote($val)."$quote"; |
|
488 | 488 | } else { |
489 | - $query .= " ,$name=$quote" . $this->db->quote($val) . "$quote"; |
|
489 | + $query .= " ,$name=$quote".$this->db->quote($val)."$quote"; |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | $first = false; |
493 | 493 | $queryInsert .= " ,$name"; |
494 | - $values .= " ,$quote" . $this->db->quote($val) . "$quote"; |
|
494 | + $values .= " ,$quote".$this->db->quote($val)."$quote"; |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | if ($isUpdate) { |
498 | - $query .= " WHERE id_c='" . $this->bean->id . "'"; |
|
498 | + $query .= " WHERE id_c='".$this->bean->id."'"; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | $queryInsert .= " ) VALUES $values )"; |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | $object_name = $newName != false ? $newName : $object_name; |
539 | 539 | } |
540 | 540 | |
541 | - $this->db->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'"); |
|
542 | - $sql = $widget->get_db_delete_alter_table($this->bean->table_name . '_cstm'); |
|
541 | + $this->db->query("DELETE FROM fields_meta_data WHERE id='".$this->module.$widget->name."'"); |
|
542 | + $sql = $widget->get_db_delete_alter_table($this->bean->table_name.'_cstm'); |
|
543 | 543 | if (!empty($sql)) { |
544 | 544 | $this->db->query($sql); |
545 | 545 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | $db_name = $field->name; |
600 | 600 | |
601 | 601 | $fmd = new FieldsMetaData(); |
602 | - $id = $fmd->retrieve($object_name . $db_name, true, false); |
|
602 | + $id = $fmd->retrieve($object_name.$db_name, true, false); |
|
603 | 603 | $is_update = false; |
604 | 604 | $label = strtoupper($field->label); |
605 | 605 | if (!empty($id)) { |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $field->name = $db_name; |
610 | 610 | } |
611 | 611 | $this->createCustomTable(); |
612 | - $fmd->id = $object_name . $db_name; |
|
612 | + $fmd->id = $object_name.$db_name; |
|
613 | 613 | $fmd->custom_module = $object_name; |
614 | 614 | $fmd->name = $db_name; |
615 | 615 | $fmd->vname = $label; |
@@ -645,20 +645,20 @@ discard block |
||
645 | 645 | // resetting default and default_value does not work for multienum and causes trouble for MsSQL |
646 | 646 | // so using a temporary variable here to indicate that we don't want default for this query |
647 | 647 | $field->no_default = 1; |
648 | - $query = $field->get_db_add_alter_table($this->bean->table_name . '_cstm'); |
|
648 | + $query = $field->get_db_add_alter_table($this->bean->table_name.'_cstm'); |
|
649 | 649 | // unset temporary member variable |
650 | 650 | unset($field->no_default); |
651 | 651 | if (!empty($query)) { |
652 | 652 | $this->db->query($query, true, 'Cannot create column'); |
653 | 653 | $field->default = $fmd->default_value; |
654 | 654 | $field->default_value = $fmd->default_value; |
655 | - $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm'); |
|
655 | + $query = $field->get_db_modify_alter_table($this->bean->table_name.'_cstm'); |
|
656 | 656 | if (!empty($query)) { |
657 | 657 | $this->db->query($query, true, 'Cannot set default'); |
658 | 658 | } |
659 | 659 | } |
660 | 660 | } else { |
661 | - $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm'); |
|
661 | + $query = $field->get_db_modify_alter_table($this->bean->table_name.'_cstm'); |
|
662 | 662 | if (!empty($query)) { |
663 | 663 | $this->db->query($query, true, 'Cannot modify field'); |
664 | 664 | } |
@@ -747,9 +747,9 @@ discard block |
||
747 | 747 | $vBean = $bean_name == 'aCase' ? 'Case' : $bean_name; |
748 | 748 | $file_loc = "$this->base_path/sugarfield_{$field->name}.php"; |
749 | 749 | |
750 | - $out = "<?php\n // created: " . date('Y-m-d H:i:s') . "\n"; |
|
750 | + $out = "<?php\n // created: ".date('Y-m-d H:i:s')."\n"; |
|
751 | 751 | foreach ($def_override as $property => $val) { |
752 | - $out .= override_value_to_string_recursive(array($vBean, 'fields', $field->name, $property), 'dictionary', $val) . "\n"; |
|
752 | + $out .= override_value_to_string_recursive(array($vBean, 'fields', $field->name, $property), 'dictionary', $val)."\n"; |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | $out .= "\n ?>"; |
@@ -840,8 +840,8 @@ discard block |
||
840 | 840 | public function createCustomTable($execute = true) |
841 | 841 | { |
842 | 842 | $out = ''; |
843 | - if (!$this->db->tableExists($this->bean->table_name . '_cstm')) { |
|
844 | - $GLOBALS['log']->debug('creating custom table for ' . $this->bean->table_name); |
|
843 | + if (!$this->db->tableExists($this->bean->table_name.'_cstm')) { |
|
844 | + $GLOBALS['log']->debug('creating custom table for '.$this->bean->table_name); |
|
845 | 845 | $idDef = array( |
846 | 846 | 'id_c' => array( |
847 | 847 | 'name' => 'id_c', |
@@ -851,15 +851,15 @@ discard block |
||
851 | 851 | ); |
852 | 852 | $idIdx = array( |
853 | 853 | 'id' => array( |
854 | - 'name' => $this->bean->table_name . '_cstm_pk', |
|
854 | + 'name' => $this->bean->table_name.'_cstm_pk', |
|
855 | 855 | 'type' => 'primary', |
856 | 856 | 'fields' => array('id_c'), |
857 | 857 | ), |
858 | 858 | ); |
859 | 859 | |
860 | - $query = $this->db->createTableSQLParams($this->bean->table_name . '_cstm', $idDef, $idIdx); |
|
860 | + $query = $this->db->createTableSQLParams($this->bean->table_name.'_cstm', $idDef, $idIdx); |
|
861 | 861 | if (!$this->db->supports('inline_keys')) { |
862 | - $indicesArr = $this->db->getConstraintSql($idIdx, $this->bean->table_name . '_cstm'); |
|
862 | + $indicesArr = $this->db->getConstraintSql($idIdx, $this->bean->table_name.'_cstm'); |
|
863 | 863 | } else { |
864 | 864 | $indicesArr = array(); |
865 | 865 | } |
@@ -871,9 +871,9 @@ discard block |
||
871 | 871 | } |
872 | 872 | } |
873 | 873 | } |
874 | - $out = $query . "\n"; |
|
874 | + $out = $query."\n"; |
|
875 | 875 | if (!empty($indicesArr)) { |
876 | - $out .= implode("\n", $indicesArr) . "\n"; |
|
876 | + $out .= implode("\n", $indicesArr)."\n"; |
|
877 | 877 | } |
878 | 878 | |
879 | 879 | $out .= $this->add_existing_custom_fields($execute); |
@@ -914,8 +914,8 @@ discard block |
||
914 | 914 | $field = get_widget($data ['type']); |
915 | 915 | $field->populateFromRow($data); |
916 | 916 | $query = "/*MISSING IN DATABASE - {$data['name']} - ROW*/\n" |
917 | - . $field->get_db_add_alter_table($this->bean->table_name . '_cstm'); |
|
918 | - $out = $query . "\n"; |
|
917 | + . $field->get_db_add_alter_table($this->bean->table_name.'_cstm'); |
|
918 | + $out = $query."\n"; |
|
919 | 919 | if ($execute) { |
920 | 920 | $this->db->query($query); |
921 | 921 | } |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | //Otherwise make sure all the custom fields defined in the vardefs exist in the custom table. |
938 | 938 | //We aren't checking for data types, just that the column exists. |
939 | 939 | $db = $this->db; |
940 | - $tablename = $this->bean->table_name . '_cstm'; |
|
940 | + $tablename = $this->bean->table_name.'_cstm'; |
|
941 | 941 | $compareFieldDefs = $db->get_columns($tablename); |
942 | 942 | foreach ($this->bean->field_defs as $name => $data) { |
943 | 943 | if (empty($data['source']) || $data['source'] != 'custom_fields') { |
@@ -981,14 +981,14 @@ discard block |
||
981 | 981 | $systemLabel = $field_key; |
982 | 982 | if (!$this->use_existing_labels) { // use_existing_labels defaults to false in this module; as of today, only set to true by ModuleInstaller.php |
983 | 983 | while (isset($mod_strings [$systemLabel]) && $count <= $limit) { |
984 | - $systemLabel = $field_key . "_$count"; |
|
984 | + $systemLabel = $field_key."_$count"; |
|
985 | 985 | ++$count; |
986 | 986 | } |
987 | 987 | } |
988 | 988 | $selMod = (!empty($_REQUEST['view_module'])) ? $_REQUEST['view_module'] : $this->module; |
989 | 989 | require_once 'modules/ModuleBuilder/parsers/parser.label.php'; |
990 | 990 | $parser = new ParserLabel($selMod, isset($_REQUEST ['view_package']) ? $_REQUEST ['view_package'] : null); |
991 | - $parser->handleSave(array('label_' . $systemLabel => $displayLabel), $GLOBALS ['current_language']); |
|
991 | + $parser->handleSave(array('label_'.$systemLabel => $displayLabel), $GLOBALS ['current_language']); |
|
992 | 992 | |
993 | 993 | return $systemLabel; |
994 | 994 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | if (isset($this->avail_fields)) { |
1027 | 1027 | foreach ($this->avail_fields as $name => $value) { |
1028 | 1028 | if (!empty($_REQUEST[$name])) { |
1029 | - $where_clauses[] = $this->bean->table_name . "_cstm.$name LIKE '" . $this->db->quote($_REQUEST[$name]) . "%'"; |
|
1029 | + $where_clauses[] = $this->bean->table_name."_cstm.$name LIKE '".$this->db->quote($_REQUEST[$name])."%'"; |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | return false; |
1051 | 1051 | } |
1052 | 1052 | |
1053 | - $query = 'SELECT * FROM ' . $this->bean->table_name . "_cstm WHERE id_c='" . $this->bean->id . "'"; |
|
1053 | + $query = 'SELECT * FROM '.$this->bean->table_name."_cstm WHERE id_c='".$this->bean->id."'"; |
|
1054 | 1054 | $result = $this->db->query($query); |
1055 | 1055 | $row = $this->db->fetchByAssoc($result); |
1056 | 1056 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $labels = array(); |
81 | 81 | foreach ($params as $key => $value) { |
82 | 82 | if (preg_match('/^label_/', $key) && strcmp($value, 'no_change') != 0) { |
83 | - $labels [ strtoupper(substr($key, 6)) ] = SugarCleaner::cleanHtml(from_html($value), false); |
|
83 | + $labels [strtoupper(substr($key, 6))] = SugarCleaner::cleanHtml(from_html($value), false); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | if (!empty($this->packageName)) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function removeLabel($language, $label, $labelvalue, $moduleName, $basepath = null, $forRelationshipLabel = false) |
105 | 105 | { |
106 | - $GLOBALS [ 'log' ]->debug("ParserLabel->removeLabels($language, \$label, \$labelvalue, $moduleName, $basepath );"); |
|
106 | + $GLOBALS ['log']->debug("ParserLabel->removeLabels($language, \$label, \$labelvalue, $moduleName, $basepath );"); |
|
107 | 107 | if (is_null($basepath)) { |
108 | 108 | $deployedModule = true; |
109 | 109 | $basepath = "custom/modules/$moduleName/language"; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | if ($changed) { |
152 | 152 | if (!write_array_to_file('mod_strings', $mod_strings, $filename)) { |
153 | - $GLOBALS [ 'log' ]->fatal("Could not write $filename"); |
|
153 | + $GLOBALS ['log']->fatal("Could not write $filename"); |
|
154 | 154 | } else { |
155 | 155 | // if we have a cache to worry about, then clear it now |
156 | 156 | if ($deployedModule) { |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public static function addLabels($language, $labels, $moduleName, $basepath = null, $forRelationshipLabel = false) |
176 | 176 | { |
177 | - $GLOBALS [ 'log' ]->debug("ParserLabel->addLabels($language, \$labels, $moduleName, $basepath );"); |
|
178 | - $GLOBALS [ 'log' ]->debug('$labels:'.print_r($labels, true)); |
|
177 | + $GLOBALS ['log']->debug("ParserLabel->addLabels($language, \$labels, $moduleName, $basepath );"); |
|
178 | + $GLOBALS ['log']->debug('$labels:'.print_r($labels, true)); |
|
179 | 179 | |
180 | 180 | $deployedModule = false; |
181 | 181 | if (is_null($basepath)) { |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | //$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ; |
215 | 215 | |
216 | 216 | foreach ($labels as $key => $value) { |
217 | - if (!isset($mod_strings [ $key ]) || strcmp($value, $mod_strings [ $key ]) != 0) { |
|
217 | + if (!isset($mod_strings [$key]) || strcmp($value, $mod_strings [$key]) != 0) { |
|
218 | 218 | $mod_strings [$key] = to_html(strip_tags(from_html($value))); // must match encoding used in view.labels.php |
219 | 219 | $changed = true; |
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | 223 | if ($changed) { |
224 | - $GLOBALS [ 'log' ]->debug("ParserLabel->addLabels: writing new mod_strings to $filename"); |
|
225 | - $GLOBALS [ 'log' ]->debug('ParserLabel->addLabels: mod_strings='.print_r($mod_strings, true)); |
|
224 | + $GLOBALS ['log']->debug("ParserLabel->addLabels: writing new mod_strings to $filename"); |
|
225 | + $GLOBALS ['log']->debug('ParserLabel->addLabels: mod_strings='.print_r($mod_strings, true)); |
|
226 | 226 | if (!write_array_to_file('mod_strings', $mod_strings, $filename)) { |
227 | - $GLOBALS [ 'log' ]->fatal("Could not write $filename"); |
|
227 | + $GLOBALS ['log']->fatal("Could not write $filename"); |
|
228 | 228 | } else { |
229 | 229 | // if we have a cache to worry about, then clear it now |
230 | 230 | if ($deployedModule) { |
231 | 231 | SugarCache::cleanOpcodes(); |
232 | - $GLOBALS [ 'log' ]->debug('PaserLabel->addLabels: clearing language cache'); |
|
232 | + $GLOBALS ['log']->debug('PaserLabel->addLabels: clearing language cache'); |
|
233 | 233 | $cache_key = 'module_language.'.$language.$moduleName; |
234 | 234 | sugar_cache_clear($cache_key); |
235 | 235 | LanguageManager::clearLanguageCache($moduleName, $language); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $file_contents = fopen($extension_filename, 'w'); |
280 | 280 | fputs($file_contents, $out, strlen($out)); |
281 | 281 | fclose($file_contents); |
282 | - } catch (Exception $e) { |
|
282 | + }catch (Exception $e) { |
|
283 | 283 | $GLOBALS ['log']->fatal("Could not write $filename"); |
284 | 284 | $GLOBALS ['log']->fatal('Exception '.$e->getMessage()); |
285 | 285 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $file_contents = fopen($relationships_filename, 'w'); |
322 | 322 | fputs($file_contents, $out, strlen($out)); |
323 | 323 | fclose($file_contents); |
324 | - } catch (Exception $e) { |
|
324 | + }catch (Exception $e) { |
|
325 | 325 | $GLOBALS ['log']->fatal("Could not write $filename"); |
326 | 326 | $GLOBALS ['log']->fatal('Exception '.$e->getMessage()); |
327 | 327 | $failed_to_write = true; |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | { |
357 | 357 | foreach ($metadata as $definition) { |
358 | 358 | $labels = array(); |
359 | - $labels[$definition [ 'system_label' ]] = $definition [ 'display_label' ]; |
|
360 | - self::addLabels($language, $labels, $definition [ 'module' ], null, true); |
|
359 | + $labels[$definition ['system_label']] = $definition ['display_label']; |
|
360 | + self::addLabels($language, $labels, $definition ['module'], null, true); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 |