Flexible relationships

I’m using Supertimesheet in SuiteCRM to track work hours. See attached an excerpt of the timesheet table.

As you can see in the attached screenshot, “project_id” is listed in a dedicated column, so the link to a project is simple.
However, the relationship to a specific ProjectTask is done via two columns: “parent_type” & “parent_id”.

KReporter seems unable to to report the timesheet table by ProjectTasks. I assume this is because of this complex relationship for project tasks. Reporting by Project works fine.
KReporter doesn’t even show that complex relationship on the left where the relationships are shown (“relationship tree”?). And there is no field listed that could be used either.

What can I do to make KReporter happy? :slight_smile:

  • add a helper column with only the Projecttask_IDs in the timesheet table? (or in a new timesheet_cstm table?)
  • add custom code to Reporter somehow?

KReporter can handle relationships defined with 2 columns.
However we do not garantee that KReporter will work properly under SuiteCRM. KReporter is designed to work under SugarCRM and SpiceCRM.

I guess that Timesheet is defined as a module. If so you should be able to select timesheet as base module for your report. If the link to ProjectTasks is defined properly then ProjectTasks module should appear as related module in KReporter Module Tree. If not, then the link definition should be checked. But as I wrote, we do not support SuiteCRM.

That’s a shame. Unfortunately ProjectTasks does not appear as related module in the Module tree. Would you give me any idea what you mean with “the link definition should be checked”?

Check in Timesheet vardefs if you see any link deifnition to ProjectTasks. Insert it if missing
’projecttask’ => array(
‘name’ => ‘projecttask’,
‘type’ => ‘link’,
‘relationship’ => ‘nameOfRelationshipForTimesheetProjectTasks’, //probably defined in timesheet module vardefs. Look for the right name
’module’ => ‘ProjectTask’,
‘bean_name’ => ‘ProjectTask’,
‘source’ => ‘non-db’,
‘vname’ => ‘LBL_PROJECTASK’,
),

There is indeed no such block in the timesheet vardefs.php file.
There is also no corresponding relationship name to be found in the timesheet vardefs file.

The only relevant relationship definition I could find so far is in the DB in the table “relationships”:
name = projecttask_timesheet
relationship_type = one-to-many
relationship_role_column = parent_type
relationship_role_column_value = ProjectTask

I checked again whether the timesheet table shows up in KReporter’s module tree if I start with module ProjectTask. But that is not the case.

Add
’projecttask’ => array(
‘name’ => ‘projecttask’,
‘type’ => ‘link’,
‘relationship’ => ‘projecttask_timesheet’,
‘module’ => ‘ProjectTask’,
‘bean_name’ => ‘ProjectTask’,
‘source’ => ‘non-db’,
‘vname’ => ‘LBL_PROJECTASK’,
),

in the timesheet module vardefs.php (=> in the “fields” list), do a repair/rebuild and check if projecttask module appears in Kreports tree having timesheet module selected as main module.

thanks maretval

I tried exactly that (in a copy of vardefs.php in /custom/modules/Timesheet/) but unfortunately no effect. This code doesn’t even show up in /cache/modules/Timesheet/Timesheetvardefs.php

I don’t know about custom rules in SuiteCRM but in SugarCRM you would add it to custom/Extension/modules/Timesheet/Ext/Vardefs/Timesheetvardefs.php
I can’t help further unless we agree on a development fee.

Yeah, sorry. My mistake. Added it to /custom/Extension/modules/Timesheet/Ext/Vardefs/customname.php.

Now shows up on KReporter! I did some tests, working fine.

Thanks so much!