| Conditions | 74 |
| Paths | > 20000 |
| Total Lines | 350 |
| Code Lines | 215 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 5550 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 633 | function action_map_markers() { |
||
| 634 | |||
| 635 | header_remove('X-Frame-Options'); |
||
| 636 | $this->view = 'map_markers'; |
||
| 637 | |||
| 638 | // Define globals for use in the view. |
||
| 639 | $this->bean->map_center = array(); |
||
| 640 | $this->bean->map_markers = array(); |
||
| 641 | $this->bean->map_markers_groups = array(); |
||
| 642 | $this->bean->custom_markers = array(); |
||
| 643 | $this->bean->custom_areas = array(); |
||
| 644 | |||
| 645 | // Create New Sugar_Smarty Object |
||
| 646 | $this->sugarSmarty = new Sugar_Smarty(); |
||
| 647 | $this->sugarSmarty->assign("mod_strings", $GLOBALS['mod_strings']); |
||
| 648 | $this->sugarSmarty->assign("app_strings", $GLOBALS['app_strings']); |
||
| 649 | $this->sugarSmarty->assign('app_list_strings', $GLOBALS['app_list_strings']); |
||
| 650 | $this->sugarSmarty->assign('moduleListSingular', $GLOBALS['app_list_strings']['moduleListSingular']); |
||
| 651 | $this->sugarSmarty->assign('moduleList', $GLOBALS['app_list_strings']['moduleList']); |
||
| 652 | //echo '<pre>'; |
||
| 653 | //var_dump($_REQUEST); |
||
| 654 | |||
| 655 | // Related Map Record Defines the Map |
||
| 656 | if (!empty($_REQUEST['record']) || |
||
| 657 | (!empty($_REQUEST['relate_id']) && !empty($_REQUEST['relate_module'])) || |
||
| 658 | (!empty($_REQUEST['quick_address']) && !empty($_REQUEST['display_module']))) { |
||
| 659 | |||
| 660 | // If map 'record' then define map details from current module. |
||
| 661 | if (@is_guid($_REQUEST['record'])) { |
||
| 662 | // Get the map object |
||
| 663 | $map = get_module_info($GLOBALS['currentModule']); |
||
| 664 | $map->retrieve($_REQUEST['record']); |
||
| 665 | // Define map variables |
||
| 666 | $map_parent_type = $map->parent_type; |
||
| 667 | $map_parent_id = $map->parent_id; |
||
| 668 | $map_module_type = $map->module_type; |
||
| 669 | $map_unit_type = $map->unit_type; |
||
| 670 | $map_distance = $map->distance; |
||
| 671 | } |
||
| 672 | // Else if a 'relate_id' use it as the Relate Center Point (Lng/Lat) |
||
| 673 | else if (@(is_guid($_REQUEST['relate_id']) && !empty($_REQUEST['relate_module']))) { |
||
| 674 | // Define map variables |
||
| 675 | $map_parent_type = $_REQUEST['relate_module']; |
||
| 676 | $map_parent_id = $_REQUEST['relate_id']; |
||
| 677 | $map_module_type = (!empty($_REQUEST['display_module'])) ? $_REQUEST['display_module'] : $_REQUEST['relate_module']; |
||
| 678 | $map_distance = (!empty($_REQUEST['distance'])) ? $_REQUEST['distance'] : $this->settings['map_default_distance']; |
||
| 679 | $map_unit_type = (!empty($_REQUEST['unit_type'])) ? $_REQUEST['unit_type'] : $this->settings['map_default_unit_type']; |
||
| 680 | } |
||
| 681 | // Else if a 'quick_address' use it as the Center Point (Lng/Lat) |
||
| 682 | else if (!empty($_REQUEST['quick_address']) && !empty($_REQUEST['display_module'])) { |
||
| 683 | // Define map variables / No Parent |
||
| 684 | $map_parent_type = null; |
||
| 685 | $map_parent_id = null; |
||
| 686 | $map_module_type = (!empty($_REQUEST['display_module'])) ? $_REQUEST['display_module'] : $_REQUEST['relate_module']; |
||
| 687 | $map_distance = (!empty($_REQUEST['distance'])) ? $_REQUEST['distance'] : $this->settings['map_default_distance']; |
||
| 688 | $map_unit_type = (!empty($_REQUEST['unit_type'])) ? $_REQUEST['unit_type'] : $this->settings['map_default_unit_type']; |
||
| 689 | } |
||
| 690 | |||
| 691 | // Define display object, note - 'Accounts_Members' is a special display type |
||
| 692 | $this->display_object = ($map_module_type == 'Accounts_Members') ? get_module_info('Accounts') : get_module_info($map_module_type); |
||
| 693 | $mod_strings_display = return_module_language($GLOBALS['current_language'], $this->display_object->module_name); |
||
| 694 | $mod_strings_display = array_merge($mod_strings_display, $GLOBALS['mod_strings']); |
||
| 695 | |||
| 696 | // If relate module/id object |
||
| 697 | if (!empty($map_parent_type) && !empty($map_parent_id)) { |
||
| 698 | |||
| 699 | // Define relate objects |
||
| 700 | $this->relate_object = get_module_info($map_parent_type); |
||
| 701 | $this->relate_object->retrieve($map_parent_id); |
||
| 702 | $mod_strings_related = return_module_language($GLOBALS['current_language'], $this->relate_object->module_name); |
||
| 703 | $mod_strings_related = array_merge($mod_strings_related, $GLOBALS['mod_strings']); |
||
| 704 | |||
| 705 | // Get the Relate object Assoc Data |
||
| 706 | $where_conds = $this->relate_object->table_name . ".id = '" . $map_parent_id . "'"; |
||
| 707 | $query = $this->relate_object->create_new_list_query("" . $this->relate_object->table_name . ".assigned_user_id", $where_conds, array(), array(), 0, '', false, $this->relate_object, false); |
||
| 708 | //var_dump($query); |
||
| 709 | $relate_result = $this->bean->db->query($query); |
||
| 710 | $relate = $this->bean->db->fetchByAssoc($relate_result); |
||
| 711 | // Add Relate (Center Point) Marker |
||
| 712 | $this->bean->map_center = $this->getMarkerData($map_parent_type, $relate, true, $mod_strings_related); |
||
| 713 | // Define Center Point |
||
| 714 | $center_lat = $this->relate_object->jjwg_maps_lat_c; |
||
| 715 | $center_lng = $this->relate_object->jjwg_maps_lng_c; |
||
| 716 | } |
||
| 717 | // Use Quick Address as Center Point |
||
| 718 | else { |
||
| 719 | // Geocode 'quick_address' |
||
| 720 | $aInfo = $this->bean->getGoogleMapsGeocode($_REQUEST['quick_address'], false, true); |
||
| 721 | // If not status 'OK', then fail here and exit. Note: Inside of iFrame |
||
| 722 | if (!empty($aInfo['status']) && $aInfo['status'] != 'OK' && preg_match('/[A-Z\_]/', $aInfo['status'])) { |
||
| 723 | echo '<br /><br /><div><b>'.$GLOBALS['mod_strings']['LBL_MAP_LAST_STATUS'].': '.$aInfo['status'].'</b></div><br /><br />'; |
||
| 724 | exit; |
||
| 725 | } |
||
| 726 | //var_dump($aInfo); |
||
| 727 | // Define Marker Data |
||
| 728 | $aInfo['name'] = $_REQUEST['quick_address']; |
||
| 729 | $aInfo['id'] = 0; |
||
| 730 | $aInfo['module'] = ($map_module_type == 'Accounts_Members') ? 'Accounts' : $map_module_type; |
||
| 731 | $aInfo['address'] = $_REQUEST['quick_address']; |
||
| 732 | $aInfo['jjwg_maps_address_c'] = $_REQUEST['quick_address']; |
||
| 733 | $aInfo['jjwg_maps_lat_c'] = $aInfo['lat']; |
||
| 734 | $aInfo['jjwg_maps_lng_c'] = $aInfo['lng']; |
||
| 735 | $this->bean->map_center = $this->getMarkerData($map_parent_type, $aInfo, true); |
||
| 736 | // Define Center Point |
||
| 737 | $center_lat = $aInfo['lat']; |
||
| 738 | $center_lng = $aInfo['lng']; |
||
| 739 | } |
||
| 740 | //var_dump($aInfo); |
||
| 741 | // Define $x and $y expressions |
||
| 742 | $x = '(69.1*((' . $this->display_object->table_name . '_cstm.jjwg_maps_lat_c)-(' . $center_lat . ')))'; |
||
| 743 | $y = '(53.0*((' . $this->display_object->table_name . '_cstm.jjwg_maps_lng_c)-(' . $center_lng . ')) * COS((' . $center_lat . ')/57.1))'; |
||
| 744 | $calc_distance_expression = 'SQRT(' . $x . '*' . $x . '+' . $y . '*' . $y . ')'; |
||
| 745 | if (strtolower($map_unit_type) == 'km' || strtolower($map_unit_type) == 'kilometer') { |
||
| 746 | $calc_distance_expression .= '*1.609'; // 1 mile = 1.609 km |
||
| 747 | } |
||
| 748 | |||
| 749 | // Find the Items to Display |
||
| 750 | // Assume there is no address at 0,0; it's in the Atlantic Ocean! |
||
| 751 | $where_conds = "(" . $this->display_object->table_name . "_cstm.jjwg_maps_lat_c != 0 OR " . |
||
| 752 | "" . $this->display_object->table_name . "_cstm.jjwg_maps_lng_c != 0) " . |
||
| 753 | " AND " . |
||
| 754 | "(" . $this->display_object->table_name . "_cstm.jjwg_maps_geocode_status_c = 'OK')" . |
||
| 755 | " AND " . |
||
| 756 | "(" . $calc_distance_expression . " < " . $map_distance . ")"; |
||
| 757 | $query = $this->display_object->create_new_list_query('display_object_distance', $where_conds, array(), array(), 0, '', false, $this->display_object, false); |
||
| 758 | // Add the disply_object_distance into SELECT list |
||
| 759 | $query = str_replace('SELECT ', 'SELECT (' . $calc_distance_expression . ') AS display_object_distance, ', $query); |
||
| 760 | if ($map_module_type == 'Contacts') { // Contacts - Account Name |
||
| 761 | $query = str_replace(' FROM contacts ', ' ,accounts.name AS account_name, accounts.id AS account_id FROM contacts ', $query); |
||
| 762 | $query = str_replace(' FROM contacts ', ' FROM contacts LEFT JOIN accounts_contacts ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0 LEFT JOIN accounts ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 ', $query); |
||
| 763 | } elseif ($map_module_type == 'Opportunities') { // Opps - Account Name |
||
| 764 | $query = str_replace(' FROM opportunities ', ' ,accounts.name AS account_name, accounts.id AS account_id FROM opportunities ', $query); |
||
| 765 | $query = str_replace(' FROM opportunities ', ' FROM opportunities LEFT JOIN accounts_opportunities ON opportunities.id=accounts_opportunities.opportunity_id and accounts_opportunities.deleted = 0 LEFT JOIN accounts ON accounts_opportunities.account_id=accounts.id AND accounts.deleted=0 ', $query); |
||
| 766 | } elseif ($map_module_type == 'Accounts_Members') { // 'Accounts_Members' is a special display type |
||
| 767 | $query = str_replace(' AND accounts.deleted=0', ' AND accounts.deleted=0 AND accounts.parent_id = \''.$this->bean->db->quote($map_parent_id).'\'', $query); |
||
| 768 | } |
||
| 769 | //var_dump($query); |
||
| 770 | $display_result = $this->bean->db->limitQuery($query, 0, $this->settings['map_markers_limit']); |
||
| 771 | while ($display = $this->bean->db->fetchByAssoc($display_result)) { |
||
| 772 | if (!empty($map_distance) && !empty($display['id'])) { |
||
| 773 | $marker_data_module_type = ($map_module_type == 'Accounts_Members') ? 'Accounts' : $map_module_type; |
||
| 774 | $marker_data = $this->getMarkerData($marker_data_module_type, $display, false, $mod_strings_display); |
||
| 775 | if (!empty($marker_data)) { |
||
| 776 | $this->bean->map_markers[] = $marker_data; |
||
| 777 | } |
||
| 778 | } |
||
| 779 | } |
||
| 780 | //var_dump($this->bean->map_markers); |
||
| 781 | // Next define the Custom Markers and Areas related to this Map |
||
| 782 | // Define relate and display objects from the necessary classes (utils.php) |
||
| 783 | @$markers_object = get_module_info('jjwg_Markers'); |
||
|
|
|||
| 784 | @$areas_object = get_module_info('jjwg_Areas'); |
||
| 785 | |||
| 786 | // Relationship Names: jjwg_maps_jjwg_areas and jjwg_maps_jjwg_markers |
||
| 787 | // Find the Related Beans: Maps to Markers |
||
| 788 | if (@(is_object($markers_object) && is_object($map))) { |
||
| 789 | $related_custom_markers = $map->get_linked_beans('jjwg_maps_jjwg_markers', 'jjwg_Markers'); |
||
| 790 | if ($related_custom_markers) { |
||
| 791 | foreach ($related_custom_markers as $marker_bean) { |
||
| 792 | $marker_data = $this->getMarkerDataCustom($marker_bean); |
||
| 793 | if (!empty($marker_data)) { |
||
| 794 | $this->bean->custom_markers[] = $marker_data; |
||
| 795 | } |
||
| 796 | } |
||
| 797 | } |
||
| 798 | } |
||
| 799 | |||
| 800 | // Find the Related Beans: Maps to Areas |
||
| 801 | if (@(is_object($areas_object) && is_object($map))) { |
||
| 802 | $related_custom_areas = $map->get_linked_beans('jjwg_maps_jjwg_areas', 'jjwg_Areas'); |
||
| 803 | if ($related_custom_areas) { |
||
| 804 | foreach ($related_custom_areas as $area_bean) { |
||
| 805 | $area_data = $this->getAreaDataCustom($area_bean); |
||
| 806 | if (!empty($area_data)) { |
||
| 807 | $this->bean->custom_areas[] = $area_data; |
||
| 808 | } |
||
| 809 | } |
||
| 810 | } |
||
| 811 | } |
||
| 812 | |||
| 813 | |||
| 814 | // Map Target List (ProspectLists) |
||
| 815 | } elseif (!empty($_REQUEST['list_id'])) { |
||
| 816 | |||
| 817 | $this->bean->map_markers = array(); |
||
| 818 | $this->display_object = get_module_info('ProspectLists'); |
||
| 819 | // Use the Export Query |
||
| 820 | if (!empty($_REQUEST['list_id'])) { |
||
| 821 | $this->display_object->retrieve($_REQUEST['list_id']); |
||
| 822 | if ($this->display_object->id == $_REQUEST['list_id']) { |
||
| 823 | $prospect_list_object = $this->display_object; |
||
| 824 | $list_id = $this->display_object->id; |
||
| 825 | } |
||
| 826 | } |
||
| 827 | |||
| 828 | if (!empty($list_id)) { |
||
| 829 | |||
| 830 | $list_modules = array('Accounts', 'Contacts', 'Leads', 'Users', 'Prospects'); |
||
| 831 | $temp_marker_groups = array(); |
||
| 832 | |||
| 833 | foreach ($list_modules as $display_module) { |
||
| 834 | |||
| 835 | $this->display_object = get_module_info($display_module); |
||
| 836 | $mod_strings_display = return_module_language($GLOBALS['current_language'], $this->display_object->module_name); |
||
| 837 | $mod_strings_display = array_merge($mod_strings_display, $GLOBALS['mod_strings']); |
||
| 838 | |||
| 839 | // Find the Items to Display |
||
| 840 | // Assume there is no address at 0,0; it's in the Atlantic Ocean! |
||
| 841 | $where_conds = "(" . $this->display_object->table_name . "_cstm.jjwg_maps_lat_c != 0 OR " . |
||
| 842 | "" . $this->display_object->table_name . "_cstm.jjwg_maps_lng_c != 0) " . |
||
| 843 | " AND " . |
||
| 844 | "(" . $this->display_object->table_name . "_cstm.jjwg_maps_geocode_status_c = 'OK')"; |
||
| 845 | $query = $this->display_object->create_new_list_query('', $where_conds, array(), array(), 0, '', false, $this->display_object, false); |
||
| 846 | if ($display_module == 'Contacts') { // Contacts - Account Name |
||
| 847 | $query = str_replace(' FROM contacts ', ' ,accounts.name AS account_name, accounts.id AS account_id FROM contacts ', $query); |
||
| 848 | $query = str_replace(' FROM contacts ', ' FROM contacts LEFT JOIN accounts_contacts ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0 LEFT JOIN accounts ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 ', $query); |
||
| 849 | } |
||
| 850 | // Add List JOIN |
||
| 851 | $query = str_replace(' FROM '.$this->display_object->table_name.' ', ' FROM '.$this->display_object->table_name.' '. |
||
| 852 | 'LEFT JOIN prospect_lists_prospects ON prospect_lists_prospects.related_id = '.$this->display_object->table_name.'.id AND prospect_lists_prospects.deleted=0 '. |
||
| 853 | 'LEFT JOIN prospect_lists ON prospect_lists_prospects.prospect_list_id = prospect_lists.id AND prospect_lists.deleted=0 ', |
||
| 854 | $query); |
||
| 855 | // Restrict WHERE to related type and $list_id |
||
| 856 | $query .= ' AND prospect_lists_prospects.related_type = \''.$this->display_object->module_name.'\' AND '. |
||
| 857 | 'prospect_lists.id = \''.$this->bean->db->quote($list_id).'\''; |
||
| 858 | //var_dump($query); |
||
| 859 | $display_result = $this->bean->db->limitQuery($query, 0, $this->settings['map_markers_limit']); |
||
| 860 | $display_type_found = false; |
||
| 861 | while ($display = $this->bean->db->fetchByAssoc($display_result)) { |
||
| 862 | if (!empty($display['id'])) { |
||
| 863 | $marker_data = $this->getMarkerData($display_module, $display, false, $mod_strings_display); |
||
| 864 | $marker_data['group'] = $GLOBALS['app_list_strings']['moduleList'][$display_module]; |
||
| 865 | if (!empty($marker_data)) { |
||
| 866 | $this->bean->map_markers[] = $marker_data; |
||
| 867 | } |
||
| 868 | $display_type_found = true; |
||
| 869 | } |
||
| 870 | } |
||
| 871 | if ($display_type_found) { |
||
| 872 | $temp_marker_groups[] = $GLOBALS['app_list_strings']['moduleList'][$display_module]; |
||
| 873 | } |
||
| 874 | |||
| 875 | } |
||
| 876 | |||
| 877 | $this->bean->map_markers_groups = $temp_marker_groups; |
||
| 878 | } |
||
| 879 | |||
| 880 | |||
| 881 | // Map Records |
||
| 882 | } elseif (!empty($_REQUEST['uid']) || !empty($_REQUEST['current_post'])) { |
||
| 883 | |||
| 884 | if (in_array($_REQUEST['display_module'], $this->settings['valid_geocode_modules'])) { |
||
| 885 | $display_module = $_REQUEST['display_module']; |
||
| 886 | } else { |
||
| 887 | $display_module = 'Accounts'; |
||
| 888 | } |
||
| 889 | if ($_REQUEST['current_post'] == 'session') { |
||
| 890 | $current_post = $_SESSION['jjwg_Maps']['current_post']; |
||
| 891 | } else { |
||
| 892 | $current_post = $_REQUEST['current_post']; |
||
| 893 | } |
||
| 894 | $query = ''; |
||
| 895 | $selected_query = ''; |
||
| 896 | $records = array(); |
||
| 897 | $order_by = ''; |
||
| 898 | |||
| 899 | $this->display_object = get_module_info($display_module); |
||
| 900 | $mod_strings_display = return_module_language($GLOBALS['current_language'], $this->display_object->module_name); |
||
| 901 | $mod_strings_display = array_merge($mod_strings_display, $GLOBALS['mod_strings']); |
||
| 902 | |||
| 903 | if (!empty($_REQUEST['uid'])) { |
||
| 904 | // Several records selected or this page |
||
| 905 | $records = explode(',', $_REQUEST['uid']); |
||
| 906 | } elseif (!empty($current_post)) { |
||
| 907 | // Select all records (advanced search) |
||
| 908 | $search_array = generateSearchWhere($display_module, $current_post); |
||
| 909 | //var_dump($search_array); |
||
| 910 | if (!empty($search_array['where'])) { |
||
| 911 | // Related Field Bug: Get relate/link patched 'where' and 'join' |
||
| 912 | @$ret_array = create_export_query_relate_link_patch($display_module, $search_array['searchFields'], $search_array['where']); |
||
| 913 | if(!empty($ret_array['join'])) { |
||
| 914 | @$selected_query = $this->display_object->create_export_query($order_by, $ret_array['where'], $ret_array['join']); |
||
| 915 | } else { |
||
| 916 | @$selected_query = $this->display_object->create_export_query($order_by, $ret_array['where']); |
||
| 917 | } |
||
| 918 | // SugarOnDemand JOIN Bug: If $ret_array['join'] is not included in query, force it in! |
||
| 919 | if (strpos($ret_array['join'], $selected_query) === false) { |
||
| 920 | $selected_query = str_replace(' where ', $ret_array['join'].' where ', $selected_query); |
||
| 921 | } |
||
| 922 | // Avoiding subquery. Let's just record the record ID's for later |
||
| 923 | $selected_result = $this->bean->db->limitQuery($selected_query, 0, $this->settings['map_markers_limit']); |
||
| 924 | while ($display = $this->bean->db->fetchByAssoc($selected_result)) { |
||
| 925 | $records[] = $display['id']; |
||
| 926 | } |
||
| 927 | } |
||
| 928 | } |
||
| 929 | //var_dump($records); |
||
| 930 | |||
| 931 | // Find the Items to Display |
||
| 932 | // Assume there is no address at 0,0; it's in the Atlantic Ocean! |
||
| 933 | $where_conds = "(" . $this->display_object->table_name . "_cstm.jjwg_maps_lat_c != 0 OR " . |
||
| 934 | "" . $this->display_object->table_name . "_cstm.jjwg_maps_lng_c != 0) " . |
||
| 935 | " AND " . |
||
| 936 | "(" . $this->display_object->table_name . "_cstm.jjwg_maps_geocode_status_c = 'OK')"; |
||
| 937 | $query = $this->display_object->create_new_list_query('', $where_conds, array(), array(), 0, '', false, $this->display_object, false); |
||
| 938 | if ($display_module == 'Contacts') { // Contacts - Account Name |
||
| 939 | $query = str_replace(' FROM contacts ', ' ,accounts.name AS account_name, accounts.id AS account_id FROM contacts ', $query); |
||
| 940 | $query = str_replace(' FROM contacts ', ' FROM contacts LEFT JOIN accounts_contacts ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0 LEFT JOIN accounts ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 ', $query); |
||
| 941 | } elseif ($display_module == 'Opportunities') { // Opps - Account Name |
||
| 942 | $query = str_replace(' FROM opportunities ', ' ,accounts.name AS account_name, accounts.id AS account_id FROM opportunities ', $query); |
||
| 943 | $query = str_replace(' FROM opportunities ', ' FROM opportunities LEFT JOIN accounts_opportunities ON opportunities.id=accounts_opportunities.opportunity_id and accounts_opportunities.deleted = 0 LEFT JOIN accounts ON accounts_opportunities.account_id=accounts.id AND accounts.deleted=0 ', $query); |
||
| 944 | } |
||
| 945 | //var_dump($query); |
||
| 946 | |||
| 947 | $display_result = $this->bean->db->limitQuery($query, 0, $this->settings['map_markers_limit']); |
||
| 948 | $this->bean->map_markers = array(); |
||
| 949 | while ($display = $this->bean->db->fetchByAssoc($display_result)) { |
||
| 950 | if (!empty($search_array['where'])) { // Select all records (advanced search) with where clause |
||
| 951 | if (in_array($display['id'], $records)) { |
||
| 952 | $this->bean->map_markers[] = $this->getMarkerData($display_module, $display, false, $mod_strings_display); |
||
| 953 | } |
||
| 954 | } elseif (!empty($_REQUEST['uid'])) { // Several records selected or this page selected |
||
| 955 | if (in_array($display['id'], $records)) { |
||
| 956 | $this->bean->map_markers[] = $this->getMarkerData($display_module, $display, false, $mod_strings_display); |
||
| 957 | } |
||
| 958 | } else { // All |
||
| 959 | $this->bean->map_markers[] = $this->getMarkerData($display_module, $display, false, $mod_strings_display); |
||
| 960 | } |
||
| 961 | } |
||
| 962 | } |
||
| 963 | |||
| 964 | // Sort marker groups for the view |
||
| 965 | sort($this->bean->map_markers_groups); |
||
| 966 | |||
| 967 | // Set display object for later use |
||
| 968 | $this->bean->display_object = $this->display_object; |
||
| 969 | |||
| 970 | // Get Prospect List Array Dropdown |
||
| 971 | $list = get_module_info('ProspectLists'); |
||
| 972 | $list_query = $list->create_list_query('prospect_lists.name', '1=1', 0); |
||
| 973 | $list_result = $list->db->query($list_query); |
||
| 974 | $list_array = array(); |
||
| 975 | while ($alist = $list->db->fetchByAssoc($list_result)) { |
||
| 976 | if (!empty($alist['name']) && !empty($alist['id'])) { |
||
| 977 | $list_array[$alist['id']] = $alist['name']; |
||
| 978 | } |
||
| 979 | } |
||
| 980 | $this->bean->list_array = $list_array; |
||
| 981 | |||
| 982 | } |
||
| 983 | |||
| 1215 |
If you suppress an error, we recommend checking for the error condition explicitly: