From Github – https://github.com/salesagility/SuiteCRM/issues/6507
Fixing:
change to /data/Relationships/M2MRelationship.php to downgrade this to a warning so it wouldn’t fill the logs (if log level at Error). This is not an upgrade-safe change.
~ Line 90:
$GLOBALS['log']->warn("Warning: Multiple links found for relationship {$this->name} within module {$module}");
//$GLOBALS['log']->error("Warning: Multiple links found for relationship {$this->name} within module {$module}");
Fix is from suitecrm https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/12382-help-with-log-errors-multiple-links-found-for-relationship
This seems to come from M2MRelationship.php, which calls getLinkFieldForRelationship from VardefManager.php, which if it isn’t in cache calls getLinkFieldsforModule from the same file.
getLinkFieldsforModule, if I read correctly, returns each $dictionary entry where ‘type’ == ‘link’ and ‘relationship’ key is defined (and not empty). I believe, that if it finds multiple entries, that meet that criteria, the error is thrown. You’ll notice in my accounts<->contacts example, the first and third entries that are created are both ‘type’ == ‘link’ and both have ‘relationship’ key defined.
$dictionary["Account"]["fields"]["accounts_contacts_1"] = array (
'name' => 'accounts_contacts_1',
'type' => 'link',
'relationship' => 'accounts_contacts_1',
'source' => 'non-db',
'module' => 'Contacts',
'bean_name' => 'Contact',
'vname' => 'LBL_ACCOUNTS_CONTACTS_1_FROM_CONTACTS_TITLE',
'id_name' => 'accounts_contacts_1contacts_idb',
);
$dictionary["Account"]["fields"]["accounts_contacts_1_name"] = array (
'name' => 'accounts_contacts_1_name',
'type' => 'relate',
'source' => 'non-db',
'vname' => 'LBL_ACCOUNTS_CONTACTS_1_FROM_CONTACTS_TITLE',
'save' => true,
'id_name' => 'accounts_contacts_1contacts_idb',
'link' => 'accounts_contacts_1',
'table' => 'contacts',
'module' => 'Contacts',
'rname' => 'name',
'db_concat_fields' =>
array (
0 => 'first_name',
1 => 'last_name',
),
);
$dictionary["Account"]["fields"]["accounts_contacts_1contacts_idb"] = array (
'name' => 'accounts_contacts_1contacts_idb',
'type' => 'link',
'relationship' => 'accounts_contacts_1',
'source' => 'non-db',
'reportable' => false,
'side' => 'left',
'vname' => 'LBL_ACCOUNTS_CONTACTS_1_FROM_CONTACTS_TITLE',
);
Whereas, in modules/Accounts/vardefs.php, contacts is simply defined with one entry:
'contacts' => array(
'name' => 'contacts',
'type' => 'link',
'relationship' => 'accounts_contacts',
'module' => 'Contacts',
'bean_name' => 'Contact',
'source' => 'non-db',
'vname' => 'LBL_CONTACTS',
),
Now I assume some of that extra code is necessary, but it also seems to generate the error in the logs