Index: openacs-4/packages/ams/tcl/address-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/address-widget-procs.tcl,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/ams/tcl/address-widget-procs.tcl 20 Jun 2006 16:51:28 -0000 1.17 +++ openacs-4/packages/ams/tcl/address-widget-procs.tcl 8 Aug 2006 09:35:17 -0000 1.18 @@ -318,12 +318,11 @@ set postal_type [ns_queryget $element_id.postal_type] - - if { [empty_string_p $delivery_address] } { - # We need to return the empty list in order for form builder to think of it - # as a non-value in case of a required element. - return [list] - } else { +# if { [empty_string_p $country_code]} { +# # We need to return the empty list in order for form builder to think of it +# # as a non-value in case of a required element. +# return [list] +# } else { if { $country_code == "US" } { # since we have reference data installed we can automatically get a standardized # state code @@ -389,7 +388,7 @@ set postal_code [string toupper $postal_code] return [list [list $delivery_address $municipality $region $postal_code $country_code $additional_text $postal_type]] - } +# } } ad_proc -public template::util::address::set_property { what address_list value } { Index: openacs-4/packages/ams/tcl/ams-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-procs.tcl,v diff -u -N -r1.49 -r1.50 --- openacs-4/packages/ams/tcl/ams-procs.tcl 26 Apr 2006 06:24:55 -0000 1.49 +++ openacs-4/packages/ams/tcl/ams-procs.tcl 8 Aug 2006 09:35:17 -0000 1.50 @@ -126,6 +126,10 @@ return the attribute_id for the specified attribute, this proc checks all parent attributes as well } { + # Special case for emails + if {$attribute_name eq "email"} { + set object_type "party" + } return [db_string get_attribute_id {} -default {}] } Index: openacs-4/packages/ams/tcl/ams-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-widget-procs.tcl,v diff -u -N -r1.32 -r1.33 --- openacs-4/packages/ams/tcl/ams-widget-procs.tcl 4 May 2006 23:43:34 -0000 1.32 +++ openacs-4/packages/ams/tcl/ams-widget-procs.tcl 8 Aug 2006 09:35:17 -0000 1.33 @@ -12,6 +12,7 @@ namespace eval ams::widget {} namespace eval ams::util {} namespace eval ams::attribute::save {} +namespace eval ams::attributes::save {} ad_proc -public ams::widget { -widget:required @@ -1740,9 +1741,7 @@ set country_code [string trim $country_code] set additional_text [string trim $additional_text] set postal_type [string trim $postal_type] - if { [exists_and_not_null delivery_address] } { - return [db_string save_value {} -default {}] - } + return [db_string save_value {} -default {}] } ad_proc -private ams::util::telecom_number_save { @@ -1795,7 +1794,134 @@ } +########################################## +# Quick Procs for Saving multiple values +########################################## +ad_proc -public ams::attributes::save::text { + -object_id:required + {-object_type ""} + -value_list +} { + Save Multiple values for an object_id + + @author Malte Sussdorff (sussdorff@sussdorff.de) + @creation-date 2005-07-22 + + @param object_id The object for which the value is stored + + @param value_list Pair List of attribute_id and value which will be inserted for the object_id + + @return + + @error +} { + + if {[string eq $object_type ""]} { + set object_type [acs_object_type $object_id] + } + + # Set the text attributes + foreach pair $value_list { + set value [lindex $pair 1] + set attribute_name [lindex $pair 0] + if {[exists_and_not_null value]} { + ams::attribute::save::text \ + -object_id $object_id \ + -attribute_name $attribute_name \ + -object_type $object_type \ + -value $value + } + } +} + +ad_proc -public ams::attributes::save::phone { + -object_id:required + {-object_type ""} + -value_list +} { + Save Multiple phone values for an object_id + + @author Malte Sussdorff (sussdorff@sussdorff.de) + @creation-date 2005-07-22 + + @param object_id The object for which the value is stored + + @param value_list Pair List of attribute_id and value which will be inserted for the object_id + + @return + + @error +} { + + if {[string eq $object_type ""]} { + set object_type [acs_object_type $object_id] + } + + # Set phone attributes + + foreach pair $value_list { + set value [lindex $pair 1] + set attribute_name [lindex $pair 0] + if {[exists_and_not_null value]} { + set value_id [ams::util::telecom_number_save \ + -subscriber_number $value + ] + set attribute_id [attribute::id \ + -object_type $object_type \ + -attribute_name $attribute_name + ] + ams::attribute::value_save \ + -attribute_id $attribute_id \ + -value_id $value_id \ + -object_id $object_id + } + } +} + +ad_proc -public ams::attributes::save::number { + -object_id:required + {-object_type ""} + -value_list +} { + Save Multiple number values for an object_id + + @author Malte Sussdorff (sussdorff@sussdorff.de) + @creation-date 2005-07-22 + + @param object_id The object for which the value is stored + + @param value_list Pair List of attribute_id and value which will be inserted for the object_id + + @return + + @error +} { + + if {[string eq $object_type ""]} { + set object_type [acs_object_type $object_id] + } + # Set phone attributes + + foreach pair $value_list { + set value [lindex $pair 1] + set attribute_name [lindex $pair 0] + if {[exists_and_not_null value]} { + set value_id [ams::util::number_save \ + -number $value + ] + set attribute_id [attribute::id \ + -object_type $object_type \ + -attribute_name $attribute_name + ] + ams::attribute::value_save \ + -attribute_id $attribute_id \ + -value_id $value_id \ + -object_id $object_id + } + } +} + ######################### # Quick Procs for Saving #########################