Example #1
0
/**
 * Function to get the Tags where condition
 * @param  string $search_val -- entered search string value
 * @param  string $current_user_id     -- current user id
 * @return string $where      -- where condition with the list of crmids, will like vtiger_crmentity.crmid in (1,3,4,etc.,)
 */
function getTagWhere($search_val, $current_user_id)
{
    require_once 'include/freetag/freetag.class.php';
    $freetag_obj = new freetag();
    $crmid_array = $freetag_obj->get_objects_with_tag_all($search_val, $current_user_id);
    $where = " vtiger_crmentity.crmid IN (";
    if (count($crmid_array) > 0) {
        foreach ($crmid_array as $index => $crmid) {
            $where .= $crmid . ',';
        }
        $where = trim($where, ',') . ')';
    } else {
        $where .= '0)';
    }
    return $where;
}
Example #2
0
/**	Function to get the Tags where condition
 *	@param  string $search_val -- entered search string value
 *	@param  string $current_user_id     -- current user id
 *	@return string $where      -- where condition with the list of crmids, will like ec_crmentity.crmid in (1,3,4,etc.,)
 */
function getTagWhere($search_val, $current_user_id, $search_module = '')
{
    require_once 'include/freetag/freetag.class.php';
    $freetag_obj = new freetag();
    $crmid_array = $freetag_obj->get_objects_with_tag_all($search_val, $current_user_id);
    $entityArr = getEntityTable($search_module);
    $ec_crmentity = $entityArr["tablename"];
    $entityidfield = $entityArr["entityidfield"];
    $crmid = $ec_crmentity . "." . $entityidfield;
    $where = '';
    if (count($crmid_array) > 0) {
        $where = $crmid . " IN (";
        foreach ($crmid_array as $index => $crmid) {
            $where .= $crmid . ',';
        }
        $where = trim($where, ',') . ')';
    }
    return $where;
}