Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting the Account <-> Contact relation to N:N (and handling UI10 fields)
#1
We have a default relation between accounts and contacts, where every contact can have one account. In reality, however, a contact can have multiple accounts associated. Take for instance an company that has multiple locations, and therefor multiple accounts in the system, but has a contact that is responsible for multiple locations. That would require us to change the relationship between accounts and contacts. Now that part is easy, but, we also have capture fields on the inventory modules that pre-filter the list of contacts based on the selected account in the popup window. I would like to propose creating a global variable that would let you select how you want to filter these contacts: either by the 1:N relation, or the N:N. Would I change code in the Contacts module to make this happen?
Reply
#2
very difficult, the 1:n relation is given as a fact all over the application, would be a lot of work to change that relation
Joe
TSolucio
Reply
#3
Still, I think the relation assumption is fundamentally wrong, since contacts can be related to multiple accounts in the real world. What would be even better, is when we could describe the nature of each relation between a contact and an account (like we do with productcomponent). Something that seems like a good idea to me, since we do call ourselves a Customer Relations Management system.
Reply
#4
https://corebos.com/documentation/doku.php?id=en:extensions:extensions:cbrelations

maybe that can help
Joe
TSolucio
Reply
#5
That does seem like a good place to start. But that still would not solve the UI10 filtering on the inventory modules on its own I guess
Reply
#6
We could start by adding code to the contacts module that checks is the relationship module is installed or not, to determine how the preselected list of contacts should be retrieved? I do think we need to change this. As always, with backwards compatibility, but the current way of doing it has serious shortcomings in my opinion.
Reply
#7
OK, so something has to be done here since now we have to create the same contact 5 times. One guy, 5 contact entries, which means that if he changes his mobile no. we have to change that 5 times, just because he is responsible for 5 accounts. I am going to create a field in salesorders that searches contacts in a proper way. We can open the popup with a prefiltered list of records, but that is not enough here, I need a custom way. How do I customize the URL of the popup window to some value of my own?
Reply
#8
search for "popup" in the wiki, probably looking for https://corebos.com/documentation/doku.php?id=en:devel:corebos_hooks:popup_open_hook but there are some others

can't you just use the cbrelations module to register the list of accounts the contact is related to?

one contact > account the company he works for, cbrelations > the accounts he is responsible for (for example)

then you can use the popup query hook to filter the accounts
Joe
TSolucio
Reply
#9
I've yet to test cbrelations, but the problem I have is that I want to make sure the popup in a salesorder (that opens when you want to select a contact) pre-selects the contacts that have a relation to the account already selected for the salesorder. We have that now, but we can only select 1 account per contact through that mechanism, and that is just not a workable way of doing things. So I want to pre-select the contacts that are related to the account, through cbrelations or some other module.

Also, I don't think it is conceptually correct to fill in the account the contact 'works for'. It is hardly ever our business to know how the exact labour-relation is between a contact and his/her employer. I think we should focus on why we, from our business perspective, should be interested in the contact in relation to the account. If you catch my drift.
Reply
#10
Install cbRelations and use the popup query hook to filter the accounts you want to show, that should permit you to work as you need. Keep asking
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)