SuiteCRM Nice Relationships

Hello every one

I’m trying to move my one-to-many relationship to a true one to many schema following this guide:

But I stuck on the final step “Unfortunately the above has now broken the products subpanel in accounts. Let’s fix this.”
My subpanel doesn’t fixed

What I did:

  1. I skipped “Fixing many to many field names” step
  2. Did all instructions on " Moving to a true one to many schema"
  3. My subpanel still broken but the other part works well - right now it stored relationship on “AOS_Product” table in “accound_id” column

How it looks inside SuiteCRM


and log:

Wed Feb 3 15:00:06 2021 [2963734][1][FATAL] Bad subpanel definition, it has incorrect value for get_subpanel_data property accounts_aos_products_1
Wed Feb 3 15:00:10 2021 [2964467][1][FATAL] Mysqli_query failed.
Wed Feb 3 15:00:10 2021 [2964467][1][FATAL] Error retrieving Account list: Query Failed: ORDER BY aos_products.id asc LIMIT 0,21: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ORDER BY aos_products.id asc LIMIT 0,21’ at line 1
Wed Feb 3 15:00:10 2021 [2964467][1][FATAL] [ListView::processUnionBeans] . Database failure. Please refer to suitecrm.log for details.

I test it with the same modules - between Account and AOS_Product like in guide
But also trying with other my new testing relationship

Is anyone has working nice relationship?
Maybe anyone can help with it?

My SuiteCRM 7.11.15

sorry guys

I the last step I did the wrong move We just need to add the relationship definition to instead add example code in the file I replaced him…
Right now it works well

1 Like

is anybody here use Nice relationship?

I faced with a strange case
It’s unable to create a new record from subpanel using Create button

  1. moving to a true 1-2 relationship following guide
  2. go to parent module
  3. go to sub panel
  4. click create button, type name field, and click save
  5. new record didn’t appear in subpanel it just created in relationship module with NO relate

UPD:
“select” button also doesn’t work

UPD2:
It doesn’t work any button on subpanel : create, select, remove. Only edit button works.
But if try to set value to this subpanel from other relationship side - go to child relationship module and set value in 1-2 relationship field its appear well in subpanel. But buttons still don’t work.
So I guess something happens on subpanel side, like it’s trying to find “join table” for relationship when I click create, select, remove buttons

is anyone can confirm unworked “select” button on subpanel If follow step by step from “moving to a true one-to-many relationship” part?

@pgr
maybe have you ever follow this guide?

No, sorry, I never followed it.

thanks for reply

I have fixed all my issue

There are a few differences between the guide and my finally working case:

Building SELF module one-to-many relationship:

  • For appear subpanel need to add the relationship definition to

custom/Extension/modules/SELF/Ext/Vardefs/SELF_SELF_1_SELF.php

$dictionary["SELF"]["relationships"]['SELF_SELF_1'] = array(
    'lhs_module' => 'SELF',
    'lhs_table' => 'SELF',
    'lhs_key' => 'id',
    'rhs_module' => 'SELF',
    'rhs_table' => 'SELF',
    'rhs_key' => 'id_SELF', // UPD: I just reverse SELF_id to id_SELF for my self wish, it's not important
    'relationship_type' => 'one-to-many',
);

For one-to-many relationship between two different module

Current guide steps have not good due to broken subpanel “select button” functional

Main issue was in Module name order, I just swap values between LHS_module/table and RHS_module/table, and LHS_key - RHS_key

To fix need a little change this code:

$dictionary["organizations"]["relationships"]['organizations_experience_1'] = array(
    'lhs_module' => 'organizations', // -> here need place Main module
    'lhs_table' => 'organizations',
    'lhs_key' => 'id',             // -> here need place 'Id'
    'rhs_module' => 'experience', // -> here need place Relate module
    'rhs_table' => 'experience',
    'rhs_key' => 'id_organization', // -> here need place your defined column, in my case it's 'id_organization'
    'relationship_type' => 'one-to-many',
);

For fixing many-to-many relationship field names

Make sure you have the same file in Vardefs on both module sides, if not that just copy

custom/Extension/modules/FirstModule/Ext/Vardefs/FirstModule_SecondModule_1.php
custom/Extension/modules/SecondModule/Ext/Vardefs/FirstModule_SecondModule_1.php

1 Like