@@ -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 | /********************************************************************************* |
5 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -83,18 +85,20 @@ discard block |
||
83 | 85 | $indexes = array_merge($custmIndexes,$indexes); |
84 | 86 | } |
85 | 87 | |
86 | - if ( $this->_focus->getFieldDefinition('email1') ) |
|
87 | - $indexes[] = array( |
|
88 | + if ( $this->_focus->getFieldDefinition('email1') ) { |
|
89 | + $indexes[] = array( |
|
88 | 90 | 'name' => 'special_idx_email1', |
89 | 91 | 'type' => 'index', |
90 | 92 | 'fields' => array('email1') |
91 | 93 | ); |
92 | - if ( $this->_focus->getFieldDefinition('email2') ) |
|
93 | - $indexes[] = array( |
|
94 | + } |
|
95 | + if ( $this->_focus->getFieldDefinition('email2') ) { |
|
96 | + $indexes[] = array( |
|
94 | 97 | 'name' => 'special_idx_email2', |
95 | 98 | 'type' => 'index', |
96 | 99 | 'fields' => array('email2') |
97 | 100 | ); |
101 | + } |
|
98 | 102 | |
99 | 103 | return $indexes; |
100 | 104 | } |
@@ -116,12 +120,15 @@ discard block |
||
116 | 120 | if ($index['type'] == "index"){ |
117 | 121 | $labelsArray = array(); |
118 | 122 | foreach ($index['fields'] as $field){ |
119 | - if ($field == 'deleted') continue; |
|
123 | + if ($field == 'deleted') { |
|
124 | + continue; |
|
125 | + } |
|
120 | 126 | $fieldDef = $this->_focus->getFieldDefinition($field); |
121 | - if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) |
|
122 | - $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
|
123 | - else |
|
124 | - $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
|
127 | + if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) { |
|
128 | + $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
|
129 | + } else { |
|
130 | + $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
|
131 | + } |
|
125 | 132 | } |
126 | 133 | $index_array[$index['name']] = str_replace(":", "",implode(", ",$labelsArray)); |
127 | 134 | } |
@@ -144,33 +151,37 @@ discard block |
||
144 | 151 | { |
145 | 152 | $emailAddress = new SugarEmailAddress(); |
146 | 153 | $email = $field; |
147 | - if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) |
|
148 | - return true; |
|
149 | - } |
|
150 | - else |
|
154 | + if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) { |
|
155 | + return true; |
|
156 | + } |
|
157 | + } else |
|
151 | 158 | { |
152 | 159 | $index_fields = array('deleted' => '0'); |
153 | 160 | if( is_array($field) ) |
154 | 161 | { |
155 | 162 | foreach($field as $tmpField) |
156 | 163 | { |
157 | - if ($tmpField == 'deleted') |
|
158 | - continue; |
|
159 | - if (strlen($this->_focus->$tmpField) > 0) |
|
160 | - $index_fields[$tmpField] = $this->_focus->$tmpField; |
|
164 | + if ($tmpField == 'deleted') { |
|
165 | + continue; |
|
166 | + } |
|
167 | + if (strlen($this->_focus->$tmpField) > 0) { |
|
168 | + $index_fields[$tmpField] = $this->_focus->$tmpField; |
|
169 | + } |
|
161 | 170 | } |
171 | + } elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) { |
|
172 | + $index_fields[$field] = $this->_focus->$field; |
|
162 | 173 | } |
163 | - elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) |
|
164 | - $index_fields[$field] = $this->_focus->$field; |
|
165 | 174 | |
166 | - if ( count($index_fields) <= 1 ) |
|
167 | - continue; |
|
175 | + if ( count($index_fields) <= 1 ) { |
|
176 | + continue; |
|
177 | + } |
|
168 | 178 | |
169 | 179 | $newfocus = loadBean($this->_focus->module_dir); |
170 | 180 | $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
171 | 181 | |
172 | - if ( !is_null($result) ) |
|
173 | - return true; |
|
182 | + if ( !is_null($result) ) { |
|
183 | + return true; |
|
184 | + } |
|
174 | 185 | } |
175 | 186 | } |
176 | 187 | |
@@ -204,13 +215,15 @@ discard block |
||
204 | 215 | $fieldlist=array(); |
205 | 216 | $customIndexlist=array(); |
206 | 217 | foreach($origIndexList as $iv){ |
207 | - if(empty($iv)) continue; |
|
218 | + if(empty($iv)) { |
|
219 | + continue; |
|
220 | + } |
|
208 | 221 | $field_index_array = explode('::',$iv); |
209 | 222 | if($field_index_array[0] == 'customfield'){ |
210 | 223 | //this is a custom field, so place in custom array |
211 | 224 | $customIndexlist[] = $field_index_array[1]; |
212 | 225 | |
213 | - }else{ |
|
226 | + } else{ |
|
214 | 227 | //this is not a custom field, so place in index list |
215 | 228 | $indexlist[] = $field_index_array[0]; |
216 | 229 | if(isset($field_index_array[1])) { |
@@ -237,8 +250,9 @@ discard block |
||
237 | 250 | // loop through var def indexes and compare with selected indexes |
238 | 251 | foreach ($this->_getIndexVardefs() as $index){ |
239 | 252 | // if we get an index not in the indexlist, loop |
240 | - if ( !in_array($index['name'],$indexlist) ) |
|
241 | - continue; |
|
253 | + if ( !in_array($index['name'],$indexlist) ) { |
|
254 | + continue; |
|
255 | + } |
|
242 | 256 | |
243 | 257 | // This handles the special case of duplicate email checking |
244 | 258 | if ( $index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2' ) { |
@@ -249,31 +263,35 @@ discard block |
||
249 | 263 | $this->_focus, |
250 | 264 | ($index['name'] == 'special_idx_email1') |
251 | 265 | ) > 0 ){ foreach($index['fields'] as $field){ |
252 | - if($field !='deleted') |
|
253 | - $this->_dupedFields[] = $field; |
|
266 | + if($field !='deleted') { |
|
267 | + $this->_dupedFields[] = $field; |
|
268 | + } |
|
254 | 269 | } |
255 | 270 | } |
256 | 271 | } |
257 | 272 | // Adds a hook so you can define a method in the bean to handle dupe checking |
258 | 273 | elseif ( isset($index['dupeCheckFunction']) ) { |
259 | 274 | $functionName = substr_replace($index['dupeCheckFunction'],'',0,9); |
260 | - if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) |
|
261 | - return $this->_focus->$functionName($index); |
|
262 | - } |
|
263 | - else { |
|
275 | + if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) { |
|
276 | + return $this->_focus->$functionName($index); |
|
277 | + } |
|
278 | + } else { |
|
264 | 279 | $index_fields = array('deleted' => '0'); |
265 | 280 | //search only for the field we have selected |
266 | 281 | foreach($index['fields'] as $field){ |
267 | - if ($field == 'deleted' || !in_array($field,$fieldlist)) |
|
268 | - continue; |
|
269 | - if (!in_array($field,$index_fields)) |
|
270 | - if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
|
282 | + if ($field == 'deleted' || !in_array($field,$fieldlist)) { |
|
283 | + continue; |
|
284 | + } |
|
285 | + if (!in_array($field,$index_fields)) { |
|
286 | + if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
|
271 | 287 | $index_fields[$field] = $this->_focus->$field; |
288 | + } |
|
272 | 289 | } |
273 | 290 | |
274 | 291 | // if there are no valid fields in the index field list, loop |
275 | - if ( count($index_fields) <= 1 ) |
|
276 | - continue; |
|
292 | + if ( count($index_fields) <= 1 ) { |
|
293 | + continue; |
|
294 | + } |
|
277 | 295 | |
278 | 296 | $newfocus = loadBean($this->_focus->module_dir); |
279 | 297 | $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
@@ -320,11 +338,15 @@ discard block |
||
320 | 338 | $fieldName=''; |
321 | 339 | |
322 | 340 | //skip this field if it is the deleted field, not in the importable keys array, or a field in the exclude array |
323 | - if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) continue; |
|
341 | + if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) { |
|
342 | + continue; |
|
343 | + } |
|
324 | 344 | $fieldDef = $this->_focus->getFieldDefinition($field); |
325 | 345 | |
326 | 346 | //skip if this field is already defined (from another index) |
327 | - if (in_array($fieldDef['name'],$fields_used)) continue; |
|
347 | + if (in_array($fieldDef['name'],$fields_used)) { |
|
348 | + continue; |
|
349 | + } |
|
328 | 350 | |
329 | 351 | //get the proper export label |
330 | 352 | $fieldName = translateForExport($fieldDef['name'],$this->_focus); |
@@ -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. |
@@ -52,12 +54,16 @@ discard block |
||
52 | 54 | |
53 | 55 | if(!empty($fields['DESCRIPTION'])) { |
54 | 56 | $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300); |
55 | - if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...'; |
|
57 | + if(strlen($fields['DESCRIPTION']) > 300) { |
|
58 | + $overlib_string .= '...'; |
|
59 | + } |
|
56 | 60 | $overlib_string .= '<br>'; |
57 | 61 | } |
58 | 62 | if(!empty($fields['RESOLUTION'])) { |
59 | 63 | $overlib_string .= '<b>'. $mod_strings['LBL_RESOLUTION'] . '</b> ' . substr($fields['RESOLUTION'], 0, 300); |
60 | - if(strlen($fields['RESOLUTION']) > 300) $overlib_string .= '...'; |
|
64 | + if(strlen($fields['RESOLUTION']) > 300) { |
|
65 | + $overlib_string .= '...'; |
|
66 | + } |
|
61 | 67 | } |
62 | 68 | |
63 | 69 | return array('fieldToAddTo' => 'NAME', |
@@ -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. |
@@ -69,7 +71,9 @@ discard block |
||
69 | 71 | |
70 | 72 | $button = "<form action='index.php' method='post' name='form' id='form'>\n"; |
71 | 73 | $button .= "<input type='hidden' name='module' value='Opportunities'>\n"; |
72 | -if ($currentModule == 'Accounts') $button .= "<input type='hidden' name='account_id' value='$focus->id'>\n<input type='hidden' name='account_name' value=\"".urlencode($focus->name)."\">\n"; |
|
74 | +if ($currentModule == 'Accounts') { |
|
75 | + $button .= "<input type='hidden' name='account_id' value='$focus->id'>\n<input type='hidden' name='account_name' value=\"".urlencode($focus->name)."\">\n"; |
|
76 | +} |
|
73 | 77 | if ($currentModule == 'Contacts') { |
74 | 78 | $button .= "<input type='hidden' name='account_id' value='$focus->account_id'>\n<input type='hidden' name='account_name' value=\"".urlencode($focus->account_name)."\">\n"; |
75 | 79 | $button .= "<input type='hidden' name='contact_id' value='$focus->id'>\n"; |
@@ -105,8 +109,7 @@ discard block |
||
105 | 109 | ."' type='button' class='button' value=' ".$app_strings['LBL_SELECT_BUTTON_LABEL'] |
106 | 110 | ." ' name='button' onclick='open_popup(\"Opportunities\", 600, 400, \"\", false, true, {$encoded_popup_request_data});'>\n"; |
107 | 111 | // ." ' name='button' onclick='window.open(\"index.php?module=Opportunities&action=Popup&html=Popup_picker&form=DetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'>\n"; |
108 | -} |
|
109 | -else |
|
112 | +} else |
|
110 | 113 | { |
111 | 114 | /////////////////////////////////////// |
112 | 115 | /// |
@@ -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. |
@@ -45,15 +47,25 @@ discard block |
||
45 | 47 | $mod_strings = return_module_language($current_language, 'Opportunities'); |
46 | 48 | $overlib_string = ''; |
47 | 49 | |
48 | - if(!empty($fields['LEAD_SOURCE'])) $overlib_string .= '<b>'. $mod_strings['LBL_LEAD_SOURCE'] . '</b> ' . $fields['LEAD_SOURCE'] . '<br>'; |
|
49 | - if(!empty($fields['PROBABILITY'])) $overlib_string .= '<b>'. $mod_strings['LBL_PROBABILITY'] . '</b> ' . $fields['PROBABILITY'] . '<br>'; |
|
50 | - if(!empty($fields['NEXT_STEP'])) $overlib_string .= '<b>'. $mod_strings['LBL_NEXT_STEP'] . '</b> ' . $fields['NEXT_STEP'] . '<br>'; |
|
51 | - if(!empty($fields['OPPORTUNITY_TYPE'])) $overlib_string .= '<b>'. $mod_strings['LBL_TYPE'] . '</b> ' . $fields['OPPORTUNITY_TYPE'] . '<br>'; |
|
50 | + if(!empty($fields['LEAD_SOURCE'])) { |
|
51 | + $overlib_string .= '<b>'. $mod_strings['LBL_LEAD_SOURCE'] . '</b> ' . $fields['LEAD_SOURCE'] . '<br>'; |
|
52 | + } |
|
53 | + if(!empty($fields['PROBABILITY'])) { |
|
54 | + $overlib_string .= '<b>'. $mod_strings['LBL_PROBABILITY'] . '</b> ' . $fields['PROBABILITY'] . '<br>'; |
|
55 | + } |
|
56 | + if(!empty($fields['NEXT_STEP'])) { |
|
57 | + $overlib_string .= '<b>'. $mod_strings['LBL_NEXT_STEP'] . '</b> ' . $fields['NEXT_STEP'] . '<br>'; |
|
58 | + } |
|
59 | + if(!empty($fields['OPPORTUNITY_TYPE'])) { |
|
60 | + $overlib_string .= '<b>'. $mod_strings['LBL_TYPE'] . '</b> ' . $fields['OPPORTUNITY_TYPE'] . '<br>'; |
|
61 | + } |
|
52 | 62 | |
53 | 63 | if(!empty($fields['DESCRIPTION'])) { |
54 | 64 | $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> '; |
55 | 65 | $overlib_string .= substr($fields['DESCRIPTION'], 0, 300); |
56 | - if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...'; |
|
66 | + if(strlen($fields['DESCRIPTION']) > 300) { |
|
67 | + $overlib_string .= '...'; |
|
68 | + } |
|
57 | 69 | } |
58 | 70 | |
59 | 71 | return array('fieldToAddTo' => 'NAME', |
@@ -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. |
@@ -65,7 +67,9 @@ discard block |
||
65 | 67 | $i++; |
66 | 68 | $rows[$i] = $row; |
67 | 69 | } |
68 | - if ($i==-1) return null; |
|
70 | + if ($i==-1) { |
|
71 | + return null; |
|
72 | + } |
|
69 | 73 | |
70 | 74 | return $rows; |
71 | 75 | } |
@@ -77,7 +81,9 @@ discard block |
||
77 | 81 | if(!empty($mod)){ |
78 | 82 | global $current_language; |
79 | 83 | $mod_strings = return_module_language($current_language, $mod); |
80 | - }else global $mod_strings; |
|
84 | + } else { |
|
85 | + global $mod_strings; |
|
86 | + } |
|
81 | 87 | global $app_strings; |
82 | 88 | $cols = sizeof($rows[0]) * 2 + 1; |
83 | 89 | $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>'; |
@@ -108,14 +114,14 @@ discard block |
||
108 | 114 | if(!$wasSet){ |
109 | 115 | $form .= "<td scope='row'><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>"; |
110 | 116 | $wasSet = true; |
111 | - }else{ |
|
117 | + } else{ |
|
112 | 118 | $form .= "<td><a target='_blank' href='index.php?module=Opportunities&action=DetailView&record=${row['id']}'>$value</a></td>"; |
113 | 119 | } |
114 | 120 | }} |
115 | 121 | |
116 | 122 | if($rowColor == 'evenListRowS1'){ |
117 | 123 | $rowColor = 'oddListRowS1'; |
118 | - }else{ |
|
124 | + } else{ |
|
119 | 125 | $rowColor = 'evenListRowS1'; |
120 | 126 | } |
121 | 127 | $form .= "</tr>"; |
@@ -136,7 +142,9 @@ discard block |
||
136 | 142 | if(!empty($mod)){ |
137 | 143 | global $current_language; |
138 | 144 | $mod_strings = return_module_language($current_language, $mod); |
139 | -}else global $mod_strings; |
|
145 | +} else { |
|
146 | + global $mod_strings; |
|
147 | +} |
|
140 | 148 | global $app_strings; |
141 | 149 | global $sugar_version, $sugar_config; |
142 | 150 | |
@@ -286,7 +294,9 @@ discard block |
||
286 | 294 | EOQ; |
287 | 295 | //carry forward custom lead fields to opportunities during Lead Conversion |
288 | 296 | $tempOpp = new Opportunity(); |
289 | - if (method_exists($lead, 'convertCustomFieldsForm')) $lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix); |
|
297 | + if (method_exists($lead, 'convertCustomFieldsForm')) { |
|
298 | + $lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix); |
|
299 | + } |
|
290 | 300 | unset($tempOpp); |
291 | 301 | |
292 | 302 | $the_form .= <<<EOQ |
@@ -321,7 +331,9 @@ discard block |
||
321 | 331 | if(!empty($mod)){ |
322 | 332 | global $current_language; |
323 | 333 | $mod_strings = return_module_language($current_language, $mod); |
324 | -}else global $mod_strings; |
|
334 | +} else { |
|
335 | + global $mod_strings; |
|
336 | +} |
|
325 | 337 | global $app_strings; |
326 | 338 | global $app_list_strings; |
327 | 339 | global $theme; |
@@ -461,7 +473,7 @@ discard block |
||
461 | 473 | $GLOBALS['log']->debug("Saved record with id of ".$return_id); |
462 | 474 | if($redirect){ |
463 | 475 | handleRedirect($return_id,"Opportunities" ); |
464 | - }else{ |
|
476 | + } else{ |
|
465 | 477 | return $focus; |
466 | 478 | } |
467 | 479 | } |
@@ -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. |
@@ -153,8 +155,9 @@ discard block |
||
153 | 155 | if(empty($focus->name)){ |
154 | 156 | return null; |
155 | 157 | } |
156 | - if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' ) |
|
157 | - $focus->assigned_user_id = $GLOBALS['current_user']->id; |
|
158 | + if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' ) { |
|
159 | + $focus->assigned_user_id = $GLOBALS['current_user']->id; |
|
160 | + } |
|
158 | 161 | |
159 | 162 | $return_id = $focus->save(); |
160 | 163 | if($redirect){ |
@@ -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. |
@@ -122,19 +124,21 @@ discard block |
||
122 | 124 | $where_auto = '1=1'; |
123 | 125 | if($show_deleted == 0){ |
124 | 126 | $where_auto = "$this->table_name.deleted=0"; |
125 | - }else if($show_deleted == 1){ |
|
127 | + } else if($show_deleted == 1){ |
|
126 | 128 | $where_auto = "$this->table_name.deleted=1"; |
127 | 129 | } |
128 | 130 | |
129 | - if($where != "") |
|
130 | - $query .= "where $where AND ".$where_auto; |
|
131 | - else |
|
132 | - $query .= "where ".$where_auto; |
|
131 | + if($where != "") { |
|
132 | + $query .= "where $where AND ".$where_auto; |
|
133 | + } else { |
|
134 | + $query .= "where ".$where_auto; |
|
135 | + } |
|
133 | 136 | |
134 | - if($order_by != "") |
|
135 | - $query .= " ORDER BY $order_by"; |
|
136 | - else |
|
137 | - $query .= " ORDER BY prospect_lists.name"; |
|
137 | + if($order_by != "") { |
|
138 | + $query .= " ORDER BY $order_by"; |
|
139 | + } else { |
|
140 | + $query .= " ORDER BY prospect_lists.name"; |
|
141 | + } |
|
138 | 142 | |
139 | 143 | return $query; |
140 | 144 | } |
@@ -152,15 +156,17 @@ discard block |
||
152 | 156 | |
153 | 157 | $where_auto = " prospect_lists.deleted=0"; |
154 | 158 | |
155 | - if($where != "") |
|
156 | - $query .= " WHERE $where AND ".$where_auto; |
|
157 | - else |
|
158 | - $query .= " WHERE ".$where_auto; |
|
159 | - |
|
160 | - if($order_by != "") |
|
161 | - $query .= " ORDER BY $order_by"; |
|
162 | - else |
|
163 | - $query .= " ORDER BY prospect_lists.name"; |
|
159 | + if($where != "") { |
|
160 | + $query .= " WHERE $where AND ".$where_auto; |
|
161 | + } else { |
|
162 | + $query .= " WHERE ".$where_auto; |
|
163 | + } |
|
164 | + |
|
165 | + if($order_by != "") { |
|
166 | + $query .= " ORDER BY $order_by"; |
|
167 | + } else { |
|
168 | + $query .= " ORDER BY prospect_lists.name"; |
|
169 | + } |
|
164 | 170 | return $query; |
165 | 171 | } |
166 | 172 | |
@@ -287,12 +293,15 @@ discard block |
||
287 | 293 | function save_relationship_changes($is_update, $exclude = array()) |
288 | 294 | { |
289 | 295 | parent::save_relationship_changes($is_update, $exclude); |
290 | - if($this->lead_id != "") |
|
291 | - $this->set_prospect_relationship($this->id, $this->lead_id, "lead"); |
|
292 | - if($this->contact_id != "") |
|
293 | - $this->set_prospect_relationship($this->id, $this->contact_id, "contact"); |
|
294 | - if($this->prospect_id != "") |
|
295 | - $this->set_prospect_relationship($this->id, $this->contact_id, "prospect"); |
|
296 | + if($this->lead_id != "") { |
|
297 | + $this->set_prospect_relationship($this->id, $this->lead_id, "lead"); |
|
298 | + } |
|
299 | + if($this->contact_id != "") { |
|
300 | + $this->set_prospect_relationship($this->id, $this->contact_id, "contact"); |
|
301 | + } |
|
302 | + if($this->prospect_id != "") { |
|
303 | + $this->set_prospect_relationship($this->id, $this->contact_id, "prospect"); |
|
304 | + } |
|
296 | 305 | } |
297 | 306 | |
298 | 307 | function set_prospect_relationship($prospect_list_id, &$link_ids, $link_name) |
@@ -350,10 +359,11 @@ discard block |
||
350 | 359 | |
351 | 360 | $row = $this->db->fetchByAssoc($result); |
352 | 361 | |
353 | - if($row) |
|
354 | - return $row['num']; |
|
355 | - else |
|
356 | - return 0; |
|
362 | + if($row) { |
|
363 | + return $row['num']; |
|
364 | + } else { |
|
365 | + return 0; |
|
366 | + } |
|
357 | 367 | } |
358 | 368 | |
359 | 369 | |
@@ -375,7 +385,9 @@ discard block |
||
375 | 385 | $the_where = ""; |
376 | 386 | foreach($where_clauses as $clause) |
377 | 387 | { |
378 | - if($the_where != "") $the_where .= " or "; |
|
388 | + if($the_where != "") { |
|
389 | + $the_where .= " or "; |
|
390 | + } |
|
379 | 391 | $the_where .= $clause; |
380 | 392 | } |
381 | 393 |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $img = ob_get_clean(); |
212 | 212 | if($asDataURI){ |
213 | 213 | return 'data:image/png;base64,'.base64_encode($img); |
214 | - }else{ |
|
214 | + } else{ |
|
215 | 215 | return $img; |
216 | 216 | } |
217 | 217 | } |
@@ -356,8 +356,9 @@ discard block |
||
356 | 356 | |
357 | 357 | $dataArray = json_decode($chartDataValues); |
358 | 358 | $grouping = 'grouped'; //$mainGroupField->label; //'grouped'; |
359 | - if(!$grouped) |
|
360 | - $grouping='stacked'; |
|
359 | + if(!$grouped) { |
|
360 | + $grouping='stacked'; |
|
361 | + } |
|
361 | 362 | if(!is_array($dataArray)||count($dataArray) < 1) |
362 | 363 | { |
363 | 364 | return "<h3>$this->noDataMessage</h3>"; |
@@ -631,9 +632,9 @@ discard block |
||
631 | 632 | if(strlen($label) > $maxLabelSize) |
632 | 633 | { |
633 | 634 | return substr($label,0,$maxLabelSize).'...'; |
635 | + } else { |
|
636 | + return $label; |
|
634 | 637 | } |
635 | - else |
|
636 | - return $label; |
|
637 | 638 | } |
638 | 639 | |
639 | 640 |
@@ -84,8 +84,7 @@ discard block |
||
84 | 84 | $html .= '<script>insertGroup();</script>'; |
85 | 85 | } |
86 | 86 | |
87 | - } |
|
88 | - else if($view == 'DetailView'){ |
|
87 | + } else if($view == 'DetailView'){ |
|
89 | 88 | $params = array('currency_id' => $focus->currency_id); |
90 | 89 | |
91 | 90 | $sql = "SELECT pg.id, pg.group_id FROM aos_products_quotes pg LEFT JOIN aos_line_item_groups lig ON pg.group_id = lig.id WHERE pg.parent_type = '".$focus->object_name."' AND pg.parent_id = '".$focus->id."' AND pg.deleted = 0 ORDER BY lig.number ASC, pg.number ASC"; |
@@ -111,7 +110,9 @@ discard block |
||
111 | 110 | |
112 | 111 | if($enable_groups && ($group_id != $row['group_id'] || $i == 0)){ |
113 | 112 | $html .= $groupStart.$product.$service.$groupEnd; |
114 | - if($i != 0)$html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>"; |
|
113 | + if($i != 0) { |
|
114 | + $html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>"; |
|
115 | + } |
|
115 | 116 | $groupStart = ''; |
116 | 117 | $groupEnd = ''; |
117 | 118 | $product = ''; |
@@ -229,15 +230,13 @@ discard block |
||
229 | 230 | if($type == 'Amount') |
230 | 231 | { |
231 | 232 | return currency_format_number($amount,$params )."</td>"; |
232 | - } |
|
233 | - else if($locale->getPrecision()) |
|
233 | + } else if($locale->getPrecision()) |
|
234 | 234 | { |
235 | 235 | return rtrim(rtrim(format_number($amount), '0'),$sep[1])."%"; |
236 | 236 | } else{ |
237 | 237 | return format_number($amount)."%"; |
238 | 238 | } |
239 | - } |
|
240 | - else |
|
239 | + } else |
|
241 | 240 | { |
242 | 241 | return "-"; |
243 | 242 | } |
@@ -248,7 +247,9 @@ discard block |
||
248 | 247 | if($view == 'EditView'){ |
249 | 248 | global $app_list_strings; |
250 | 249 | |
251 | - if($value != '') $value = format_number($value); |
|
250 | + if($value != '') { |
|
251 | + $value = format_number($value); |
|
252 | + } |
|
252 | 253 | |
253 | 254 | $html = "<input id='shipping_tax_amt' type='text' tabindex='0' title='' value='".$value."' maxlength='26,6' size='22' name='shipping_tax_amt' onblur='calculateTotal(\"lineItems\");'>"; |
254 | 255 | $html .= "<select name='shipping_tax' id='shipping_tax' onchange='calculateTotal(\"lineItems\");' >".get_select_options_with_id($app_list_strings['vat_list'], (isset($focus->shipping_tax) ? $focus->shipping_tax : ''))."</select>"; |