function getRefusalsByUrid($urid) { global $db; if (isset($this->refusalsByUridArray[$urid])) { $contacts = $this->refusalsByUridArray[$urid]; } else { $contacts = array(); //$csidQuery = ' AND code = 103 '; // $result = $db->selectQuery('select *, aes_decrypt(remark, "' . Config::smsContactRemarkKey() . '") as remark_dec, aes_decrypt(proxyname, "' . Config::smsContactNameKey() . '") as proxyname_dec from ' . Config::dbSurvey() . '_contacts as t1 left join ' . Config::dbSurvey() . '_users as t2 on t1.urid = t2.urid where t1.urid = ' . prepareDatabaseString($urid) . $csidQuery . ' order by t1.contactts desc'); //echo '<br/><br/><br/>'. 'select *, aes_decrypt(remark, "' . Config::smsContactRemarkKey() . '") as remark_dec, aes_decrypt(proxyname, "' . Config::smsContactNameKey() . '") as proxyname_dec from ' . Config::dbSurvey() . '_contacts as t1 left join ' . Config::dbSurvey() . '_users as t2 on t1.urid = t2.urid where t1.urid = ' . prepareDatabaseString($urid) . ' order by t1.contactts desc'; $query = 'select *, aes_decrypt(remark, "' . Config::smsContactRemarkKey() . '") as remark_dec, aes_decrypt(proxyname, "' . Config::smsContactNameKey() . '") as proxyname_dec from ' . Config::dbSurvey() . '_contacts as t1 '; $query .= 'left join ' . Config::dbSurvey() . '_users as t2 on t1.urid = t2.urid '; $query .= 'left join ' . Config::dbSurvey() . '_respondents as t3 on t1.primkey = t3.primkey '; $query .= 'where t3.primkey is not null AND ' . getTextmodeStr() . ' t1.urid = ' . prepareDatabaseString($urid) . ' order by t1.contactts desc'; $result = $db->selectQuery($query); while ($row = $db->getRow($result)) { $contact = new Contact($row); if ($contact->isRefusal()) { $contacts[] = $contact; } } $this->refusalsByUridArray[$urid] = $contacts; } return $contacts; }