Help with Log Errors: multiple links found for relationship

Can somebody help me with these errors?

Mon 19 Dez 2016 13:25:21 CET [26054][85b6face-7ef6-6e9a-4155-5784f3953bd3][ERROR] Warning: Multiple links found for relationship prospect_list_accounts within module Accounts
Mon 19 Dez 2016 13:28:54 CET [26413][85b6face-7ef6-6e9a-4155-5784f3953bd3][ERROR] Warning: Multiple links found for relationship prospect_list_contacts within module Contacts
Mon 19 Dez 2016 13:29:23 CET [26054][85b6face-7ef6-6e9a-4155-5784f3953bd3][ERROR] Unable to get proper side for link assigned_user_link

Perhaps a hint?

In /cache/modules/Contacts/Contactvardefs.php (array “fields”) I find two entries for links with relationship name “prospect_list_contacts”:

‘prospect_lists’ =>
array (
‘name’ => ‘prospect_lists’,
‘type’ => ‘link’,
‘relationship’ => ‘prospect_list_contacts’,

‘module’ => ‘ProspectLists’,
‘source’ => ‘non-db’,
‘vname’ => ‘LBL_PROSPECT_LIST’,
),

‘prospect_list_contacts’ =>
array (
‘name’ => ‘prospect_list_contacts’,
‘type’ => ‘link’,
‘relationship’ => ‘prospect_list_contacts’,

‘source’ => ‘non-db’,
‘vname’ => ‘LBL_PROSPECTLISTS_CONTACTS_FROM_PROSPECTLISTS_TITLE’,
),

Where might this be coming from?

In a fairly new installation of SuiteCRM I see that the same file only has of these: “prospect_lists”

Then in /cache/Relationships/relationships.cache.php I find this (seems to be standard):

‘prospect_list_contacts’ =>
array (
‘name’ => ‘prospect_list_contacts’,
‘lhs_module’ => ‘ProspectLists’,
‘lhs_table’ => ‘prospect_lists’,
‘lhs_key’ => ‘id’,
‘rhs_module’ => ‘Contacts’,
‘rhs_table’ => ‘contacts’,
‘rhs_key’ => ‘id’,
‘relationship_type’ => ‘many-to-many’,
‘join_table’ => ‘prospect_lists_prospects’,
‘join_key_lhs’ => ‘prospect_list_id’,
‘join_key_rhs’ => ‘related_id’,
‘relationship_role_column’ => ‘related_type’,
‘relationship_role_column_value’ => ‘Contacts’,
‘fields’ =>
array (
0 =>
array (
‘name’ => ‘id’,
‘type’ => ‘varchar’,
‘len’ => ‘36’,
),
1 =>
array (
‘name’ => ‘prospect_list_id’,
‘type’ => ‘varchar’,
‘len’ => ‘36’,
),
2 =>
array (
‘name’ => ‘related_id’,
‘type’ => ‘varchar’,
‘len’ => ‘36’,
),
3 =>
array (
‘name’ => ‘related_type’,
‘type’ => ‘varchar’,
‘len’ => ‘25’,
),
4 =>
array (
‘name’ => ‘date_modified’,
‘type’ => ‘datetime’,
),
5 =>
array (
‘name’ => ‘deleted’,
‘type’ => ‘bool’,
‘len’ => ‘1’,
‘default’ => ‘0’,
),
),
)

also seeing the same with Leads module:

Mon 19 Dez 2016 16:52:33 CET [9772][7098c295-4ea7-26fe-af1d-4dda14b75350][ERROR] Warning: Multiple links found for relationship prospect_list_leads within module Leads
It gets triggered anytime a Lead record is loaded (detailview).

My guess would be that this comes from having upgraded our system from Sugar 6.1.x over the years and that something changed with the prospectList module along the way… but still haven’t been able to figure it out.

Fixed it. I had added subpanels for Target Lists (ProspectLists) in the modules Accounts, Contacts and Leads.

There was a conflict between original vardefs file
/modules/[Modulename]/vardefs.php
and custom extension file under
/custom/Extension/modules/[Modulename]/Ext/Vardefs/[vardef-extension-file].php.
They both defined a type ‘link’ field for the same relationship but with differing names.

I removed the duplicate block from the extension file, e.g. for Leads:
$dictionary[“Lead”][“fields”][“prospect_list_leads”].

