How to change stock relationships and names?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bandtank
    Active Community Member
    • Mar 2017
    • 379

    How to change stock relationships and names?

    I don't understand why I can't change the Accounts entity. I can add things to it, but I can't remove or modify any of the stock relationships. For example, I really need Accounts and Contacts to be one to many instead of many to many. I also need to rename Accounts to Clients. Am I missing something or does this require a change to the code?
  • bandtank
    Active Community Member
    • Mar 2017
    • 379

    #2
    I found the relationship buried in some code, but I'm still not sure if that's what I need to change. Also, if I make changes in that code, do I need to rebuild/reinstall the application? The same question applies if I figure out how to rename Accounts to Clients.

    Comment

    • bandtank
      Active Community Member
      • Mar 2017
      • 379

      #3
      I realize part of what I need to do is make sure I can update EspoCRM in the future, which I'm sure is why the developers allowed the entity definitions to be overwritten in custom files. However, I have no idea how to actually accomplish that because the Accounts definition, for example, is very tightly coupled to the rest of the application, so I'd have to change almost everything. Is it easier to simply start over with a brand new entity? Any guidance would be greatly appreciated.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        There is one-to-many between accounts and contacts. Just put Account field on the layout of Contact and remove Accounts.

        If we had allowed to change/remove stock relationships we would have had a hard time with enormous problems that crm administrators screwed up their software.
        Last edited by yuri; 03-05-2017, 01:39 PM.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • bandtank
          Active Community Member
          • Mar 2017
          • 379

          #5
          I realize you made the decision to not allow those changes on purpose now, but I'm sure they can still be changed. I want to learn how and where to make changes to modify the stock entities. The documentation doesn't clearly address this, so I'm a little lost. I also found some documentation showing how to make changes to custom entities, but it didn't make use of the custom folder, so I'm confused. Isn't the custom folder supposed to be used to override things like that to allow future upgrades to not overwrite custom changes?

          Also, 4.5.0 comes with a many to many relationship between accounts and contacts. There's a one to many between accounts and cases on the previous line, so that may be what you saw.
          Last edited by bandtank; 03-05-2017, 04:10 PM.

          Comment

          • bandtank
            Active Community Member
            • Mar 2017
            • 379

            #6
            For anyone else who is wondering how to do this, EspoCRM does not make it easy at all. Here's the list of files I had to change to rename Accounts to Clients:

            modified: application/Espo/Modules/Crm/EntryPoints/SubscribeAgain.php
            modified: application/Espo/Modules/Crm/EntryPoints/Unsubscribe.php
            modified: application/Espo/Modules/Crm/Repositories/TargetList.php
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Account.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Admin.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Call.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Case.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Contact.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Document.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Global.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Lead.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Meeting.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Opportunity.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Target.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/TargetList.json
            modified: application/Espo/Modules/Crm/Resources/i18n/en_US/Task.json
            modified: application/Espo/Modules/Crm/Services/TargetList.php
            modified: application/Espo/Resources/i18n/en_US/User.json

            You'll end up doing a lot of this (Note: Only change the string/label, not the identifier):
            Click image for larger version  Name:	2017-03-05_20-53-17.png Views:	1 Size:	56.7 KB ID:	26902



            This could have been a single entry in a single file, but it was spread out everywhere. There are hard-coded references in a few classes, which is why I had to edit PHP files. The ability to rename stock objects more easily would be nice.
            Last edited by bandtank; 03-06-2017, 04:46 AM.

            Comment

            Working...