+ if (!$countingterms) {
+ $countingterms = 'rtf.jtid_2';
+ }
+ }
+ if (!$countingterms) {
+ $select_leaf = 'IF(r_subbranch.jtid_1 IS NULL,1,0)';
+ $join .= ' LEFT JOIN profile_job_term_relation AS r_subbranch ON (r_subbranch.jtid_1 = e.jtid AND r_subbranch.computed = "original") ';
+ } else {
+ // branches that have counting terms different that
+ // main branch will have subbranches
+ $select_leaf = 'MIN('.$countingterms.' = e.jtid)';