Then in custom layout file under /custom/Extension/modules/[Modulename]/Ext/Layoutdefs/[layout-extension-file].php
I changed the name of the link used to lead the subpanel.

$layout_defs["[Modulename]"][“subpanel_setup”][‘prospect_lists’]

and the key/value
‘get_subpanel_data’ => ‘prospect_lists’,

to reflect the original name of the link.

Just in case someone else encounters something similar…

1 Like

So, I don’t really understand John - EZS’s post and I’m hoping someone can help. I’m getting a lot of duplication relationship errors (although they don’t seem to be causing issues) I’d like to get rid of them. Here are some examples:


Thu Nov 15 15:58:16 2018 [19400][1][ERROR] Warning: Multiple links found for relationship pr_pricing_accounts within module PR_Pricing
Thu Nov 15 15:58:16 2018 [19400][1][ERROR] Warning: Multiple links found for relationship pr_pricing_accounts within module Accounts
Thu Nov 15 15:58:16 2018 [19400][1][ERROR] Warning: Multiple links found for relationship project_contacts_2 within module Project
Thu Nov 15 15:58:16 2018 [19400][1][ERROR] Warning: Multiple links found for relationship project_contacts_2 within module Contacts

In modules/contacts/vardefs.php I have the following:



--- abridged for conciseness ---

