<div dir="ltr">created ticket for this issue with bug fix<div><br></div><div><a href="http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8642">http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8642</a><br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><br>Regards,<br>Lajeesh<br></div></div>
<br><div class="gmail_quote">On Thu, Oct 15, 2015 at 1:38 PM, lajeesh k <span dir="ltr"><<a href="mailto:lajeeshk@gmail.com" target="_blank">lajeeshk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">fixed the issue<div>The reason is missing  "AND" operator in query</div><div><br></div><div>modules/CustomView/models/Record.php around line 187  <br></div><div><br></div><div><div>        $searchParams = $this->get('search_params');</div><div>        if(empty($searchParams)) {</div><div>            $searchParams = array();</div><div>        }</div><div><span style="white-space:pre-wrap">             </span>//added by lajeesh to fix email issue</div><div><span style="white-space:pre-wrap">            </span>$glue = "";</div><div>        if(count($queryGenerator->getWhereFields()) > 0 && (count($searchParams[0])) > 0) {</div><div>            $glue = QueryGenerator::$AND;</div><div>        }</div><div><br></div><div>        $transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParams, $moduleModel);</div><div>        $queryGenerator->parseAdvFilterList($transformedSearchParams,$glue);</div></div><div><br></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div><br>Regards,<br>Lajeesh<br></div></div><div><div class="h5">
<br><div class="gmail_quote">On Wed, Oct 14, 2015 at 8:08 PM, lajeesh k <span dir="ltr"><<a href="mailto:lajeeshk@gmail.com" target="_blank">lajeeshk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">issue is before calling above function<div>groupInfo value is no correct <br></div><div>and the groupInfo is created from addCondition function</div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div><br>Regards,<br>Lajeesh<br></div></div><div><div>
<br><div class="gmail_quote">On Wed, Oct 14, 2015 at 7:18 PM, lajeesh k <span dir="ltr"><<a href="mailto:lajeeshk@gmail.com" target="_blank">lajeeshk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="white-space:pre-wrap">this function is making this bug</span></div><div><br></div><div>private function makeGroupSqlReplacements($fieldSqlList, $groupSql) {</div><div><span style="white-space:pre-wrap">            </span>echo "<pre>";</div><div><span style="white-space:pre-wrap">            </span>print_r($fieldSqlList);//echo $groupSql;</div><div><span style="white-space:pre-wrap">         </span>$pos = 0;</div><div><span style="white-space:pre-wrap">                </span>$nextOffset = 0;</div><div><span style="white-space:pre-wrap">         </span>foreach ($fieldSqlList as $index => $fieldSql) {</div><div><span style="white-space:pre-wrap">                      </span>$pos = strpos($groupSql, $index.'', $nextOffset);</div><div><span style="white-space:pre-wrap">                        </span>if($pos !== false) {</div><div><span style="white-space:pre-wrap">                             </span>$beforeStr = substr($groupSql,0,$pos);echo $beforeStr."<br>";</div><div><span style="white-space:pre-wrap">                            </span>$afterStr = substr($groupSql, $pos + strlen($index));</div><div><span style="white-space:pre-wrap">                            </span>$nextOffset = strlen($beforeStr.$fieldSql);</div><div><span style="white-space:pre-wrap">                              </span>$groupSql = $beforeStr.$fieldSql.$afterStr;</div><div><span style="white-space:pre-wrap">                      </span>}</div><div><span style="white-space:pre-wrap">                </span>}echo $groupSql."<br>";</div><div><span style="white-space:pre-wrap">          </span>return $groupSql;</div><div><span style="white-space:pre-wrap">        </span>}</div></div><div class="gmail_extra"><br clear="all"><div><div><br>Regards,<br>Lajeesh<br></div></div><div><div>
<br><div class="gmail_quote">On Wed, Oct 14, 2015 at 6:57 PM, lajeesh k <span dir="ltr"><<a href="mailto:lajeeshk@gmail.com" target="_blank">lajeeshk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>There is a bug in vtiger send email</div><div>the bug is in query generated using list view query generator</div><div><br></div><div>can reproduce this issue like this</div><div><br></div><div>create a filter in leads with at least one condition(for ex:created time > 2014)</div><div>while we are in this filter search leadstatus = cold or anything from top searchbox</div><div>select all listed result (clicking select all is mandatory even if these only one result)</div><div>then click send mail, then it will give you a mysql error. enable peardatabase loging</div><div>to see the error</div><div><br></div><div><br></div><div>query generated is </div><div><span style="background-color:rgb(234,153,153)"><br></span></div><div><span style="background-color:rgb(234,153,153)">SELECT vtiger_leaddetails.company, vtiger_leaddetails.leadstatus, vtiger_leadaddress.city, vtiger_leadaddress.state, vtiger_leaddetails.lastname, vtiger_leadaddress.phone, vtiger_leaddetails.email, vtiger_leadaddress.mobile, vtiger_leadscf.cf_861, vtiger_leadscf.cf_910, vtiger_leaddetails.leadid FROM vtiger_leaddetails INNER JOIN vtiger_crmentity ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid INNER JOIN vtiger_leadaddress ON vtiger_leaddetails.leadid = vtiger_leadaddress.leadaddressid INNER JOIN vtiger_leadscf ON vtiger_leaddetails.leadid = vtiger_leadscf.leadid WHERE vtiger_crmentity.deleted=0 and vtiger_leaddetails.converted=0 AND ( (( vtiger_leaddetails.leadsource = 'Band List 2015') and ( vtiger_crmentity.createdtime > '2014-12-15 18:29:58') )) (( vtiger_leaddetails.leadstatus = 'Cold') ) AND vtiger_leaddetails.leadid > 0</span><br></div><div><br></div><div><br></div><div>and the error is </div><div><br></div><div><span style="color:rgb(0,0,0);font-family:monospace;background-color:rgb(255,192,203)">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 '(( vtiger_leaddetails.leadstatus = 'Cold') ) AND vtiger_leaddetails.leadid > 0</span><br style="color:rgb(0,0,0);font-family:monospace;background-color:rgb(255,192,203)"><span style="color:rgb(0,0,0);font-family:monospace;background-color:rgb(255,192,203)">' at line 1 </span><br></div><br clear="all"><div><div><br></div><div>Its4you emailmaker also has error due to this bug</div><div><br>Regards,<br>Lajeesh<br></div></div>
</div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>