Index: openacs-4/contrib/packages/photobook/www/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/photobook/www/search.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/contrib/packages/photobook/www/search.tcl 3 Nov 2003 20:10:56 -0000 1.1 +++ openacs-4/contrib/packages/photobook/www/search.tcl 18 Mar 2004 22:45:43 -0000 1.2 @@ -299,7 +299,7 @@ append sql "and p.priv = 0\n" } - if { ![string is space $q_institute_id]} { + if { $admin_p && ![string is space $q_institute_id]} { if {!$suppress} { append sql "and p.institute_id like '[__like $q_institute_id]'\n" } @@ -337,23 +337,23 @@ } } - if { ![string is space $q_gender] } { + if { $admin_p &&![string is space $q_gender] } { if {!$suppress} { append sql "and p.gender = :q_gender\n" } else { append sql "and p.gender = :q_gender and priv_gender = 0\n" } } - if { ![string is space $q_birthdate] } { + if { $admin_p && ![string is space $q_birthdate] } { if {!$suppress} { append sql "and p.birthdate = to_date(:q_birthdate, 'YYYY MM DD HH24 MI SS')\n" } else { append sql "and p.birthdate = to_date(:q_birthdate, 'YYYY MM DD HH24 MI SS') and priv_birthdate = 0\n" } } - if { ![string is space $q_ethnicity] } { + if { $admin_p && ![string is space $q_ethnicity] } { if {!$suppress} { append sql "and p.ethnicity = :q_ethnicity\n" } else { @@ -369,7 +369,7 @@ append sql "and p.priv_partner = 0 and lower(p.partner_firstname || ' ' || partner_lastname) like :q_partner_like\n" } } - if { ![string is space $q_child] } { + if { $admin_p && ![string is space $q_child] } { set q_child_like [__like $q_child] append sql "and ( lower(p.child_1) like :q_child_like @@ -382,7 +382,7 @@ } } - if { ![string is space $q_child_born] } { + if { $admin_p && ![string is space $q_child_born] } { append sql "and ( p.child_born_1 = :q_child_born or p.child_born_2 = :q_child_born @@ -435,22 +435,32 @@ set q_employment_like [__like $q_employment] if {!$suppress} { append sql "and ( - lower(p.past_employers) like :q_employment_like + lower(p.past_employer_company_1) like :q_employment_like + or lower(p.past_employer_citystate_1) like :q_employment_like + or lower(p.past_employer_company_2) like :q_employment_like + or lower(p.past_employer_citystate_2) like :q_employment_like or lower(p.urop_1) like :q_employment_like + or lower(p.urop_professor_1) like :q_employment_like or lower(p.urop_2) like :q_employment_like + or lower(p.urop_professor_2) like :q_employment_like or exists ( select 1 from phb_span emp, cr_items empi, cr_child_rels empr where empr.relation_tag IN ('job_current','job_past','internship') and empr.parent_id = p.item_id and empr.child_id = empi.item_id and empi.live_revision = emp.span_id - and lower (emp.institution || ' ' || emp.department || ' ' || emp.location) like :q_employment_like ) )\n" + and lower (emp.institution_position || ' ' || emp.institution_company || ' ' || emp.institution_city || ' ' || emp.institution_state || ' ' || emp.department || ' ' || emp.location) like :q_employment_like ) )\n" } else { append sql "and ( - (case when p.priv_past_employers = 0 then lower(p.past_employers) else '' end) like :q_employment_like + (case when p.priv_past_employers = 0 then lower(p.past_employer_company_1) else '' end) like :q_employment_like + (case when p.priv_past_employers = 0 then lower(p.past_employer_citystate_1) else '' end) like :q_employment_like + (case when p.priv_past_employers = 0 then lower(p.past_employer_company_2) else '' end) like :q_employment_like + (case when p.priv_past_employers = 0 then lower(p.past_employer_citystate_2) else '' end) like :q_employment_like or (case when p.priv_urop = 0 then lower(p.urop_1) else '' end) like :q_employment_like + or (case when p.priv_urop = 0 then lower(p.urop_professor_1) else '' end) like :q_employment_like or (case when p.priv_urop = 0 then lower(p.urop_2) else '' end) like :q_employment_like + or (case when p.priv_urop = 0 then lower(p.urop_professor_2) else '' end) like :q_employment_like or exists ( select 1 from phb_span emp, cr_items empi, cr_child_rels empr @@ -459,7 +469,7 @@ and empr.parent_id = p.item_id and empr.child_id = empi.item_id and empi.live_revision = emp.span_id - and lower (emp.institution || ' ' || emp.department || ' ' || emp.location) like :q_employment_like ) ) + and lower (emp.institution_position || ' ' || emp.institution_company || ' ' || emp.institution_city || ' ' || emp.institution_state || ' ' || emp.department || ' ' || emp.location) like :q_employment_like ) ) and priv_employment = 0\n" } } @@ -477,11 +487,11 @@ } } - if { ![string is space $q_grad_range_exp]} { + if { $admin_p && ![string is space $q_grad_range_exp]} { append sql "and p.expected_graduation = :q_grad_range_exp\n" } - if { ![string is space $q_grad_range_pref]} { + if { $admin_p && ![string is space $q_grad_range_pref]} { append sql "and p.preferred_graduation = :q_grad_range_pref\n" } @@ -506,7 +516,7 @@ if { ! [string is space $q_university] || ! [string is space $q_degree] || ! [string is space $q_major] - || ! [string is space $q_granted]} { + || ($admin_p && ! [string is space $q_granted])} { if {!$suppress} { append sql "and exists ( select 1 @@ -525,7 +535,7 @@ if { ! [string is space $q_major] } { append sql "and ed.department = :q_major\n" } - if { ! [string is space $q_granted] } { + if { $admin_p && ! [string is space $q_granted] } { append sql "and to_char(ed.ended,'YYYY') = :q_granted\n" } append sql ")\n" @@ -548,7 +558,7 @@ if { ! [string is space $q_major] } { append sql "and ed.department = :q_major\n" } - if { ! [string is space $q_granted] } { + if { $admin_p && ! [string is space $q_granted] } { append sql "and to_char(ed.ended,'YYYY') = :q_granted\n" } append sql ")\n"