<?php
return array(
    'Campaigns' => array(
        0 => array(
            'tableName' => 'vtiger_campaignaccountrel',
            'applicableModules' => array(0 => 'Accounts'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'campaignid',
                    'title' => 'campaignid'
                ),
                1 => array(
                    'name' => 'accountid',
                    'title' => 'accountid'
                ),
            )
        ),
        1 => array(
            'tableName' => 'vtiger_campaigncontrel',
            'applicableModules' => array(0 => 'Contacts'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'campaignid',
                    'title' => 'campaignid'
                ),
                1 => array(
                    'name' => 'contactid',
                    'title' => 'contactid'
                ),
            )
        ),
        2 => array(
            'tableName' => 'vtiger_campaignleadrel',
            'applicableModules' => array(0 => 'Leads'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'campaignid',
                    'title' => 'campaignid'
                ),
                1 => array(
                    'name' => 'leadid',
                    'title' => 'leadid'
                ),
            )
        ),
        3 => array(
            'tableName' => 'vtiger_campaignleadrel',
            'applicableModules' => array(0 => 'Leads'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'campaignid',
                    'title' => 'campaignid'
                ),
                1 => array(
                    'name' => 'leadid',
                    'title' => 'leadid'
                ),
            )
        )
    ),
    'Contacts' => array(
        0 => array(
            'tableName' => 'vtiger_cntactivityrel',
            'applicableModules' => array(0 => 'Activities'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'contactid',
                    'title' => 'contactid'
                ),
                1 => array(
                    'name' => 'activityid',
                    'title' => 'activityid'
                ),
            )
        ),
        1 => array(
            'tableName' => 'vtiger_contpotentialrel',
            'applicableModules' => array(0 => 'Potentials'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'contactid',
                    'title' => 'contactid'
                ),
                1 => array(
                    'name' => 'potentialid',
                    'title' => 'potentialid'
                ),
            )
        )
    ),
    'Leads' => array(
        0 => array(
            'tableName' => 'vtiger_leadacctrel',
            'applicableModules' => array(0 => 'Accounts'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'leadid',
                    'title' => 'leadid'
                ),
                1 => array(
                    'name' => 'accountid',
                    'title' => 'accountid'
                ),
            )
        ),
        1 => array(
            'tableName' => 'vtiger_leadcontrel',
            'applicableModules' => array(0 => 'Contacts'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'leadid',
                    'title' => 'leadid'
                ),
                1 => array(
                    'name' => 'contactid',
                    'title' => 'contactid'
                ),
            )
        ),
        2 => array(
            'tableName' => 'vtiger_leadpotrel',
            'applicableModules' => array(0 => 'Leads'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'leadid',
                    'title' => 'leadid'
                ),
                1 => array(
                    'name' => 'potentialid',
                    'title' => 'potentialid'
                ),
            )
        )
    ),
    // Added user and role many-to-many relationship
    "Users" => array(
        array(
            'tableName' => 'vtiger_user2role',
            'applicableModules' => array(0 => 'Roles'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'userid',
                    'title' => 'userid'
                ),
                1 => array(
                    'name' => 'roleid',
                    'title' => 'roleid'
                ),
            )
        ),
        array(
            'tableName' => 'vtiger_users2group',
            'applicableModules' => array('Groups'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'groupid',
                    'title' => 'groupid'
                ),
                1 => array(
                    'name' => 'userid',
                    'title' => 'userid'
                ),
            )
        ),
    ),
    "Groups" => array(
        array(
            'tableName' => 'vtiger_users2group',
            'applicableModules' => array('Users'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'groupid',
                    'title' => 'groupid'
                ),
                1 => array(
                    'name' => 'userid',
                    'title' => 'userid'
                ),
            )
        ),
    ),
    "Roles" => array(
        0 => array(
            'tableName' => 'vtiger_user2role',
            'applicableModules' => array(0 => 'Users'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'roleid',
                    'title' => 'roleid'
                ),
                1 => array(
                    'name' => 'userid',
                    'title' => 'userid'
                ),
            )
        ),
    ),
    "Accounts" => array(
        0 => array(
            'tableName' => 'vtiger_seactivityrel',
            'applicableModules' => array('Calendar', 'Events'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                1 => array(
                    'name' => 'activityid',
                    'title' => 'activityid'
                ),
            )
        ),
    ),
    "Potentials" => array(
        0 => array(
            'tableName' => 'vtiger_seproductsrel',
            'applicableModules' => array('Products'),
            'relModule' => true,
            'columns' => array(
                0 => array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                1 => array(
                    'name' => 'productid',
                    'title' => 'productid'
                ),
                2 => array(
                    'name' => 'setype',
                    'title' => 'setype'
                ),
            )
        ),
    ),
    "Events" => array(
        0 => array(
            'tableName' => 'vtiger_seactivityrel',
            'applicableModules' => array('Accounts', 'Potentials', 'SalesOrder'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                1 => array(
                    'name' => 'activityid',
                    'title' => 'activityid'
                ),
            )
        ),
    ),
    "Calendar" => array(
        0 => array(
            'tableName' => 'vtiger_seactivityrel',
            'applicableModules' => array('Accounts', 'Potentials', 'SalesOrder'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                1 => array(
                    'name' => 'activityid',
                    'title' => 'activityid'
                ),
            )
        ),
    ),
    "SalesOrder" => array(
        0 => array(
            'tableName' => 'vtiger_seactivityrel',
            'applicableModules' => array('Calendar', 'Events'),
            'relModule' => false,
            'columns' => array(
                0 => array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                1 => array(
                    'name' => 'activityid',
                    'title' => 'activityid'
                ),
            )
        ),
    ),
    'all' => array(
        array(
            'tableName' => 'vtiger_crmentityrel',
            'applicableModules' => array(0 => 'all'),
            'relModule' => true,
            'columns' => array(
                0 => array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                1 => array(
                    'name' => 'relcrmid',
                    'title' => 'relcrmid'
                ),
                2 => array(
                    'name' => 'relmodule',
                    'title' => 'relmodule'
                ),
            ),
        ),
        array(
            'tableName' => 'vtiger_senotesrel',
            'applicableModules' => array('all'),
            'relModule' => false,
            'columns' => array(
                array(
                    'name' => 'crmid',
                    'title' => 'crmid'
                ),
                array(
                    'name' => 'notesid',
                    'title' => 'notesid'
                ),
            ),
        )
    )
);