select 1 from contacts where party_id = :party_id select * from contacts where party_id = :party_id select * from contacts where party_id = :party_id select '1' from users where user_id = :party_id select nextval from acs_object_id_seq select object_id from contact_object_types where object_type = 'organization' select object_id from contact_object_types where object_type = 'person' 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 select ca.attribute_id, ca.attribute, cav.option_map_id, cav.address_id, cav.number_id, to_char(cav.time,'YYYY MM DD') as time, cav.value, cav.value_format, cw.storage_column from contact_attributes ca, contact_widgets cw, contact_attribute_object_map caom left join ( select * from contact_attribute_values where party_id = :party_id and not deleted_p ) cav on (caom.attribute_id = cav.attribute_id) where caom.object_id = '$object_id' and caom.attribute_id = ca.attribute_id and ca.widget_id = cw.widget_id and not ca.depreciated_p and ( cav.option_map_id is not null or cav.address_id is not null or cav.number_id is not null or cav.value is not null or cav.time is not null or ca.attribute in ($custom_field_sql_list) ) and acs_permission__permission_p(ca.attribute_id,'$user_id','$permission') order by caom.sort_order select name from organizations where organization_id = :party_id select legal_name from organizations where organization_id = :party_id select reg_number from organizations where organization_id = :party_id select first_names from persons where person_id = :party_id select cao.option_id, cao.option from contact_attribute_options cao, organization_types ot, organization_type_map otm where cao.option = ot.type and cao.attribute_id = :attribute_id and otm.organization_type_id = ot.organization_type_id and otm.organization_id = :party_id select first_names from persons where person_id = :party_id select last_name from persons where person_id = :party_id select email from parties where party_id = :party_id select url from parties where party_id = :party_id 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 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 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 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 select option_map_id from contact_attribute_values where party_id = :party_id and attribute_id = :attribute_id and not deleted_p select option_id from contact_attribute_option_map where option_map_id = :option_map_id select nextval('contact_attribute_option_map_id_seq') as option_map_id insert into contact_attribute_option_map (option_map_id,party_id,option_id) values (:option_map_id,:party_id,:option_id) update parties set email = :attribute_value_temp where party_id = :party_id update parties set url = :attribute_value_temp where party_id = :party_id update organizations set name = :attribute_value_temp where organization_id = :party_id update organizations set legal_name = :attribute_value_temp where organization_id = :party_id update organizations set reg_number = :attribute_value_temp where organization_id = :party_id delete from organization_type_map where organization_id = :party_id select organization_type_id from contact_attribute_options cao, organization_types ot where cao.option = ot.type and cao.option_id = :option_id insert into organization_type_map (organization_id, organization_type_id) values (:party_id, :organization_type_id) update persons set first_names = :attribute_value_temp where person_id = :party_id update persons set last_name = :attribute_value_temp where person_id = :party_id