Jump to content


Extending Modules

module extend accounts

  • Please log in to reply
2 replies to this topic

#1 jamesGO3D


    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 12 February 2014 - 05:16 PM

I'm trying to make changes to the base modules outside of the core files to avoid as much overwriting on an update as possible. What is the best way to do this? Completely extend the Accounts module and its affiliates and use the extended modules, or (hopefully) is there a better/easier way to extend and overwrite the base modules with changing as little core code as possible.

#2 claytonkreisel



  • Members
  • Pip
  • 2 posts

Posted 05 May 2014 - 09:26 PM

I too would love it if someone could answer this one.

#3 miek1123



  • Members
  • PipPip
  • 19 posts

Posted 16 May 2014 - 01:48 PM

Not sure what you're trying to extend, but when i've needed to add custom relationships this is the method I've followed.

First i'm assuming you already have a custom extension (if not see the ZurmoZoo example).
1) Inside resolveCustomMetadataAndLoad i've added the following; which is adding a new custom self-referenced relationship to contact and a new reference to user:

public static function resolveCustomMetadataAndLoad()
    $metadata = Contact::getMetadata();
    if (key_exists('relations', $metadata['Contact']))
        if (!key_exists('parentContact',$metadata['Contact']['relations']))
                $metadata['Contact']['relations']['parentContact'] = array(static::HAS_ONE, 'Contact', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC,'parentContact');
                $metadata['Contact']['relations']['csrUser'] = array(static::HAS_ONE, 'User', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC,'csrUser');                
            $metadata['Contact']['elements']['parentContact'] = 'Contact';                $metadata['Contact']['elements']['csrUser'] = 'User';                    

2) Force a refresh of your custom data by appending ?resolveCustomData=1 to your Zurmo URL
3) Update your schema by running the following from the runtime/commands folder:

./zurmoc updateschema super 

4) Go back into Zurmo, use the designer to drop the fields on your detail/edit and list views and voila!
You can also update the 'rules', 'noAudit', etc arrays also for the base models in the same way i updated relations and elements.   
And hopefully it goes without saying, I don't work for Zurmo, so I can't guarantee they won't blow the globalMetadata table away in some update, but for now its been fine.. :)   Test test test!

Also tagged with one or more of these keywords: module, extend, accounts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users