[Vtigercrm-developers] list view send email bug

lajeesh k lajeeshk at gmail.com
Thu Oct 15 08:08:17 GMT 2015


fixed the issue
The reason is missing  "AND" operator in query

modules/CustomView/models/Record.php around line 187

        $searchParams = $this->get('search_params');
        if(empty($searchParams)) {
            $searchParams = array();
        }
//added by lajeesh to fix email issue
$glue = "";
        if(count($queryGenerator->getWhereFields()) > 0 &&
(count($searchParams[0])) > 0) {
            $glue = QueryGenerator::$AND;
        }

        $transformedSearchParams =
Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParams,
$moduleModel);
        $queryGenerator->parseAdvFilterList($transformedSearchParams,$glue);




Regards,
Lajeesh

On Wed, Oct 14, 2015 at 8:08 PM, lajeesh k <lajeeshk at gmail.com> wrote:

> issue is before calling above function
> groupInfo value is no correct
> and the groupInfo is created from addCondition function
>
>
>
>
> Regards,
> Lajeesh
>
> On Wed, Oct 14, 2015 at 7:18 PM, lajeesh k <lajeeshk at gmail.com> wrote:
>
>> this function is making this bug
>>
>> private function makeGroupSqlReplacements($fieldSqlList, $groupSql) {
>> echo "<pre>";
>> print_r($fieldSqlList);//echo $groupSql;
>> $pos = 0;
>> $nextOffset = 0;
>> foreach ($fieldSqlList as $index => $fieldSql) {
>> $pos = strpos($groupSql, $index.'', $nextOffset);
>> if($pos !== false) {
>> $beforeStr = substr($groupSql,0,$pos);echo $beforeStr."<br>";
>> $afterStr = substr($groupSql, $pos + strlen($index));
>> $nextOffset = strlen($beforeStr.$fieldSql);
>> $groupSql = $beforeStr.$fieldSql.$afterStr;
>> }
>> }echo $groupSql."<br>";
>> return $groupSql;
>> }
>>
>>
>> Regards,
>> Lajeesh
>>
>> On Wed, Oct 14, 2015 at 6:57 PM, lajeesh k <lajeeshk at gmail.com> wrote:
>>
>>> There is a bug in vtiger send email
>>> the bug is in query generated using list view query generator
>>>
>>> can reproduce this issue like this
>>>
>>> create a filter in leads with at least one condition(for ex:created time
>>> > 2014)
>>> while we are in this filter search leadstatus = cold or anything from
>>> top searchbox
>>> select all listed result (clicking select all is mandatory even if these
>>> only one result)
>>> then click send mail, then it will give you a mysql error. enable
>>> peardatabase loging
>>> to see the error
>>>
>>>
>>> query generated is
>>>
>>> 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
>>>
>>>
>>> and the error is
>>>
>>> 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
>>> ' at line 1
>>>
>>>
>>> Its4you emailmaker also has error due to this bug
>>>
>>> Regards,
>>> Lajeesh
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20151015/a7f8abfd/attachment-0001.html>


More information about the vtigercrm-developers mailing list