$dictionary['Contact'] = array('table' => 'contacts', 'audited' => true,

    'unified_search' => true, 'full_text_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge' => true, 'fields' =>
        array(

--- abridged for conciseness ---

            'project' =>
                array(
                    'name' => 'project',
                    'type' => 'link',
                    'relationship' => 'projects_contacts',
                    'source' => 'non-db',
                    'vname' => 'LBL_PROJECTS',
                ),

--- abridged for conciseness ---

            'project_contacts_1' =>
                array(
                    'name' => 'project_contacts_1',
                    'type' => 'link',
                    'relationship' => 'project_contacts_1',
                    'source' => 'non-db',
                    'module' => 'Project',
                    'bean_name' => 'Project',
                    'vname' => 'LBL_PROJECT_CONTACTS_1_FROM_PROJECT_TITLE',
                ),

--- abridged for conciseness ---

In custom/modules/contacts/ext/vardefs/vardefs.ext.php I have the following:



--- abridged for conciseness ---

$dictionary["Contact"]["fields"]["project_contacts_2"] = array (
  'name' => 'project_contacts_2',
  'type' => 'link',
  'relationship' => 'project_contacts_2',
  'source' => 'non-db',
  'module' => 'Project',
  'bean_name' => 'Project',
  'vname' => 'LBL_PROJECT_CONTACTS_2_FROM_PROJECT_TITLE',
  'id_name' => 'project_contacts_2project_ida',
);
$dictionary["Contact"]["fields"]["project_contacts_2_name"] = array (
  'name' => 'project_contacts_2_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_PROJECT_CONTACTS_2_FROM_PROJECT_TITLE',
  'save' => true,
  'id_name' => 'project_contacts_2project_ida',
  'link' => 'project_contacts_2',
  'table' => 'project',
  'module' => 'Project',
  'rname' => 'name',
);
$dictionary["Contact"]["fields"]["project_contacts_2project_ida"] = array (
  'name' => 'project_contacts_2project_ida',
  'type' => 'link',
  'relationship' => 'project_contacts_2',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'left',
  'vname' => 'LBL_PROJECT_CONTACTS_2_FROM_PROJECT_TITLE',
);

--- abridged for conciseness ---

Now, I assume the problem is with the code in vardefs.ext.php, since it references “projects_contacts_2” and so does the error message. And I also assumed that the problem is related to the first key [“projects_contacts_2”] and the third key [“project_contacts_2project_ida”]. That assumption was no good, however…

In looking in studio, it appears I added projects_contacts_2 through studio. It is a One to One relationship, wheras the other two relationships are a Many to Many relationship. The idea was to identify a ‘primary contact’. project_contacts and project_contacts_1 both appear to be built-in relationships.

Once I figure this out, i can go try and figure out what is going on with pr_pricing_accounts… I looked at that, and see no differences between the relationship for accounts vs the relationship for contacts, even though only accounts is providing the error in the log.

sieberta

OK, I think I’m finally on to something. In each instance where I get an error message for multiple links found for relationships, I see that in (/custom/Extension/modules/[moduleName]/Ext/Vardefs there is a php file that defines that relationship. On relationships that don’t get that error, there is no such pdf file. I think this is a bug in Studio, where the relationship is double-defined. I’m going to use a specific example, which is a relationship pr_pricing_contacts.

Example errors:


Fri Nov 16 11:17:02 2018 [12803][1][ERROR] Warning: Multiple links found for relationship pr_pricing_contacts within module PR_Pricing
Fri Nov 16 11:17:02 2018 [12803][1][ERROR] Warning: Multiple links found for relationship pr_pricing_contacts within module Contacts

In /custom/Extension/modules/Contacts/Ext/Vardefs there is a file with these contents (pr_pricing_contacts_Contacts.php):

<?php
// created: 2016-11-04 16:33:40
$dictionary["Contact"]["fields"]["pr_pricing_contacts"] = array (
  'name' => 'pr_pricing_contacts',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'module' => 'PR_Pricing',
  'bean_name' => false,
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_PR_PRICING_TITLE',
  'id_name' => 'pr_pricing_contactspr_pricing_ida',
);
$dictionary["Contact"]["fields"]["pr_pricing_contacts_name"] = array (
  'name' => 'pr_pricing_contacts_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_PR_PRICING_TITLE',
  'save' => true,
  'id_name' => 'pr_pricing_contactspr_pricing_ida',
  'link' => 'pr_pricing_contacts',
  'table' => 'pr_pricing',
  'module' => 'PR_Pricing',
  'rname' => 'name',
);
$dictionary["Contact"]["fields"]["pr_pricing_contactspr_pricing_ida"] = array (
  'name' => 'pr_pricing_contactspr_pricing_ida',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'left',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_PR_PRICING_TITLE',
);

In /custom/modules/Contacts/Ext/Vardefs there is a file called vardefs.ext.php, which has this contents (as well as a lot more):


// created: 2016-11-04 16:33:40
$dictionary["Contact"]["fields"]["pr_pricing_contacts"] = array (
  'name' => 'pr_pricing_contacts',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'module' => 'PR_Pricing',
  'bean_name' => false,
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_PR_PRICING_TITLE',
  'id_name' => 'pr_pricing_contactspr_pricing_ida',
);
$dictionary["Contact"]["fields"]["pr_pricing_contacts_name"] = array (
  'name' => 'pr_pricing_contacts_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_PR_PRICING_TITLE',
  'save' => true,
  'id_name' => 'pr_pricing_contactspr_pricing_ida',
  'link' => 'pr_pricing_contacts',
  'table' => 'pr_pricing',
  'module' => 'PR_Pricing',
  'rname' => 'name',
);
$dictionary["Contact"]["fields"]["pr_pricing_contactspr_pricing_ida"] = array (
  'name' => 'pr_pricing_contactspr_pricing_ida',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'left',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_PR_PRICING_TITLE',
);

My theory is that having the same code in both locations is causing it to be included twice, creating the problematic error messages. Note the date and timestamp on each is identical, so this was done by Studio… and I believe is a bug in studio (or was a bug in studio at the time when this relationship was defined.

There is also a file in /custom/Extension/modules/PR_Pricing/Ext/Vardefs called “pr_pricing_contacts_PR_Pricing.php” which contains:

<?php
// created: 2016-11-04 16:33:40
$dictionary["PR_Pricing"]["fields"]["pr_pricing_contacts"] = array (
  'name' => 'pr_pricing_contacts',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'module' => 'Contacts',
  'bean_name' => 'Contact',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_CONTACTS_TITLE',
  'id_name' => 'pr_pricing_contactscontacts_idb',
);
$dictionary["PR_Pricing"]["fields"]["pr_pricing_contacts_name"] = array (
  'name' => 'pr_pricing_contacts_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_CONTACTS_TITLE',
  'save' => true,
  'id_name' => 'pr_pricing_contactscontacts_idb',
  'link' => 'pr_pricing_contacts',
  'table' => 'contacts',
  'module' => 'Contacts',
  'rname' => 'name',
  'db_concat_fields' => 
  array (
    0 => 'first_name',
    1 => 'last_name',
  ),
);
$dictionary["PR_Pricing"]["fields"]["pr_pricing_contactscontacts_idb"] = array (
  'name' => 'pr_pricing_contactscontacts_idb',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'left',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_CONTACTS_TITLE',
);

And there is also a file in /custom/modules/PR_Pricing/Ext/Vardefs called “vardefs.ext.php” which containts:


// created: 2016-11-04 16:33:40
$dictionary["PR_Pricing"]["fields"]["pr_pricing_contacts"] = array (
  'name' => 'pr_pricing_contacts',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'module' => 'Contacts',
  'bean_name' => 'Contact',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_CONTACTS_TITLE',
  'id_name' => 'pr_pricing_contactscontacts_idb',
);
$dictionary["PR_Pricing"]["fields"]["pr_pricing_contacts_name"] = array (
  'name' => 'pr_pricing_contacts_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_CONTACTS_TITLE',
  'save' => true,
  'id_name' => 'pr_pricing_contactscontacts_idb',
  'link' => 'pr_pricing_contacts',
  'table' => 'contacts',
  'module' => 'Contacts',
  'rname' => 'name',
  'db_concat_fields' => 
  array (
    0 => 'first_name',
    1 => 'last_name',
  ),
);
$dictionary["PR_Pricing"]["fields"]["pr_pricing_contactscontacts_idb"] = array (
  'name' => 'pr_pricing_contactscontacts_idb',
  'type' => 'link',
  'relationship' => 'pr_pricing_contacts',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'left',
  'vname' => 'LBL_PR_PRICING_CONTACTS_FROM_CONTACTS_TITLE',
);

Now, in projects, I get this error for ‘contacts’ but I don’t get this error for ‘accounts’. And there is no file in /custom/Extension/modules/Project/Ext/Vardefs called “project_accounts” or anything similar. Which makes me wonder if I should just delete those files in the Ext folder for each module… and the world will be happy again.

HOWEVER, I also don’t get this error message for pr_pricing_activities_calls, emails, meetings, notes, or tasks… and there are files for each of those within /custom/Extension/modules/PR_Pricing/Ext/Vardefs… however, the contents are a bit more simplified in each of these:

vardefs.ext.php (related to notes):

// created: 2016-11-04 16:33:40
$dictionary["PR_Pricing"]["fields"]["pr_pricing_activities_notes"] = array (
  'name' => 'pr_pricing_activities_notes',
  'type' => 'link',
  'relationship' => 'pr_pricing_activities_notes',
  'source' => 'non-db',
  'module' => 'Notes',
  'bean_name' => 'Note',
  'vname' => 'LBL_PR_PRICING_ACTIVITIES_NOTES_FROM_NOTES_TITLE',
);

pr_pricing_activities_notes_PR_Pricing.php:

<?php
// created: 2016-11-04 16:33:40
$dictionary["PR_Pricing"]["fields"]["pr_pricing_activities_notes"] = array (
  'name' => 'pr_pricing_activities_notes',
  'type' => 'link',
  'relationship' => 'pr_pricing_activities_notes',
  'source' => 'non-db',
  'module' => 'Notes',
  'bean_name' => 'Note',
  'vname' => 'LBL_PR_PRICING_ACTIVITIES_NOTES_FROM_NOTES_TITLE',
);

pr_pricing_activities_notes_Notes.php:

<?php
// created: 2016-11-04 16:33:40
$dictionary["Note"]["fields"]["pr_pricing_activities_notes"] = array (
  'name' => 'pr_pricing_activities_notes',
  'type' => 'link',
  'relationship' => 'pr_pricing_activities_notes',
  'source' => 'non-db',
  'module' => 'PR_Pricing',
  'bean_name' => false,
  'vname' => 'LBL_PR_PRICING_ACTIVITIES_NOTES_FROM_PR_PRICING_TITLE',
);

And vardefs.ext.php in /custom/modules/Notes/Ext/Vardefs:

// created: 2016-11-04 16:33:40
$dictionary["Note"]["fields"]["pr_pricing_activities_notes"] = array (
  'name' => 'pr_pricing_activities_notes',
  'type' => 'link',
  'relationship' => 'pr_pricing_activities_notes',
  'source' => 'non-db',
  'module' => 'PR_Pricing',
  'bean_name' => false,
  'vname' => 'LBL_PR_PRICING_ACTIVITIES_NOTES_FROM_PR_PRICING_TITLE',
);

So the notes example kindof bursts my bubble on thinking I’ve found a fix for this.

Yikes this is a long post… sieberta

If I am not mistaken:

In /custom/Extension/modules/Contacts/Ext/Vardefs

you provide an element that will be put together with others during the QR&R, and then saved in

/custom/modules/Contacts/Ext/Vardefs

This last file is the one that SuiteCRM will use. So this is not really a double definition. I don’t think the files are made at the same time, either. The timestamps coulb be fooling you, they might have both been copied form another server or from a backup at the same time, for example. One is done by you or by Studio, the other by the QR&R.

To understand this further, a couple of ideas:

  1. Right after this line, https://github.com/salesagility/SuiteCRM/blob/master/ModuleInstall/ModuleInstaller.php#L1828

add this code:


                               $extension .= "\n\n// " . get_class($this) . "->merge_files(): found " . $module_install.$entry . "\n" ;
                               $extension .= "// Reading " . substr_count( $file, "\n" ) . " lines last modified on " . date ("F d Y H:i:s.", filemtime($module_install . '/' . $entry)) . "\n";
                               $extension .= "// -------------------------------------------------------------------------------------------------------------\n";

Now run a QR&R and your generated files will explicitly tell you where each part is coming from.

  1. Use this technique and see which files Studio is reading and writing, and then which files QR&R is using and generating:

https://pgorod.github.io/Audit-File-Accesses/

1 Like

pgr,

Thank you for the ideas. They are helpful in furthering my understanding of SUITECRM, even if they haven’t yet helped lead me to resolution to this problem. I did put in the proposed lines of code, and I did do a QR&R, and I did see the entries… they just didn’t lead to a solution.

One of the relationships I have duplicate error messages on is PR_Pricing to Accounts. In case this is a bug that has been fixed… I created that relationship again, which created a relationship called pr_pricing_accounts_1, as anticipated. It also added pretty much the same 3 entries to the vardefs, with the only difference being ‘bean_name’ => ‘PR_Pricing’ instead of ‘bean_name’ => false. That seemed like it might be valuable information, but I get the same error message there as I got for pr_pricing_accounts… so I can feel pretty confident changing the bean name from ‘false’ to ‘PR_Pricing’ isn’t going to solve the issue.

I have a nagging feeling that the issue might be related to the fact that the 1st and 3rd entries both have the key pair: ‘relationship’ -> ‘pr_pricing_accounts’ (or in the case of my new relationship: ‘relationship’ -> ‘pr_pricing_accounts_1’.

That isn’t really based on much, just the fact that is a duplicate key… and In Post # 74378 I indicated that was a bad assumption, but I didn’t explain why. Shame on me for bad notes… now I have to research that again and see why I didn’t like that assumption the first time.

sieberta

I have multiple development instances of SuiteCRM while I’m working through the upgrade from 7.6 to 7.10.10. One such development instance I call ‘cleaninstall’ which is a fresh installation of 7.10.10 that didn’t start as an older version and didn’t get upgraded and doesn’t have any customizations. It is helpful in determining when the problem is inherent to SuiteCRM, as opposed to being a result of my actions.

I created a one to one relationship between Project and Contacts in ‘cleaninstall’, and I get the duplicate error message.

I created a one to one relationship between Accounts and Contacts in ‘cleaninstall’, and I also get the duplicate error message there.

It stands to reason that I’ve found a bug, I assume in Studio, in SuiteCRM. I was going to try this at demo.suiteondemand.com, but aparently will:will doesn’t have administrative access.

I have opened an Issue on GitHub: https://github.com/salesagility/SuiteCRM/issues/6507

1 Like

Confirmed,

I have also experienced a very similar situation with custom modules where the relationship was created in the studio. It seems that the definition is being referenced twice and although the warning is a non-blocking error, it could use some attention.

In our use case a single relationship between a custom module and another custom module was created and although the relationship works as expected, an error of this nature is thrown for the relationship. No out of studio customization for relationship exist for the module where the relationship was created.

@jasenward,

Appreciate the support. To help avoid allowing this to hide more important errors, I made the following change to /data/Relationships/M2MRelationship.php to downgrade this to a warning so it wouldn’t fill the logs (I keep my log level at Error). This is not an upgrade-safe change, but I’m OK with that:

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}");