Results 1 to 1 of 1

Thread: Duplicate Records in listview for users

  1. #1
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Duplicate Records in listview for users

    Hi,

    For Accounts I have a custom view.list.php that filters out all Accounts that have an assigned team of Global. But if a user searches then I want to show Global teamed Accounts also, for some reason now. when I search as a normal user any Account with a Team of Global is appearing twice in the listview. There are no duplicate accounts in the DB, I have checked.

    Then when I log in as admin and do the same search Global Account do not show up twice.

    Here is my custom viw.list.php

    PHP Code:
    require_once('include/MVC/View/views/view.list.php');

    class 
    AccountsViewList extends ViewList{
         function 
    AccountsViewList()
         {
             
    parent::ViewList();
         }
         
         
    /*
          * Override listViewProcess with addition to where clause to exclude project templates
          */
        
    function listViewProcess()
        {
            
    $this->processSearchForm();
                    
        
    //Chris Lynch 27-05-2010 to not show GLOBAL in default - only if searched on
            // RETRIEVE ACCOUNTS WHERE THE TEAM IS NOT GLOBAL
            
    if ($this->where == "")$this->where .= 'accounts.team_id != 1';
            
            
    $this->lv->searchColumns $this->searchForm->searchColumns;
            
            if(!
    $this->headers)
                return;
                
            if(empty(
    $_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false)
            {
                
    $this->lv->setup($this->seed'include/ListView/ListViewGeneric.tpl'$this->where$this->params);
                
    $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' $_REQUEST['saved_search_select_name']);
                echo 
    get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName''false);
                echo 
    $this->lv->display();
            }
        }


    I also have the following two files in the custom accounts, these are used to sort my accounts by a field.

    PHP Code:
    <?php
    require_once('modules/Accounts/Account.php');
    class 
    AccountsListView extends Account

        function 
    create_new_list_query($order_by$where,$filter=array(),$params=array(), $show_deleted 0,$join_type=''$return_array false,$parentbean$singleSelect false)
        {     
        
    $asc explode('ASC',$order_by); 
        
    $desc explode('DESC',$order_by); 
            
    $order_by "pr_last_name_c ASC";                                    
        
    $ret_array parent::create_new_list_query($order_by$where,$filter,$params$show_deleted,$join_type$return_array,$parentbean$singleSelect); 
        return 
    $ret_array
        } 
    }  

    ?>
    and a Controller.php

    PHP Code:
    require_once('custom/modules/Accounts/accounts_sort.php'); 

    class 
    AccountsController extends SugarController
    {
        function 
    action_listview()
        {
            
    $this->view_object_map['bean'] = $this->bean
            
    $this->view 'list'
            
    $GLOBALS['view'] = $this->view
            
    $this->bean = new AccountsListView(); 
        }    

    Last edited by chrislynch8; 2010-11-15 at 12:02 PM.
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Duplicate records
    By bob1965 in forum Help
    Replies: 2
    Last Post: 2009-10-05, 02:55 PM
  2. Duplicate records in table
    By Glitch in forum Developer Help
    Replies: 4
    Last Post: 2009-07-21, 05:53 PM
  3. subpanel duplicate records
    By karthikeyanr in forum Developer Help
    Replies: 0
    Last Post: 2008-09-25, 04:33 AM
  4. Duplicate Records
    By fbnewtz in forum Help
    Replies: 2
    Last Post: 2008-09-17, 08:40 PM
  5. Duplicate records in transaction
    By Mubi in forum Developer Help
    Replies: 0
    Last Post: 2008-09-02, 08:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •