<div dir="ltr">Wow, 1 year later I find the same problem again.... but in vt6.</div><div class="gmail_extra"><br><div class="gmail_quote">2013-02-18 12:43 GMT+01:00 Adrián Granado - Refineria Web <span dir="ltr"><<a href="mailto:adrian@refineriaweb.com" target="_blank">adrian@refineriaweb.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">








<div lang="ES" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">In addition my
get_dependents_lists is failing.<br>
<br>
In data\CRMEntity.php – line 1763 , I cant understand next algorithm:<br>
<br>
</span><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">if
(!empty($other->related_tables)) {<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                     foreach ($other->related_tables as
$tname => $relmap) {<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                          $query .= ", $tname.*";<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                          // Setup the default JOIN conditions
if not specified<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                          if (empty($relmap[1]))<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                               $relmap[1] =
$other->table_name;<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                          if (empty($relmap[2]))<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                               $relmap[2] = $relmap[0];<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                          $more_relation .= " LEFT JOIN
$tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]";<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                     }<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d">                }<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New";color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="color:#1f497d">Because NO ONE of the
modules have variable $related_tables. Can anyone give me some light?<br>
<br>
Thank you community.<u></u><u></u></span></p>

<div>

<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>

</div>

<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>

<div>

<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">

<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">De:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a>
[mailto:<a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a>] <b>En nombre de </b>Adrián
Granado - Refineria Web<br>
<b>Enviado el:</b> lunes, 18 de febrero de 2013 12:17<br>
<b>Para:</b> <a href="mailto:vtigercrm-developers@lists.vtigercrm.com" target="_blank">vtigercrm-developers@lists.vtigercrm.com</a><br>
<b>Asunto:</b> [Vtigercrm-developers] Issue while generating Report<u></u><u></u></span></p>

</div>

</div><div><div class="h5">

<p class="MsoNormal"><u></u> <u></u></p>

<p class="MsoNormal"><span lang="EN-US">Hi all,<br>
<br>
I installed a fresh vTiger  just for doing some tests and I noticed that
Reports are failing:<br>
<br>
I related Projects with Invoices. I did a field uitype = 10 in Invoice Module
and get_dependents_lists in Projects (from Invoices). So 1 Project has many
Invoices. And 1 Invoice has 1 Project.<br>
<br>
I tried to generate a Report listing all my invoices (which one field is
“Project Name”) and here is the result: “</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">Report generation failed!</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f"><br>
</span><span style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">Unknown column 'vtiger_invoicecf.cf_640' in
'on clause'</span><span lang="EN-US" style="font-size:10.0pt;color:#323d4f;background:#ececec">”</span><span style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">This is the SQL Query:<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">select DISTINCT<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> vtiger_invoice.invoicedate AS
'Invoice_Invoice_Date', <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">vtiger_invoice.duedate AS 'Invoice_Due_Date',
<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">concat(vtiger_invoice.currency_id,'::',vtiger_invoice.total)
as 'Invoice_Total',<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> (CASE WHEN vtiger_invoicecf.cf_640 NOT
LIKE '' THEN (CASE WHEN vtiger_project.projectname NOT LIKE '' THEN
vtiger_project.projectname ELSE '' END) ELSE '' END) AS Invoice_Proyecto, <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">vtiger_crmentity.crmid AS
"LBL_ACTION" <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">from vtiger_project <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">inner join vtiger_projectcf as vtiger_projectcf on
vtiger_projectcf.projectid=vtiger_project.projectid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_project.projectid
<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_groups as vtiger_groupsProject on
vtiger_groupsProject.groupid = vtiger_crmentity.smownerid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_users as vtiger_usersProject on
vtiger_usersProject.id = vtiger_crmentity.smownerid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_users as vtiger_lastModifiedByProject on
vtiger_lastModifiedByProject.id = vtiger_crmentity.modifiedby <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_groups on vtiger_groups.groupid =
vtiger_crmentity.smownerid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_users on <a href="http://vtiger_users.id" target="_blank">vtiger_users.id</a> = vtiger_crmentity.smownerid
<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_crmentity as vtiger_crmentityRelProject624
on vtiger_crmentityRelProject624.crmid = vtiger_project.linktoaccountscontacts
and vtiger_crmentityRelProject624.deleted=0<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_account as
vtiger_accountRelProject624 on vtiger_accountRelProject624.accountid =
vtiger_crmentityRelProject624.crmid<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_contactdetails as
vtiger_contactdetailsRelProject624 on
vtiger_contactdetailsRelProject624.contactid =
vtiger_crmentityRelProject624.crmid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join (select vtiger_invoice.* from vtiger_invoice
inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid
and vtiger_crmentity.deleted=0) as vtiger_invoice on
vtiger_invoicecf.cf_640=vtiger_project.projectid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_crmentity as vtiger_crmentityInvoice on
vtiger_crmentityInvoice.crmid=vtiger_invoice.invoiceid and
vtiger_crmentityInvoice.deleted=0 <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_invoicecf on vtiger_invoice.invoiceid =
vtiger_invoicecf.invoiceid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_currency_info as vtiger_currency_infoInvoice
on vtiger_currency_infoInvoice.id = vtiger_invoice.currency_id <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_salesorder as vtiger_salesorderInvoice on
vtiger_salesorderInvoice.salesorderid=vtiger_invoice.salesorderid<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_invoicebillads on
vtiger_invoice.invoiceid=vtiger_invoicebillads.invoicebilladdressid<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_invoiceshipads on
vtiger_invoice.invoiceid=vtiger_invoiceshipads.invoiceshipaddressid<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_inventoryproductrel as
vtiger_inventoryproductrelInvoice on vtiger_invoice.invoiceid = vtiger_inventoryproductrelInvoice.id
<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_products as vtiger_productsInvoice on
vtiger_productsInvoice.productid = vtiger_inventoryproductrelInvoice.productid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_service as vtiger_serviceInvoice on
vtiger_serviceInvoice.serviceid = vtiger_inventoryproductrelInvoice.productid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_groups as vtiger_groupsInvoice on
vtiger_groupsInvoice.groupid = vtiger_crmentityInvoice.smownerid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_users as vtiger_usersInvoice on
vtiger_usersInvoice.id = vtiger_crmentityInvoice.smownerid <u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_contactdetails as
vtiger_contactdetailsInvoice on vtiger_invoice.contactid =
vtiger_contactdetailsInvoice.contactid<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_account as vtiger_accountInvoice on
vtiger_accountInvoice.accountid = vtiger_invoice.accountid<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:70.8pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"> left join vtiger_users as
vtiger_lastModifiedByInvoice on vtiger_lastModifiedByInvoice.id =
vtiger_crmentityInvoice.modifiedby <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">WHERE vtiger_project.projectid > 0 AND
vtiger_crmentity.deleted=0<span> </span></span><span><u></u><u></u></span></p>

<p class="MsoNormal"><span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u> <u></u></span></span></p>

<p class="MsoNormal"><span lang="EN-US">As you can see in the Query, it does:</span><u></u><u></u></p>

<p class="MsoNormal"><span lang="EN-US"> </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join (select vtiger_invoice.* from vtiger_invoice
inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid
and vtiger_crmentity.deleted=0) as vtiger_invoice on
vtiger_invoicecf.cf_640=vtiger_project.projectid <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">before:<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec">left join vtiger_invoicecf on
vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">So, I think here is the problem.<br>
<br>
Did anyone experimented some of this? Can anyone bring me some light around
this?<br>
<br>
Thank you community.</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Grande","serif";color:#323d4f;background:#ececec"><u></u><u></u></span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US"><u></u> <u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>

</div></div></div>

</div>


<br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>