Index: openacs-4/packages/contacts/lib/contacts.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.tcl,v
diff -u -r1.35 -r1.36
--- openacs-4/packages/contacts/lib/contacts.tcl 17 Nov 2005 18:22:02 -0000 1.35
+++ openacs-4/packages/contacts/lib/contacts.tcl 23 Nov 2005 17:28:44 -0000 1.36
@@ -33,7 +33,7 @@
}
# This is for showing the employee_id and employeer relationship
-set type_list [db_list get_object_type { }]
+set type_list [db_list get_condition_type { }]
if { ![string equal [lsearch -exact $type_list "employees"] "-1"] } {
set page_query_name "employees_pagination"
Index: openacs-4/packages/contacts/lib/contacts.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contacts.xql,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/contacts/lib/contacts.xql 15 Nov 2005 15:56:46 -0000 1.16
+++ openacs-4/packages/contacts/lib/contacts.xql 23 Nov 2005 17:28:44 -0000 1.17
@@ -51,9 +51,37 @@
-
+
+ select distinct
+ $extend_query
+ rel.object_id_one as party_id,
+ rel.object_id_two as employee_id
+ from
+ acs_rels rel,
+ parties p
+ where
+ rel.rel_type = 'contact_rels_employment'
+ and rel.object_id_one = p.party_id
+ [template::list::page_where_clause -and -name "contacts" -key "party_id"]
+
+
+
+
+
select
+ rel.object_id_one as party_id,
+ rel.object_id_two as employee_id
+ from
+ acs_rels rel
+ where
+ rel.rel_type = 'contact_rels_employment'
+
+
+
+
+
+ select
object_type
from
contact_searches
@@ -62,4 +90,26 @@
+
+
+ select
+ object_type
+ from
+ contact_searches
+ where
+ search_id = :search_id
+
+
+
+
+
+ select
+ type
+ from
+ contact_search_conditions
+ where
+ search_id = :search_id
+
+
+
Index: openacs-4/packages/contacts/www/search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/search.tcl,v
diff -u -r1.22 -r1.23
--- openacs-4/packages/contacts/www/search.tcl 18 Nov 2005 17:48:27 -0000 1.22
+++ openacs-4/packages/contacts/www/search.tcl 23 Nov 2005 17:29:47 -0000 1.23
@@ -78,7 +78,7 @@
# set query_pretty [list]
if { [exists_and_not_null search_id] } {
if { [contact::search::exists_p -search_id $search_id] } {
- db_1row get_em { select title, owner_id, all_or_any, object_type from contact_searches where search_id = :search_id }
+ db_1row get_em { }
set search_exists_p 1
}
}
@@ -274,15 +274,14 @@
}
-
if { $search_exists_p } {
set conditions [list]
db_foreach selectqueries {
select condition_id, type as query_type, var_list as query_var_list from contact_search_conditions where search_id = :search_id
} {
set condition_name [contacts::search::condition_type -type $query_type -request pretty -var_list $query_var_list]
if { [empty_string_p $condition_name] } {
- set condition_name "[_ contacts.Employee]"
+ set condition_name "[_ contacts.Employees]"
}
lappend conditions "$condition_name "
}
@@ -295,31 +294,43 @@
lappend form_elements [list query_pretty:text(inform),optional [list label {}] [list value $query_pretty]]
}
-
+# The employee search only works without other attribute so
+# we are going to remove the option "Employee" where is already
+# a condition_name and we are going to remove the attributes
+# where the condition_name equals employee
+set employee_p 0
if { [exists_and_not_null object_type] } {
-
# QUERY TYPE
set type_options [contacts::search::condition_types]
# We are going to add one extra element to show all employees
# and its organization
- if {[string equal $object_type "party"] } {
+ if { [string equal $object_type "party"] && ![exists_and_not_null condition_name] } {
lappend type_options [list "[_ contacts.Employees]" employees]
}
- append form_elements {
- {type:text(select),optional {label {}} {options $type_options} {html {onChange "javascript:acs_FormRefresh('advanced_search')"}}}
+ if { [exists_and_not_null condition_name] && [string equal $condition_name [_ contacts.Employees]] } {
+ set employee_p 1
}
+ if { !$employee_p } {
+ # Show the attribute options of the search
+ append form_elements {
+ {type:text(select),optional {label {}} {options $type_options} {html {onChange "javascript:acs_FormRefresh('advanced_search')"}}}
+ }
+ }
}
-# get condition types widgets
+#get condition types widgets
set form_elements [concat \
- $form_elements \
- [contacts::search::condition_type -type $type -request ad_form_widgets -form_name advanced_search -object_type $object_type] \
- ]
+ $form_elements \
+ [contacts::search::condition_type -type $type -request ad_form_widgets -form_name advanced_search -object_type $object_type] \
+ ]
+if { !$employee_p } {
+ # Show the Ok button
+ lappend form_elements [list next:text(submit) [list label [_ acs-kernel.common_OK]] [list value "ok"]]
+}
-lappend form_elements [list next:text(submit) [list label [_ acs-kernel.common_OK]] [list value "ok"]]
if { $search_exists_p } {
Index: openacs-4/packages/contacts/www/search.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/search.xql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/contacts/www/search.xql 18 Nov 2005 17:48:27 -0000 1.4
+++ openacs-4/packages/contacts/www/search.xql 23 Nov 2005 17:29:47 -0000 1.5
@@ -147,4 +147,19 @@
+
+
+ select
+ title,
+ owner_id,
+ all_or_any,
+ object_type
+ from
+ contact_searches
+ where
+ search_id = :search_id
+
+
+
+