Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:modifications:popup_relations [2014/10/09 14:38]
swarnat
en:modifications:popup_relations [2014/11/03 10:52] (current)
swarnat [Create a Relation]
Line 5: Line 5:
 </​WRAP>​ </​WRAP>​
  
 +===== Explanation of modification =====
 +
 +This modification could help you, if you create a custom module and want to link this module with default modules.
 +
 +For example you create a new Module "​Buildings"​ which has a field "​Organization"​ to link a Organizations.
 +Now you had a related field in Contacts to choose a record within the new "​Buildings"​ module.
 +
 +In basic Vtiger you will see every available record in "​Buildings"​ if you click on the search button, regardless if you select a Organization in the Contact, which could limit the available records.
 +This modification will integrate this in a flexible way.
 +You could create a configuration in the database to only get Buildings from the Organization of the Contacts as selection. (See below)
 +But you are not limited to this records. If you use the search option in the popup you could nevertheless select every record.
 +===== Read first =====
 This modification was only tested in vtigerCRM 6.1. This modification was only tested in vtigerCRM 6.1.
  
-This modification could decrease the frontend performance a little, because it needs to be integrated into every EditView. Regardless if you use this feature in the module. +This modification could **decrease the frontend performance a little**, because it needs to be integrated into every EditView. Regardless if you use this feature in the module. 
-In modern Browsers you won't recognize this.+**In modern Browsers you won't recognize this.**
 It execute 2 database Queries on the EditView/​CreateView and one in the PopUp. It execute 2 database Queries on the EditView/​CreateView and one in the PopUp.
  
-At first please install+At first please install ​the latest version of [[https://​shop.stefanwarnat.de/​vtigercrm-tools/​|VtigerCRM Tools]]
 ==== Create DB Table ==== ==== Create DB Table ====
  
Line 17: Line 29:
 CREATE TABLE IF NOT EXISTS `vtiger_popup_relation` ( CREATE TABLE IF NOT EXISTS `vtiger_popup_relation` (
 `id` int(11) NOT NULL, `id` int(11) NOT NULL,
-`src_module` varchar(30) NOT NULL, +  ​`src_module` varchar(30) NOT NULL, 
-`src_field` varchar(50) NOT NULL, +  `src_field` varchar(50) NOT NULL, 
-`module` varchar(30) NOT NULL, +  `module` varchar(30) NOT NULL, 
-`search_key` varchar(50) NOT NULL+  `search_key` varchar(50) NOT NULL, 
 +  `search_value` varchar(50) NOT NULL
 ) ENGINE=InnoDB ; ) ENGINE=InnoDB ;
  
Line 131: Line 144:
  */  */
 </​code>​ </​code>​
 +
 +===== Create a Relation =====
 +
 +You now could use this feature.
 +You need to insert a new line in the just created table vtiger_popup_relation.
 +
 +You get the values if you open the PopUp you want to modify.
 +
 +^ Column ^ Value ^
 +| src_module | You get from the PopUP URL |
 +| src_field | You get from the PopUP URL |
 +| module | You get from the PopUP URL |
 +| search_key | Which field in the related module should be used to search |
 +| search_value | Which fieldvalue of the record you modify should be used |
 +<WRAP center ​ tip 100%>
 +=== Example ===
 +You have a new Field "​Contact B" (Fieldname: contactb_id) in the Organization module, which should only choosable from Contacts within the Organization in "​Member Of" (Fieldname: account_id)
 +(Organization fieldname in Contacts module is "​account_id",​ too)
 +
 +You need to insert:
 +| **src_module** | Accounts |
 +| **src_field** | contactb_id |
 +| **module** | Contacts |
 +| **search_key** | account_id | (The field within Contacts module) |
 +| **search_value** | account_id | (The field within Organization module) |
 +
 +</​WRAP>​