project_org_ids=OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:project_id]}").map(&:organization_id)
ifproject_org_ids.empty?
@orgs_not_in_project=Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id,condition).page(1).per(10)
@org_count=Organization.where("is_public = 1 or creator_id =?",User.current.id).where("name like ?",condition).count
else
project_org_ids="("+project_org_ids.join(',')+")"
@orgs_not_in_project=Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?",User.current.id,condition).page(1).per(10)
@org_count=Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)",User.current.id).where("name like ?",condition).count