Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/contacts/tcl/address-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/contacts/tcl/address-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/Attic/address-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/contacts/tcl/address-procs.tcl 19 Aug 2004 01:21:40 -0000 1.1.2.2 +++ openacs-4/packages/contacts/tcl/address-procs.tcl 22 Aug 2004 22:43:44 -0000 1.1.2.3 @@ -39,26 +39,22 @@ ad_proc -public template::util::address::formats {} { Returns a list of valid address formats } { +# MGEDDERT NOTE: there needs to be a way to implement a way to portray addresses differently by country return { US CA DE } } ad_proc -public template::util::address::country_options {} { Returns the country list - MGEDDERT NOTE: This should be pulled from the db and cached on restart } { - set countries_list [db_list_of_lists get_countries { select default_name, iso from countries order by default_name }] +# MGEDDERT NOTE: This should be pulled from the db and cached on restart + set countries_list [db_list_of_lists get_countries {}] return $countries_list -# return { -# {"United States" US} -# {"Canada" CA} -# {"Germany" DE} -# } } ad_proc -public template::data::validate::address { value_ref message_ref } { @@ -72,7 +68,7 @@ set country_code [lindex $address_list 4] if { $country_code == "US" } { - if { ![db_0or1row validate_state { select 1 from us_states where abbrev = upper(:region) or state_name = upper(:region) } ] } { + if { ![db_0or1row validate_state {} ] } { set message "\"$region\" is not a valid US State." return 0 } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/contacts/tcl/attribute-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/contacts/tcl/attribute-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/attribute-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/contacts/tcl/attribute-procs.tcl 19 Aug 2004 01:21:40 -0000 1.1.2.2 +++ openacs-4/packages/contacts/tcl/attribute-procs.tcl 22 Aug 2004 22:43:44 -0000 1.1.2.3 @@ -22,18 +22,7 @@ } { set creation_user [ad_conn user_id] set creation_ip [ad_conn peeraddr] - return [db_exec_plsql create_attributes { select contact__attribute_create ( - null, - :widget_id, - :label, - :help_text, - :help_p, - :html, - :format, - now(), - :creation_user, - :creation_ip - ) }] + return [db_exec_plsql create_attribute {}] } @@ -42,9 +31,7 @@ } { this code deletes an attribute } { - return [db_exec_plsql delete_attribute { select contact__attribute_delete ( - :attribute_id - ) } ] + return [db_exec_plsql delete_attribute {} ] } @@ -59,15 +46,11 @@ set locale [lang::conn::locale -site_wide] } - db_0or1row get_view_name { - select name from contact_attribute_names where attribute_id = :attribute_id and locale = :locale - } + db_0or1row get_attribute_name {} if { ![exists_and_not_null name] } { set locale "en_US" - db_0or1row get_view_name { - select name from contact_view_names where attribute_id = :attribute_id and locale = :locale - } + db_0or1row get_view_name {} } return $name @@ -96,19 +79,7 @@ } { set creation_user [ad_conn user_id] set creation_ip [ad_conn peeraddr] - return [db_exec_plsql create_attributes { select contact__attribute_value_save ( - :party_id, - :attribute_id, - :option_map_id, - :address_id, - :number_id, - :time, - :value, - :deleted_p, - now(), - :creation_user, - :creation_ip - ) }] + return [db_exec_plsql attribute_value_save {}] } @@ -131,20 +102,7 @@ set creation_user [ad_conn user_id] set creation_ip [ad_conn peeraddr] - return [db_exec_plsql save_address { select postal_address__new ( - :additional_text, - null, - :country_code, - :delivery_address, - :municipality, - null, - :postal_code, - :postal_type, - :region, - :creation_user, - :creation_ip, - null - ) }] + return [db_exec_plsql postal_address_new {}] } ad_proc -public get { @@ -155,7 +113,7 @@ } { upvar $array row - db_1row select_address_info { select * from postal_addresses where address_id = :address_id } -column_array row + db_1row select_address_info {} -column_array row } } @@ -180,22 +138,7 @@ set creation_user [ad_conn user_id] set creation_ip [ad_conn peeraddr] - return [db_exec_plsql save_telecom_number { select telecom_number__new ( - :area_city_code, - :best_contact_time, - :extension, - :itu_id, - :location, - :national_number, - null, - null, - null, - :sms_enabled_p, - :subscriber_number, - :creation_user, - :creation_ip, - null - ) }] + return [db_exec_plsql telecom_number_new {}] } @@ -207,7 +150,7 @@ get the variables from phone_numbers } { upvar $array row - db_0or1row select_phone_info { select * from telecom_numbers where number_id = :number_id } -column_array row + db_0or1row select_telecom_number_info {} -column_array row } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/contacts/tcl/category-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/contacts/tcl/category-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/category-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/contacts/tcl/category-procs.tcl 19 Aug 2004 01:21:40 -0000 1.1.2.2 +++ openacs-4/packages/contacts/tcl/category-procs.tcl 22 Aug 2004 22:43:44 -0000 1.1.2.3 @@ -41,27 +41,7 @@ set last_tree "" set category_select "" - db_foreach get_categories { - SELECT - t.name as cat_name, - t.category_id as cat_id, - tm.tree_id, - tt.name as tree_name - FROM - category_tree_map tm, - categories c, - category_translations t, - category_tree_translations tt - WHERE - c.tree_id = tm.tree_id and - c.category_id = t.category_id and - tm.object_id = :package_id and - tm.tree_id = tt.tree_id and - c.deprecated_p = 'f' - ORDER BY - tt.name, - t.name - } { + db_foreach get_categories {} { if {![string equal $tree_name $last_tree] } { append category_select "" Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/contacts/tcl/contacts-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/contacts/tcl/contacts-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-procs.tcl,v diff -u -r1.1.2.5 -r1.1.2.6 --- openacs-4/packages/contacts/tcl/contacts-procs.tcl 19 Aug 2004 01:21:40 -0000 1.1.2.5 +++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 22 Aug 2004 22:43:44 -0000 1.1.2.6 @@ -18,70 +18,12 @@ return [contact::get::name $party_id] } - ad_proc -public create { - {-party_id ""} - {-email ""} - {-url ""} - {-deleted_p "f"} - {-deleted_user ""} - {-deleted_time ""} - {-deleted_reason ""} - } { - this code creates a new contact and returns the newly created party_id - } { - - v_organization_id := organization__new ( - p_legal_name, - p_name, -- UNIQUE - p_notes, - p_organization_id, - p_organization_type_id, - p_reg_number, - p_email, - p_url, - p_creation_user, - p_creation_ip, - p_context_id, - ); - - v_person_id := person__new ( - p_party_id, - p_object_type, -- default person (could be user or contact) - p_creation_date, - p_creation_user, - p_creation_ip, - p_email, - p_url, - p_first_names, - p_last_name, - p_context_id - ); - - - set creation_user [ad_conn user_id] - set creation_ip [ad_conn peeraddr] - set context_id [ad_conn package_id] - return [db_exec_plsql get_party_id { select contact__create (:party_id, - :email, - :url, - :deleted_p, - :deleted_user, - :deleted_time, - :deleted_reason, - now(), - :creation_user, - :creation_ip, - :context_id - )}] - } - - ad_proc -public exists_p { party_id } { this code returns 1 if the party_id exists } { - return [db_0or1row exists_p_select { select 1 from contacts where party_id = :party_id }] + return [db_0or1row exists_p {}] } ad_proc -public get { @@ -90,7 +32,7 @@ get the info on the contact } { - db_0or1row get_contact_info { select * from contacts where party_id = :party_id } + db_0or1row get_contact_info {} set contact_info [ns_set create] ns_set put $contact_info party_id $party_id @@ -125,7 +67,7 @@ get the info from addresses } { upvar $array row - db_0or1row select_address_info { select * from contacts where party_id = :party_id } -column_array row + db_0or1row select_address_info {} -column_array row } @@ -178,15 +120,15 @@ } { returns 1 if the party is a user and 0 if not } { - return [db_0or1row get_party_is_user_p { select '1' from users where user_id = :party_id } ] + return [db_0or1row get_party_is_user_p {} ] } ad_proc -public next_object_id { } { returns the next available object_id } { - db_1row get_next_object_id { select nextval from acs_object_id_seq } + db_1row get_next_object_id {} return $nextval } @@ -195,18 +137,17 @@ } { returns the object_id of the organization contact_object_type } { - db_1row get_object_id { select object_id from contact_object_types where object_type = 'organization' } + db_1row get_organization_object_id {} return $object_id } ad_proc -public person_object_id { } { returns the object_id of the organization contact_object_type } { - db_1row get_object_id { select object_id from contact_object_types where object_type = 'person' } + db_1row get_object_id {} return $object_id } - # some of this codes was borrowed from the directory module ad_proc -public letter_bar { @@ -273,22 +214,6 @@ set locale [lang::conn::locale -site_wide] set user_id [ad_conn user_id] - set query { - select * - from contact_attributes ca, - contact_widgets cw, - contact_attribute_object_map caom, - contact_attribute_names can - where caom.object_id = :object_id - and ca.attribute_id = can.attribute_id - and can.locale = :locale - and caom.attribute_id = ca.attribute_id - and ca.widget_id = cw.widget_id - and not ca.depreciated_p - and acs_permission__permission_p(ca.attribute_id,:user_id,'write') - order by caom.sort_order - } - set active_group_id "" set element_list "" @@ -304,7 +229,7 @@ set object_type "person" } } - db_foreach select_attributes $query { + db_foreach select_attributes {} { if { [lsearch [list first_names last_name email url] $attribute] >= 0 } { if { [contacts::util::party_is_user_p $party_id] } { @@ -534,13 +459,7 @@ if { $storage_column == "option_map_id" && [exists_and_not_null option_map_id] } { set pretty_value {} set ad_form_value [list] - db_foreach select_options_from_map { - select cao.option, cao.option_id - from contact_attribute_options cao, - contact_attribute_option_map caom - where caom.option_id = cao.option_id - and caom.option_map_id = :option_map_id - } { + db_foreach select_options_from_map {} { if { [llength $ad_form_value] > 0 } { # we know there has been a previous entry so we can put in a comma append pretty_value "\n" @@ -587,7 +506,7 @@ set user_id [ad_conn user_id] if { [exists_and_not_null party_id] } { - if { ![db_0or1row select_contact_p { select 1 from contacts where party_id = :party_id }] } { + if { ![contact::exists_p $party_id] } { set party_id [contacts::contact::create -party_id $party_id] } } else { @@ -597,28 +516,11 @@ set locale [lang::conn::locale -site_wide] - set query { - select * - from contact_attributes ca, - contact_widgets cw, - contact_attribute_object_map caom, - contact_attribute_names can - where caom.object_id = :object_id - and ca.attribute_id = can.attribute_id - and can.locale = :locale - and caom.attribute_id = ca.attribute_id - and ca.widget_id = cw.widget_id - and not ca.depreciated_p - and acs_permission__permission_p(ca.attribute_id,:user_id,'write') - order by caom.sort_order - } - - set object_type [contact::get::object_type $party_id] set attr_value_temp "" - db_foreach select_attributes $query { + db_foreach select_attributes {} { set attribute_value_temp [string trim [template::element::get_value entry "contact_attribute__$attribute"]] @@ -634,20 +536,7 @@ set old_address_id "" - db_0or1row select_old_address_id { - select cav.address_id as old_address_id - from contact_attribute_values cav, - postal_addresses pa - where cav.party_id = :party_id - and cav.attribute_id = :attribute_id - and not cav.deleted_p - and cav.address_id = pa.address_id - and pa.delivery_address = :delivery_address - and pa.municipality = :municipality - and pa.region = :region - and pa.postal_code = :postal_code - and pa.country_code = :country_code - } + db_0or1row select_old_address_id {} if { [exists_and_not_null old_address_id] } { # the address in the database is the same set address_id $old_address_id @@ -674,16 +563,7 @@ if { $storage_column == "number_id" } { set old_number_id "" - db_0or1row select_old_number_id { - select cav.number_id as old_number_id - from contact_attribute_values cav, - telecom_numbers tn - where cav.party_id = :party_id - and cav.attribute_id = :attribute_id - and not cav.deleted_p - and cav.number_id = tn.number_id - and tn.subscriber_number = :attribute_value_temp - } + db_0or1row select_old_number_id {} if { [exists_and_not_null old_number_id] } { # the number in the database is the same set number_id $old_number_id @@ -708,13 +588,13 @@ if { [exists_and_not_null attribute_value_temp] } { # first we verify that the address has changed. otherwise we pass on the old option_map_id - db_0or1row get_option_map_id { select option_map_id from contact_attribute_values where party_id = :party_id and attribute_id = :attribute_id and not deleted_p } - + db_0or1row get_option_map_id {} + if { [exists_and_not_null option_map_id] } { # we know that a previous entry exists set old_option_ids "" - db_foreach get_old_options { select option_id from contact_attribute_option_map where option_map_id = :option_map_id } { + db_foreach get_old_options {} { lappend old_option_ids $option_id } set new_option_ids $attribute_value_temp @@ -731,26 +611,21 @@ # the lists have the same values - do nothing } else { # the lists are different - db_1row get_new_option_map_id { select nextval('contact_attribute_option_map_id_seq') as option_map_id } - + db_1row get_new_option_map_id {} + foreach option_id $attribute_value_temp { if {![empty_string_p $option_id]} { - db_dml insert_options_map { - insert into contact_attribute_option_map - (option_map_id,party_id,option_id) - values - (:option_map_id,:party_id,:option_id) - } + db_dml insert_options_map {} } } } } else { # there is no previous entry in the database db_1row get_new_option_map_id { select nextval('contact_attribute_option_map_id_seq') as option_map_id } - + foreach option_id $attribute_value_temp { if {![empty_string_p $option_id]} { - db_dml insert_options_map { + db_dml insert_options_map { insert into contact_attribute_option_map (option_map_id,party_id,option_id) values @@ -789,64 +664,42 @@ if { [lsearch $custom_fields $attribute] >= 0 } { if { $attribute == "email" } { - db_dml update_parties { - update parties set email = :attribute_value_temp where party_id = :party_id - } + db_dml update_parties_email {} } if { $attribute == "url" } { - db_dml update_parties { - update parties set url = :attribute_value_temp where party_id = :party_id - } + db_dml update_parties_url {} } if { $object_type == "organization" } { # [list organization_name legal_name reg_number organization_type] if { $attribute == "organization_name" } { - db_dml update_parties { - update organizations set name = :attribute_value_temp where organization_id = :party_id - } + db_dml update_organizations_name {} } if { $attribute == "legal_name" } { - db_dml update_parties { - update organizations set legal_name = :attribute_value_temp where organization_id = :party_id - } + db_dml update_organizations_legal_name {} } if { $attribute == "reg_number" } { - db_dml update_parties { - update organizations set reg_number = :attribute_value_temp where organization_id = :party_id - } + db_dml update_organizations_reg_number {} } if { $attribute == "organization_type" } { - db_dml delete_object_map { delete from organization_type_map where organization_id = :party_id } + db_dml delete_org_type_maps {} set attribute_value_temp [string trim [template::element::get_values entry "contact_attribute__$attribute"]] foreach option_id $attribute_value_temp { if {![empty_string_p $option_id]} { - db_1row get_organization_type_id { - select organization_type_id - from contact_attribute_options cao, - organization_types ot - where cao.option = ot.type - and cao.option_id = :option_id - } + db_1row get_organization_type_id {} - db_dml insert_maping { insert into organization_type_map - (organization_id, organization_type_id) values - (:party_id, :organization_type_id) } + db_dml insert_mapping {} } } } } if { $object_type == "person" } { # [list first_names last_name] if { $attribute == "first_names" } { - db_dml update_parties { - update persons set first_names = :attribute_value_temp where person_id = :party_id - } + db_dml update_persons_first_names {} } if { $attribute == "last_name" } { - db_dml update_parties { - update persons set last_name = :attribute_value_temp where person_id = :party_id - } + db_dml update_persons_last_name {} } Fisheye: Tag 1.1.2.2 refers to a dead (removed) revision in file `openacs-4/packages/contacts/tcl/contacts-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/contacts/tcl/view-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/contacts/tcl/view-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/Attic/view-procs.tcl,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/packages/contacts/tcl/view-procs.tcl 19 Aug 2004 01:21:41 -0000 1.1.2.4 +++ openacs-4/packages/contacts/tcl/view-procs.tcl 22 Aug 2004 22:43:44 -0000 1.1.2.5 @@ -26,30 +26,15 @@ } { if { ![exists_and_not_null package_id] } { set package_id [ad_conn package_id] } if { ![exists_and_not_null sort_order] } { - db_0or1row select_last_sort_order_value { - select sort_order from contact_views where contact_object_type = :contact_object_type order by sort_order desc limit 1 - } + db_0or1row select_last_sort_order_value {} if { [exists_and_not_null sort_order] } { incr sort_order } else { set sort_order "1" } } - db_1row create_contact_view { - select contact__view_create( - null, - :src, - :privilege_required, - :privilege_object_id, - :contact_object_type, - :package_id, - :sort_order, - now(), - :creation_user, - :creation_ip, - :context_id) as view_id - } + db_1row create_contact_view {} return $view_id } @@ -61,23 +46,17 @@ } { this code returns 1 if the view_id exists for this object_type } { - db_1row create_contact_view { - select contact__view_name_save( - :view_id, - :locale, - :name - ) - } + db_1row save_view_name {} } ad_proc -private init {} { initialize views } { - if { [string is false [db_0or1row views_exist_p { select '1' from contact_views limit 1 } ]] } { + if { [string is false [db_0or1row views_exist_p {} ]] } { - db_1row get_package_id { select package_id from apm_packages where package_key = 'contacts' } + db_1row get_package_id {} set view_id [contacts::view::create -src "/packages/contacts/www/view/contact-view" \ -privilege_required "read" \ @@ -121,7 +100,7 @@ } { this code returns 1 if the view_id exists for this object_type } { - return [db_0or1row exists_p_select { select 1 from contact_views where view_id = :view_id and contact_object_type = :object_type }] + return [db_0or1row exists_p_select {}] } ad_proc -public get { @@ -131,11 +110,7 @@ get the info on the view } { - db_0or1row get_view_info { - select * - from contact_views - where view_id = :view_id - } + db_0or1row get_view_info {} if { ![exists_and_not_null locale] } { set locale [lang::conn::locale -site_wide] @@ -174,9 +149,7 @@ set locale [lang::conn::locale -site_wide] } - db_0or1row get_view_name { - select name from contact_view_names where view_id = :view_id and locale = :locale - } + db_0or1row get_view_name {} if { ![exists_and_not_null name] } { set locale "en_US"