[Vtigercrm-developers] "is empty" criteria for related modules - not working in 7.x?

Orville Jimenez orvillej at blackdiamondlandscape.com
Mon Jun 5 23:29:56 GMT 2023


You can go to the Module settings and under Relationship tabs to add or
remove relationships, but in case you don't find the module that you are
looking for, you can also do it programmatically.

You can add related modules by running a php script. replacing the values
for 'PrimaryModule' and 'RelatedModule' on the script below. In this
example we are creating a relationship between the primary module Leads to
Documents module. Organizations I think the Accounts module and then the
Contacts will be the related module for the script below.

<php?

$PrimaryModule = 'Leads'
$RelatedModule = 'Documents'

include_once('vtlib/Vtiger/Module.php');
$moduleInstance = Vtiger_Module::getInstance($PrimaryModule);

//Module Relationship
$relatedModule = Vtiger_Module::getInstance($RelatedModule);
$relationLabel = $RelatedModule;
$moduleInstance->setRelatedList($relatedModule, $relationLabel,
Array('ADD','SELECT'));
 echo "Relationship Created\n";

?>


Best Regards,


*Orville *




On Mon, Jun 5, 2023 at 1:55 PM Steve Kenow <skenow at rdspos.com> wrote:

> Except that's not an option - at least in the base version. Can only
> select Tickets, Comments, and Documents.
>
> *Steve Kenow*
> Retail Data Systems of Minnesota
> End-User Services & Support Manager
> Direct: (952) 392-2686
> Office: (952) 934-4002
> skenow at rdspos.com
>
>
>
> Support Questions/Issues? Email rdshelp at rdspos.com (non-emergencies) or
> call (952) 934-4002 24/7
>
>
> On Mon, Jun 5, 2023 at 3:51 PM Steve Kenow <skenow at rdspos.com> wrote:
>
>> Contacts is the primary module and Organizations is set as a related
>> module. Is that how I'll need to adjust?
>>
>> *Steve Kenow*
>> Retail Data Systems of Minnesota
>> End-User Services & Support Manager
>> Direct: (952) 392-2686
>> Office: (952) 934-4002
>> skenow at rdspos.com
>>
>>
>>
>> Support Questions/Issues? Email rdshelp at rdspos.com (non-emergencies) or
>> call (952) 934-4002 24/7
>>
>>
>> On Mon, Jun 5, 2023 at 11:14 AM Alan Lord <alanslists at gmail.com> wrote:
>>
>>> On 05/06/2023 16:38, Steve Kenow wrote:
>>> > I would think it's a left join, and the 'is empty' would return
>>> > non-matching records in the related tables (equivalent to is null)
>>>
>>> Yeah, but the report engine doesn't quite work that way. Take a look at
>>> the file ReportRun.php (then run away!!!)
>>>
>>> > This gives me one of the datasets I look at (the report in VT6.5 works
>>> > as desired) -
>>> > select * from vtiger_account a
>>> > left join vtiger_servicecontracts s on a.accountid = s.sc_related_to
>>> >      join vtiger_accountscf c using (accountid)
>>> >      where c.cf_807 = 'Active'
>>> >      and s.servicecontractsid is null;
>>>
>>> If only it were that simple... It can be actually. We have an extension
>>> that lets admin users write their own SQL Report queries.
>>>
>>> https://libertus.co.uk/sql-reports/
>>>
>>> > Here's another twist - some modules work! I look for Contacts without
>>> > Organizations, the list is correct in both 6.5 and 7.5
>>>
>>> With the Organisation as the Primary module again?
>>>
>>> Al
>>>
>>> _______________________________________________
>>> http://www.vtiger.com/
>>
>> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20230605/d6a0d8ff/attachment-0001.html>


More information about the vtigercrm-developers mailing list