@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | array_push($recordIds, $val['id']); |
55 | 55 | } |
56 | - } |
|
57 | - else{ |
|
56 | + } else{ |
|
58 | 57 | $recordIds = explode(',',$_REQUEST['uid']); |
59 | 58 | } |
60 | 59 | |
@@ -150,7 +149,7 @@ discard block |
||
150 | 149 | |
151 | 150 | rename($sugar_config['upload_dir'].'nfile.pdf',$sugar_config['upload_dir'].$note->id); |
152 | 151 | |
153 | - }catch(mPDF_exception $e){ |
|
152 | + } catch(mPDF_exception $e){ |
|
154 | 153 | echo $e; |
155 | 154 | } |
156 | 155 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | global $app_strings, $sugar_config; |
31 | 31 | if (preg_match('/^6\./', $sugar_config['sugar_version'])) { |
32 | 32 | $script = '<a href="#" style="width: 150px" class="menuItem" onmouseover="hiliteItem(this,\'yes\');" onmouseout="unhiliteItem(this);" onclick="showPopup()">'.$app_strings['LBL_GENERATE_LETTER'].'</a>'; |
33 | - } |
|
34 | - else{ |
|
33 | + } else{ |
|
35 | 34 | $script = ' <input class="button" type="button" value="'.$app_strings['LBL_GENERATE_LETTER'].'" ' .'onClick="showPopup();">'; |
36 | 35 | } |
37 | 36 | |
@@ -96,8 +95,7 @@ discard block |
||
96 | 95 | } |
97 | 96 | } |
98 | 97 | </script>'; |
99 | - } |
|
100 | - else{ |
|
98 | + } else{ |
|
101 | 99 | echo '<script> |
102 | 100 | function showPopup(){ |
103 | 101 | alert(\''.$app_strings['LBL_NO_TEMPLATE'].'\'); |
@@ -148,8 +146,7 @@ discard block |
||
148 | 146 | } |
149 | 147 | } |
150 | 148 | </script>'; |
151 | - } |
|
152 | - else{ |
|
149 | + } else{ |
|
153 | 150 | echo '<script> |
154 | 151 | function showPopup(){ |
155 | 152 | alert(\''.$app_strings['LBL_NO_TEMPLATE'].'\'); |
@@ -131,17 +131,16 @@ discard block |
||
131 | 131 | $pdf->writeHTML($printable); |
132 | 132 | if($task == 'pdf'){ |
133 | 133 | $pdf->Output($file_name, "D"); |
134 | - }else{ |
|
134 | + } else{ |
|
135 | 135 | $fp = fopen($sugar_config['upload_dir'].'attachfile.pdf','wb'); |
136 | 136 | fclose($fp); |
137 | 137 | $pdf->Output($sugar_config['upload_dir'].'attachfile.pdf','F'); |
138 | 138 | sendEmail::send_email($module,$module_type, '',$file_name, true,$module->id); |
139 | 139 | } |
140 | - }catch(mPDF_exception $e){ |
|
140 | + } catch(mPDF_exception $e){ |
|
141 | 141 | echo $e; |
142 | 142 | } |
143 | - } |
|
144 | - else if($task == 'email') |
|
143 | + } else if($task == 'email') |
|
145 | 144 | { |
146 | 145 | sendEmail::send_email($module,$module_type, $printable,'', false); |
147 | 146 | } |
@@ -222,8 +221,7 @@ discard block |
||
222 | 221 | } |
223 | 222 | $tcount=strpos($parts[1],$endElement)+strlen($endElement); |
224 | 223 | $parts[1]= substr($parts[1],$tcount); |
225 | - } |
|
226 | - else{ |
|
224 | + } else{ |
|
227 | 225 | $tcount = strrpos($text,$startElement); |
228 | 226 | $text = substr($text,0,$tcount); |
229 | 227 | |
@@ -309,8 +307,7 @@ discard block |
||
309 | 307 | //check if there is only one line item |
310 | 308 | if($firstNum == $lastNum){ |
311 | 309 | $linePart = $firstValue; |
312 | - } |
|
313 | - else{ |
|
310 | + } else{ |
|
314 | 311 | $tparts = explode($lastValue,$tparts[1]); |
315 | 312 | $linePart = $firstValue . $tparts[0] . $lastValue; |
316 | 313 | } |
@@ -390,8 +387,7 @@ discard block |
||
390 | 387 | //check if there is only one line item |
391 | 388 | if($firstNum == $lastNum){ |
392 | 389 | $linePart = $firstValue; |
393 | - } |
|
394 | - else{ |
|
390 | + } else{ |
|
395 | 391 | $tparts = explode($lastValue,$tparts[1]); |
396 | 392 | $linePart = $firstValue . $tparts[0] . $lastValue; |
397 | 393 | } |
@@ -44,10 +44,11 @@ |
||
44 | 44 | $email->type = "draft"; |
45 | 45 | $email->status = "draft"; |
46 | 46 | |
47 | - if(!empty($module->billing_contact_id) && $module->billing_contact_id!="") |
|
48 | - $contact_id = $module->billing_contact_id; |
|
49 | - else if(!empty($module->contact_id) && $module->contact_id!="") |
|
50 | - $contact_id = $module->contact_id; |
|
47 | + if(!empty($module->billing_contact_id) && $module->billing_contact_id!="") { |
|
48 | + $contact_id = $module->billing_contact_id; |
|
49 | + } else if(!empty($module->contact_id) && $module->contact_id!="") { |
|
50 | + $contact_id = $module->contact_id; |
|
51 | + } |
|
51 | 52 | |
52 | 53 | require_once('modules/Contacts/Contact.php'); |
53 | 54 | $contact = new Contact; |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | } //End loop. |
48 | 48 | |
49 | 49 | foreach($unset as $name){ |
50 | - if(isset($fields[$name])) unset( $fields[$name]); |
|
50 | + if(isset($fields[$name])) { |
|
51 | + unset( $fields[$name]); |
|
52 | + } |
|
51 | 53 | } |
52 | 54 | |
53 | 55 | } |
@@ -124,7 +126,7 @@ discard block |
||
124 | 126 | if(isset($arr['vname']) && $arr['vname'] != '') { |
125 | 127 | $label = $rel_module_label . ' : ' . translate($arr['vname'], $mod->module_dir); |
126 | 128 | $module_label = trim(translate($arr['vname'],$mod->module_dir),':'); |
127 | - }else { |
|
129 | + } else { |
|
128 | 130 | $label = $rel_module_label . ' : '. $name; |
129 | 131 | $module_label = $name; |
130 | 132 | } |
@@ -175,7 +177,9 @@ discard block |
||
175 | 177 | $sort_fields[$name] = $relModuleName.' : '. $name; |
176 | 178 | } |
177 | 179 | if($arr['type'] == 'relate' && isset($arr['id_name']) && $arr['id_name'] != ''){ |
178 | - if(isset($fields[$arr['id_name']])) unset( $fields[$arr['id_name']]); |
|
180 | + if(isset($fields[$arr['id_name']])) { |
|
181 | + unset( $fields[$arr['id_name']]); |
|
182 | + } |
|
179 | 183 | } |
180 | 184 | } |
181 | 185 | } //End loop. |
@@ -269,7 +273,9 @@ discard block |
||
269 | 273 | $vardef['type'] = 'varchar'; |
270 | 274 | } |
271 | 275 | |
272 | - if(isset($vardef['precision'])) unset($vardef['precision']); |
|
276 | + if(isset($vardef['precision'])) { |
|
277 | + unset($vardef['precision']); |
|
278 | + } |
|
273 | 279 | |
274 | 280 | //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); |
275 | 281 | |
@@ -308,8 +314,9 @@ discard block |
||
308 | 314 | // remove the special text entry field function 'getEmailAddressWidget' |
309 | 315 | if ( isset($vardef['function']) |
310 | 316 | && ( $vardef['function'] == 'getEmailAddressWidget' |
311 | - || $vardef['function']['name'] == 'getEmailAddressWidget' ) ) |
|
312 | - unset($vardef['function']); |
|
317 | + || $vardef['function']['name'] == 'getEmailAddressWidget' ) ) { |
|
318 | + unset($vardef['function']); |
|
319 | + } |
|
313 | 320 | |
314 | 321 | if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){ |
315 | 322 | $vardef['name'] = 'aow_temp_date'; |
@@ -334,8 +341,9 @@ discard block |
||
334 | 341 | } |
335 | 342 | |
336 | 343 | // hack to disable one of the js calls in this control |
337 | - if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) ) |
|
338 | - $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
344 | + if ( isset($vardef['function']) && ( $vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown' ) ) { |
|
345 | + $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
346 | + } |
|
339 | 347 | |
340 | 348 | // Save it to the cache file |
341 | 349 | if($fh = @sugar_fopen($file, 'w')) { |
@@ -361,8 +369,7 @@ discard block |
||
361 | 369 | $t23 = strpos($time_format, '23') !== false ? '%H' : '%I'; |
362 | 370 | if(!isset($match[2]) || $match[2] == '') { |
363 | 371 | $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M"); |
364 | - } |
|
365 | - else { |
|
372 | + } else { |
|
366 | 373 | $pm = $match[2] == "pm" ? "%P" : "%p"; |
367 | 374 | $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm); |
368 | 375 | } |
@@ -371,8 +378,9 @@ discard block |
||
371 | 378 | |
372 | 379 | // populate the fieldlist from the vardefs |
373 | 380 | $fieldlist = array(); |
374 | - if ( !isset($focus) || !($focus instanceof SugarBean) ) |
|
375 | - require_once($beanFiles[$beanList[$module]]); |
|
381 | + if ( !isset($focus) || !($focus instanceof SugarBean) ) { |
|
382 | + require_once($beanFiles[$beanList[$module]]); |
|
383 | + } |
|
376 | 384 | $focus = new $beanList[$module]; |
377 | 385 | // create the dropdowns for the parent type fields |
378 | 386 | $vardefFields = $focus->getFieldDefinitions(); |
@@ -382,14 +390,17 @@ discard block |
||
382 | 390 | foreach ( $vardefFields as $name => $properties ) { |
383 | 391 | $fieldlist[$name] = $properties; |
384 | 392 | // fill in enums |
385 | - if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) |
|
386 | - $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
393 | + if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) { |
|
394 | + $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
395 | + } |
|
387 | 396 | // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings |
388 | - elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) |
|
389 | - $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
397 | + elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) { |
|
398 | + $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
399 | + } |
|
390 | 400 | // Bug 22730: make sure all enums have the ability to select blank as the default value. |
391 | - if(!isset($fieldlist[$name]['options'][''])) |
|
392 | - $fieldlist[$name]['options'][''] = ''; |
|
401 | + if(!isset($fieldlist[$name]['options'][''])) { |
|
402 | + $fieldlist[$name]['options'][''] = ''; |
|
403 | + } |
|
393 | 404 | } |
394 | 405 | |
395 | 406 | // fill in function return values |
@@ -399,8 +410,9 @@ discard block |
||
399 | 410 | { |
400 | 411 | $function = $fieldlist[$fieldname]['function']['name']; |
401 | 412 | // include various functions required in the various vardefs |
402 | - if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) |
|
403 | - require_once($fieldlist[$fieldname]['function']['include']); |
|
413 | + if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) { |
|
414 | + require_once($fieldlist[$fieldname]['function']['include']); |
|
415 | + } |
|
404 | 416 | $_REQUEST[$fieldname] = $value; |
405 | 417 | $value = $function($focus, $fieldname, $value, $view); |
406 | 418 | |
@@ -456,9 +468,11 @@ discard block |
||
456 | 468 | $value = $focus->convertField($value, $fieldlist[$fieldname]); |
457 | 469 | if(!empty($params['date_format']) && isset($params['date_format'])){ |
458 | 470 | $convert_format = "Y-m-d H:i:s"; |
459 | - if($fieldlist[$fieldname]['type'] == 'date') $convert_format = "Y-m-d"; |
|
471 | + if($fieldlist[$fieldname]['type'] == 'date') { |
|
472 | + $convert_format = "Y-m-d"; |
|
473 | + } |
|
460 | 474 | $fieldlist[$fieldname]['value'] = $timedate->to_display($value, $convert_format, $params['date_format']); |
461 | - }else{ |
|
475 | + } else{ |
|
462 | 476 | $fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true); |
463 | 477 | } |
464 | 478 | $fieldlist[$fieldname]['name'] = $aow_field; |
@@ -519,7 +533,9 @@ discard block |
||
519 | 533 | |
520 | 534 | $value = json_decode(html_entity_decode_utf8($value), true); |
521 | 535 | |
522 | - if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) unset($app_list_strings['aow_date_type_list']['business_hours']); |
|
536 | + if(!file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) { |
|
537 | + unset($app_list_strings['aow_date_type_list']['business_hours']); |
|
538 | + } |
|
523 | 539 | |
524 | 540 | $field = ''; |
525 | 541 | |
@@ -527,11 +543,12 @@ discard block |
||
527 | 543 | $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' title='' tabindex='116'>". getDateFields($module, $view, $value[0], $field_option) ."</select> "; |
528 | 544 | $field .= "<select type='text' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' onchange='date_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_operator'], $value[1]) ."</select> "; |
529 | 545 | $display = 'none'; |
530 | - if($value[1] == 'plus' || $value[1] == 'minus') $display = ''; |
|
546 | + if($value[1] == 'plus' || $value[1] == 'minus') { |
|
547 | + $display = ''; |
|
548 | + } |
|
531 | 549 | $field .= "<input type='text' style='width:40px; display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' value='$value[2]' tabindex='116'> "; |
532 | 550 | $field .= "<select type='text' style='display:$display' name='$aow_field".'[3]'."' id='$aow_field".'[3]'."' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_date_type_list'], $value[3]) ."</select>"; |
533 | - } |
|
534 | - else { |
|
551 | + } else { |
|
535 | 552 | $field = getDateFields($module, $view, $value[0], $field_option).' '.$app_list_strings['aow_date_operator'][$value[1]]; |
536 | 553 | if($value[1] == 'plus' || $value[1] == 'minus'){ |
537 | 554 | $field .= ' '.$value[2].' '.$app_list_strings['aow_date_type_list'][$value[3]]; |
@@ -547,7 +564,9 @@ discard block |
||
547 | 564 | |
548 | 565 | $fields = $app_list_strings['aow_date_options']; |
549 | 566 | |
550 | - if(!$field_option) unset($fields['field']); |
|
567 | + if(!$field_option) { |
|
568 | + unset($fields['field']); |
|
569 | + } |
|
551 | 570 | |
552 | 571 | if ($module != '') { |
553 | 572 | if(isset($beanList[$module]) && $beanList[$module]){ |
@@ -580,8 +599,7 @@ discard block |
||
580 | 599 | |
581 | 600 | if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){ |
582 | 601 | unset($app_list_strings['aow_assign_options']['security_group']); |
583 | - } |
|
584 | - else{ |
|
602 | + } else{ |
|
585 | 603 | $securityGroups = get_bean_select_array(true, 'SecurityGroup','name', '','name',true); |
586 | 604 | } |
587 | 605 | |
@@ -591,17 +609,19 @@ discard block |
||
591 | 609 | $field .= "<select type='text' name='$aow_field".'[0]'."' id='$aow_field".'[0]'."' onchange='assign_field_change(\"$aow_field\")' title='' tabindex='116'>". get_select_options_with_id($app_list_strings['aow_assign_options'], $value[0]) ."</select> "; |
592 | 610 | if(!file_exists('modules/SecurityGroups/SecurityGroup.php')){ |
593 | 611 | $field .= "<input type='hidden' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' value='' />"; |
594 | - } |
|
595 | - else { |
|
612 | + } else { |
|
596 | 613 | $display = 'none'; |
597 | - if($value[0] == 'security_group') $display = ''; |
|
614 | + if($value[0] == 'security_group') { |
|
615 | + $display = ''; |
|
616 | + } |
|
598 | 617 | $field .= "<select type='text' style='display:$display' name='$aow_field".'[1]'."' id='$aow_field".'[1]'."' title='' tabindex='116'>". get_select_options_with_id($securityGroups, $value[1]) ."</select> "; |
599 | 618 | } |
600 | 619 | $display = 'none'; |
601 | - if($value[0] == 'role' || $value[0] == 'security_group') $display = ''; |
|
620 | + if($value[0] == 'role' || $value[0] == 'security_group') { |
|
621 | + $display = ''; |
|
622 | + } |
|
602 | 623 | $field .= "<select type='text' style='display:$display' name='$aow_field".'[2]'."' id='$aow_field".'[2]'."' title='' tabindex='116'>". get_select_options_with_id($roles, $value[2]) ."</select> "; |
603 | - } |
|
604 | - else { |
|
624 | + } else { |
|
605 | 625 | $field = $app_list_strings['aow_assign_options'][$value[1]]; |
606 | 626 | } |
607 | 627 | return $field; |
@@ -616,8 +636,7 @@ discard block |
||
616 | 636 | $option .= '<option value="'.$key.'" selected>'.$value.'</option>'; |
617 | 637 | } else if($selected_value == $key) { |
618 | 638 | $option .= '<option value="'.$key.'" selected>'.$value.'</option>'; |
619 | - } |
|
620 | - else { |
|
639 | + } else { |
|
621 | 640 | $option .= '<option value="'.$key.'">'.$value.'</option>'; |
622 | 641 | } |
623 | 642 | } |
@@ -644,8 +663,7 @@ discard block |
||
644 | 663 | if(!empty($users[$key])) { |
645 | 664 | return $users[$key]; |
646 | 665 | } |
647 | - } |
|
648 | - else if (is_file($file)){ |
|
666 | + } else if (is_file($file)){ |
|
649 | 667 | require_once($file); |
650 | 668 | if(isset($lastUser['User']) && $lastUser['User'] != '') { |
651 | 669 | $users_by_key = array_flip($users); // now keys are values |
@@ -706,7 +724,9 @@ discard block |
||
706 | 724 | $mod = new $beanList[$module](); |
707 | 725 | |
708 | 726 | foreach($mod->get_related_fields() as $field){ |
709 | - if(isset($field['link'])) $checked_link[] = $field['link']; |
|
727 | + if(isset($field['link'])) { |
|
728 | + $checked_link[] = $field['link']; |
|
729 | + } |
|
710 | 730 | if(!isset($field['module']) || !in_array($field['module'],$emailableModules) || (isset($field['dbType']) && $field['dbType'] == "id")){ |
711 | 731 | continue; |
712 | 732 | } |
@@ -749,7 +769,9 @@ discard block |
||
749 | 769 | switch($bean->field_defs[$field]['type']) { |
750 | 770 | case 'datetime': |
751 | 771 | case 'datetimecombo': |
752 | - if(empty($value)) break; |
|
772 | + if(empty($value)) { |
|
773 | + break; |
|
774 | + } |
|
753 | 775 | if ($value == 'NULL') { |
754 | 776 | $value = ''; |
755 | 777 | break; |
@@ -760,7 +782,9 @@ discard block |
||
760 | 782 | } |
761 | 783 | break; |
762 | 784 | case 'date': |
763 | - if(empty($value)) break; |
|
785 | + if(empty($value)) { |
|
786 | + break; |
|
787 | + } |
|
764 | 788 | if ($value == 'NULL') { |
765 | 789 | $value = ''; |
766 | 790 | break; |
@@ -771,7 +795,9 @@ discard block |
||
771 | 795 | } |
772 | 796 | break; |
773 | 797 | case 'time': |
774 | - if(empty($value)) break; |
|
798 | + if(empty($value)) { |
|
799 | + break; |
|
800 | + } |
|
775 | 801 | if ($value == 'NULL') { |
776 | 802 | $value = ''; |
777 | 803 | break; |
@@ -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. |
@@ -62,12 +64,15 @@ discard block |
||
62 | 64 | { |
63 | 65 | global $timedate; |
64 | 66 | |
65 | - if(empty($options['mypbss_date_start'])) |
|
66 | - $options['mypbss_date_start'] = $timedate->nowDbDate(); |
|
67 | - if(empty($options['mypbss_date_end'])) |
|
68 | - $options['mypbss_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months")); |
|
69 | - if(empty($options['title'])) |
|
70 | - $options['title'] = translate('LBL_MY_PIPELINE_FORM_TITLE', 'Home'); |
|
67 | + if(empty($options['mypbss_date_start'])) { |
|
68 | + $options['mypbss_date_start'] = $timedate->nowDbDate(); |
|
69 | + } |
|
70 | + if(empty($options['mypbss_date_end'])) { |
|
71 | + $options['mypbss_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months")); |
|
72 | + } |
|
73 | + if(empty($options['title'])) { |
|
74 | + $options['title'] = translate('LBL_MY_PIPELINE_FORM_TITLE', 'Home'); |
|
75 | + } |
|
71 | 76 | |
72 | 77 | parent::__construct($id,$options); |
73 | 78 | } |
@@ -80,11 +85,12 @@ discard block |
||
80 | 85 | global $app_list_strings; |
81 | 86 | |
82 | 87 | $selected_datax = array(); |
83 | - if (count($this->mypbss_sales_stages) > 0) |
|
84 | - foreach ($this->mypbss_sales_stages as $key) |
|
88 | + if (count($this->mypbss_sales_stages) > 0) { |
|
89 | + foreach ($this->mypbss_sales_stages as $key) |
|
85 | 90 | $selected_datax[] = $key; |
86 | - else |
|
87 | - $selected_datax = array_keys($app_list_strings['sales_stage_dom']); |
|
91 | + } else { |
|
92 | + $selected_datax = array_keys($app_list_strings['sales_stage_dom']); |
|
93 | + } |
|
88 | 94 | |
89 | 95 | $this->_searchFields['mypbss_sales_stages']['options'] = $app_list_strings['sales_stage_dom']; |
90 | 96 | $this->_searchFields['mypbss_sales_stages']['input_name0'] = $selected_datax; |
@@ -316,8 +322,7 @@ discard block |
||
316 | 322 | $datax[$key] = $app_list_strings['sales_stage_dom'][$key]; |
317 | 323 | array_push($selected_datax, $key); |
318 | 324 | } |
319 | - } |
|
320 | - else { |
|
325 | + } else { |
|
321 | 326 | $datax = $app_list_strings['sales_stage_dom']; |
322 | 327 | $selected_datax = array_keys($app_list_strings['sales_stage_dom']); |
323 | 328 | } |
@@ -391,8 +396,9 @@ discard block |
||
391 | 396 | " AND opportunities.date_closed >= ". db_convert("'".$this->mypbss_date_start."'",'date'). |
392 | 397 | " AND opportunities.date_closed <= ".db_convert("'".$this->mypbss_date_end."'",'date') . |
393 | 398 | " AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 "; |
394 | - if ( count($this->mypbss_sales_stages) > 0 ) |
|
395 | - $query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->mypbss_sales_stages) . "') "; |
|
399 | + if ( count($this->mypbss_sales_stages) > 0 ) { |
|
400 | + $query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->mypbss_sales_stages) . "') "; |
|
401 | + } |
|
396 | 402 | $query .= " GROUP BY opportunities.sales_stage ,users.user_name,opportunities.assigned_user_id"; |
397 | 403 | |
398 | 404 | return $query; |
@@ -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. |
@@ -66,11 +68,13 @@ discard block |
||
66 | 68 | { |
67 | 69 | global $timedate; |
68 | 70 | |
69 | - if(empty($options['obm_date_start'])) |
|
70 | - $options['obm_date_start'] = $timedate->nowDbDate(); |
|
71 | + if(empty($options['obm_date_start'])) { |
|
72 | + $options['obm_date_start'] = $timedate->nowDbDate(); |
|
73 | + } |
|
71 | 74 | |
72 | - if(empty($options['obm_date_end'])) |
|
73 | - $options['obm_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months")); |
|
75 | + if(empty($options['obm_date_end'])) { |
|
76 | + $options['obm_date_end'] = $timedate->asDbDate($timedate->getNow()->modify("+6 months")); |
|
77 | + } |
|
74 | 78 | |
75 | 79 | parent::__construct($id,$options); |
76 | 80 | } |
@@ -80,8 +84,9 @@ discard block |
||
80 | 84 | */ |
81 | 85 | public function displayOptions() |
82 | 86 | { |
83 | - if (!isset($this->obm_ids) || count($this->obm_ids) == 0) |
|
84 | - $this->_searchFields['obm_ids']['input_name0'] = array_keys(get_user_array(false)); |
|
87 | + if (!isset($this->obm_ids) || count($this->obm_ids) == 0) { |
|
88 | + $this->_searchFields['obm_ids']['input_name0'] = array_keys(get_user_array(false)); |
|
89 | + } |
|
85 | 90 | |
86 | 91 | return parent::displayOptions(); |
87 | 92 | } |
@@ -247,8 +252,9 @@ discard block |
||
247 | 252 | $query .= " WHERE opportunities.date_closed >= ".db_convert("'".$this->obm_date_start."'",'date') . |
248 | 253 | " AND opportunities.date_closed <= ".db_convert("'".$this->obm_date_end."'",'date') . |
249 | 254 | " AND opportunities.deleted=0"; |
250 | - if (count($this->obm_ids) > 0) |
|
251 | - $query .= " AND opportunities.assigned_user_id IN ('" . implode("','",$this->obm_ids) . "')"; |
|
255 | + if (count($this->obm_ids) > 0) { |
|
256 | + $query .= " AND opportunities.assigned_user_id IN ('" . implode("','",$this->obm_ids) . "')"; |
|
257 | + } |
|
252 | 258 | $query .= " GROUP BY sales_stage,". |
253 | 259 | db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'")) . |
254 | 260 | " ORDER BY m"; |
@@ -274,8 +280,9 @@ discard block |
||
274 | 280 | $chart['labels'][] = $key; |
275 | 281 | $chart['data'][] = array(); |
276 | 282 | } |
277 | - if(!in_array($stage,$chart['key'])) |
|
278 | - $chart['key'][] = $stage; |
|
283 | + if(!in_array($stage,$chart['key'])) { |
|
284 | + $chart['key'][] = $stage; |
|
285 | + } |
|
279 | 286 | |
280 | 287 | $formattedFloat = (float)number_format((float)$i["total"], 2, '.', ''); |
281 | 288 | $chart['data'][count($chart['data'])-1][] = $formattedFloat; |
@@ -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. |
@@ -62,17 +64,19 @@ discard block |
||
62 | 64 | global $app_list_strings; |
63 | 65 | |
64 | 66 | $selected_datax = array(); |
65 | - if (!empty($this->pbls_lead_sources) && sizeof($this->pbls_lead_sources) > 0) |
|
66 | - foreach ($this->pbls_lead_sources as $key) |
|
67 | + if (!empty($this->pbls_lead_sources) && sizeof($this->pbls_lead_sources) > 0) { |
|
68 | + foreach ($this->pbls_lead_sources as $key) |
|
67 | 69 | $selected_datax[] = $key; |
68 | - else |
|
69 | - $selected_datax = array_keys($app_list_strings['lead_source_dom']); |
|
70 | + } else { |
|
71 | + $selected_datax = array_keys($app_list_strings['lead_source_dom']); |
|
72 | + } |
|
70 | 73 | |
71 | 74 | $this->_searchFields['pbls_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']); |
72 | 75 | $this->_searchFields['pbls_lead_sources']['input_name0'] = $selected_datax; |
73 | 76 | |
74 | - if (!isset($this->pbls_ids) || count($this->pbls_ids) == 0) |
|
75 | - $this->_searchFields['pbls_ids']['input_name0'] = array_keys(get_user_array(false)); |
|
77 | + if (!isset($this->pbls_ids) || count($this->pbls_ids) == 0) { |
|
78 | + $this->_searchFields['pbls_ids']['input_name0'] = array_keys(get_user_array(false)); |
|
79 | + } |
|
76 | 80 | |
77 | 81 | return parent::displayOptions(); |
78 | 82 | } |
@@ -241,12 +245,14 @@ discard block |
||
241 | 245 | $query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count ". |
242 | 246 | "FROM opportunities "; |
243 | 247 | $query .= "WHERE opportunities.deleted=0 "; |
244 | - if ( count($this->pbls_ids) > 0 ) |
|
245 | - $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->pbls_ids)."') "; |
|
246 | - if ( count($this->pbls_lead_sources) > 0 ) |
|
247 | - $query .= "AND opportunities.lead_source IN ('".implode("','",$this->pbls_lead_sources)."') "; |
|
248 | - else |
|
249 | - $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') "; |
|
248 | + if ( count($this->pbls_ids) > 0 ) { |
|
249 | + $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->pbls_ids)."') "; |
|
250 | + } |
|
251 | + if ( count($this->pbls_lead_sources) > 0 ) { |
|
252 | + $query .= "AND opportunities.lead_source IN ('".implode("','",$this->pbls_lead_sources)."') "; |
|
253 | + } else { |
|
254 | + $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') "; |
|
255 | + } |
|
250 | 256 | $query .= "GROUP BY lead_source ORDER BY total DESC"; |
251 | 257 | |
252 | 258 | return $query; |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -61,17 +63,19 @@ discard block |
||
61 | 63 | global $app_list_strings; |
62 | 64 | |
63 | 65 | $selected_datax = array(); |
64 | - if (!empty($this->lsbo_lead_sources) && sizeof($this->lsbo_lead_sources) > 0) |
|
65 | - foreach ($this->lsbo_lead_sources as $key) |
|
66 | + if (!empty($this->lsbo_lead_sources) && sizeof($this->lsbo_lead_sources) > 0) { |
|
67 | + foreach ($this->lsbo_lead_sources as $key) |
|
66 | 68 | $selected_datax[] = $key; |
67 | - else |
|
68 | - $selected_datax = array_keys($app_list_strings['lead_source_dom']); |
|
69 | + } else { |
|
70 | + $selected_datax = array_keys($app_list_strings['lead_source_dom']); |
|
71 | + } |
|
69 | 72 | |
70 | 73 | $this->_searchFields['lsbo_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']); |
71 | 74 | $this->_searchFields['lsbo_lead_sources']['input_name0'] = $selected_datax; |
72 | 75 | |
73 | - if (!isset($this->lsbo_ids) || count($this->lsbo_ids) == 0) |
|
74 | - $this->_searchFields['lsbo_ids']['input_name0'] = array_keys(get_user_array(false)); |
|
76 | + if (!isset($this->lsbo_ids) || count($this->lsbo_ids) == 0) { |
|
77 | + $this->_searchFields['lsbo_ids']['input_name0'] = array_keys(get_user_array(false)); |
|
78 | + } |
|
75 | 79 | |
76 | 80 | return parent::displayOptions(); |
77 | 81 | } |
@@ -131,8 +135,9 @@ discard block |
||
131 | 135 | |
132 | 136 | |
133 | 137 | $url_params = array(); |
134 | - if ( count($this->lsbo_ids) > 0 ) |
|
135 | - $url_params['assigned_user_id'] = array_values($this->lsbo_ids); |
|
138 | + if ( count($this->lsbo_ids) > 0 ) { |
|
139 | + $url_params['assigned_user_id'] = array_values($this->lsbo_ids); |
|
140 | + } |
|
136 | 141 | |
137 | 142 | |
138 | 143 | $data = $this->getChartData($this->constructQuery()); |
@@ -253,12 +258,14 @@ discard block |
||
253 | 258 | $query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total, ". |
254 | 259 | "count(*) as opp_count FROM opportunities "; |
255 | 260 | $query .= " WHERE opportunities.deleted=0 "; |
256 | - if ( count($this->lsbo_ids) > 0 ) |
|
257 | - $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->lsbo_ids)."') "; |
|
258 | - if ( count($this->lsbo_lead_sources) > 0 ) |
|
259 | - $query .= "AND opportunities.lead_source IN ('".implode("','",$this->lsbo_lead_sources)."') "; |
|
260 | - else |
|
261 | - $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') "; |
|
261 | + if ( count($this->lsbo_ids) > 0 ) { |
|
262 | + $query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->lsbo_ids)."') "; |
|
263 | + } |
|
264 | + if ( count($this->lsbo_lead_sources) > 0 ) { |
|
265 | + $query .= "AND opportunities.lead_source IN ('".implode("','",$this->lsbo_lead_sources)."') "; |
|
266 | + } else { |
|
267 | + $query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') "; |
|
268 | + } |
|
262 | 269 | $query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage"; |
263 | 270 | |
264 | 271 | return $query; |
@@ -282,8 +289,9 @@ discard block |
||
282 | 289 | $chart['labels'][] = $key; |
283 | 290 | $chart['data'][] = array(); |
284 | 291 | } |
285 | - if(!in_array($stage,$chart['key'])) |
|
286 | - $chart['key'][] = $stage; |
|
292 | + if(!in_array($stage,$chart['key'])) { |
|
293 | + $chart['key'][] = $stage; |
|
294 | + } |
|
287 | 295 | |
288 | 296 | $formattedFloat = (float)number_format((float)$i["total"], 2, '.', ''); |
289 | 297 | $chart['data'][count($chart['data'])-1][] = $formattedFloat; |