Results 1 to 3 of 3

Thread: mass update question

  1. #1
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default mass update question

    Hey All,
    I have a custom field 'mao' in both Contacts and Accounts that is updated via Accounts mass update.
    I'm trying to set the contacts mao to equal the Accounts mao on update and thought the following function would do the trick, but I can't figure out where to put it (Accounts.php? Contacts.php? ListView.php?)

    PHP Code:
    function conatctsMAO(){
        
    $update_mao =" UPDATE accounts,contacts,accounts_contacts SET contacts.mao = accounts.mao WHERE accounts.id = accounts_contacts.account_id AND contacts.id = accounts_contacts.contact_id ";          
        
    $db = & PearDatabase::getInstance();  
        
    $result $db->query($update_mao);  

    Any thoughts?

  2. #2
    simple is offline Sugar Community Member
    Join Date
    Jul 2005
    Posts
    259

    Default Re: mass update question

    Hi

    In Accounts.php ...adding (overriding) the save method?

    Code:
    class Accounts()  extends SugarBean {
    
    ...
    
       function save($check_notify = FALSE) {
          parent::save($check_notify);
    
          $this->conatctsMAO;
       }
    
    }
    Just an idea...
    Cheers Pascal
    Simplicity GmbH

  3. #3
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Re: mass update question

    Hey Pascal,
    Don't mean to appear ungrateful. I've been tied up with a nasty synchronization issue and haven't had a chance to try your suggestion. Will let you know. Thanks for the input!

Thread Information

Users Browsing this Thread

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

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
  •