[Vtigercrm-developers] transferRelatedRecords for related ModComments

Adam Heinz amh at metricwise.net
Fri Aug 31 06:34:37 PDT 2012


I just hammered out a feature request to merge comments when contacts
are merged.  I did so by hacking the ModComments module onto the end
of the related arrays in Contacts->transferRelatedRecords() [2].  This
seems pretty weak.  I'd really like ModComments to merge for any
module I've called ModComments::addWidgetTo() on.  It seems to me that
between the vtiger_relatedlists table and the hardcoded arrays in
transferRelatedRecords [1] there's a need for the system to understand
module relations.  Ideas?

[1] http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/modules/Contacts/Contacts.php#L1172
[2]
Index: modules/Contacts/Contacts.php
===================================================================
--- modules/Contacts/Contacts.php  (revision 3097)
+++ modules/Contacts/Contacts.php  (working copy)
@@ -1234,17 +1234,17 @@
                $rel_table_arr =
Array("Potentials"=>"vtiger_contpotentialrel","Activities"=>"vtiger_cntactivityrel","Emails"=>"vtiger_seactivityrel",

"HelpDesk"=>"vtiger_troubletickets","Quotes"=>"vtiger_quotes","PurchaseOrder"=>"vtiger_purchaseorder",

"SalesOrder"=>"vtiger_salesorder","Products"=>"vtiger_seproductsrel","Documents"=>"vtiger_senotesrel",
-
"Attachments"=>"vtiger_seattachmentsrel","Campaigns"=>"vtiger_campaigncontrel");
+
"Attachments"=>"vtiger_seattachmentsrel","Campaigns"=>"vtiger_campaigncontrel","ModComments"=>"vtiger_modcomments");

                $tbl_field_arr =
Array("vtiger_contpotentialrel"=>"potentialid","vtiger_cntactivityrel"=>"activityid","vtiger_seactivityrel"=>"activityid",

"vtiger_troubletickets"=>"ticketid","vtiger_quotes"=>"quoteid","vtiger_purchaseorder"=>"purchaseorderid",

"vtiger_salesorder"=>"salesorderid","vtiger_seproductsrel"=>"productid","vtiger_senotesrel"=>"notesid",
-
"vtiger_seattachmentsrel"=>"attachmentsid","vtiger_campaigncontrel"=>"campaignid");
+
"vtiger_seattachmentsrel"=>"attachmentsid","vtiger_campaigncontrel"=>"campaignid","vtiger_modcomments"=>"modcommentsid");

                $entity_tbl_field_arr =
Array("vtiger_contpotentialrel"=>"contactid","vtiger_cntactivityrel"=>"contactid","vtiger_seactivityrel"=>"crmid",

"vtiger_troubletickets"=>"parent_id","vtiger_quotes"=>"contactid","vtiger_purchaseorder"=>"contactid",

"vtiger_salesorder"=>"contactid","vtiger_seproductsrel"=>"crmid","vtiger_senotesrel"=>"crmid",
-
"vtiger_seattachmentsrel"=>"crmid","vtiger_campaigncontrel"=>"contactid");
+
"vtiger_seattachmentsrel"=>"crmid","vtiger_campaigncontrel"=>"contactid","vtiger_modcomments"=>"related_to");

                foreach($transferEntityIds as $transferId) {
                        foreach($rel_table_arr as $rel_module=>$rel_table) {


More information about the vtigercrm-developers mailing list