CoreBOSBB
related list only works one way - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: related list only works one way (/showthread.php?tid=703)



related list only works one way - Guido1982 - 08-02-2017

I never noticed this, but I'm getting a complaint about it. When creating a purchase order from a salesorder's related list (for example), the salesorder appears in the new purchase order's related list, but not the other way around. Is there any way I can fix this?


RE: related list only works one way - joebordes - 08-02-2017

Those two modules are not related in a standard coreBOS so the question is: How did you relate them? get_dependent_list, get_related_list, other...?


RE: related list only works one way - Guido1982 - 08-03-2017

I related them some time ago, but honestly I don't remember which method I used (I didn't know there were multiple). It may even be that I created a row in the database for the relation. What's the difference between the two methods?


RE: related list only works one way - Guido1982 - 08-03-2017

OK, I figured out what the difference between get_related_list and get_dependents_list is. I've created a UI10 field in PurchaseOrders and setup a get_dependents_list entry. But I'd like to add BOTH related types to salesorders. So a  related list that shows but the related through a UI10 field, and the related through the vtiger_crmentityrel table. Is that even possible?

Also, the problem I have when setting up a relation through get_related_list is creating a new record in this way does not setup a row in vtiger_crmentityrel.


RE: related list only works one way - joebordes - 08-03-2017

To show both relations in one list you will have to create a custom function. Basically, add a new get_related_records() method that does a UNION of get_dependents and get_related queries.


RE: related list only works one way - Guido1982 - 08-04-2017

Cool, I'll do that. Maybe create a PR? I think it would be a neat function for the core. One question, do all relation function receive the same variables? Like
PHP Code:
function get_related_list($id$cur_tab_id$rel_tab_id$actions false



RE: related list only works one way - joebordes - 08-04-2017

Interesting, I hadn't thought of that as a base code functionality, but it makes a lot of sense. Yes, I would accept a PR for that.

Yes, they all receive the same parameters.


RE: related list only works one way - Guido1982 - 08-04-2017

Sadly, as discussed on Gitter this proves to be a lot more difficult than I initially thought. Hope for better days but for now I've given up on it.