I got this bug using AMS pkg. I created a list of extra fields and put in the user form.
Everything seems to work properly execept for the address field. It looks like the api inserts a NULL value when it's a required value field.
just for info:
I used the api to add the elements
ad_form -extend -name user_info -form [ams::ad_form::elements -package_key "acs-admin" -object_type "person" -list_name "extra_fields"]
then to save the values:
ams::values -package_key "acs-admin" -object_id $user_id -object_type "person" -list_name "extra_fields"
and when i fill out the form and submit i got the error.
please help!!!
PAGE: /packages/acs-subsite/lib/user-info
------------------------------------------------------------
Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
ERROR: null value in column "delivery_address" violates not-null constraint
CONTEXT: PL/pgSQL function "ams_value__postal_address_save" line 52 at SQL statement
SQL:
select ams_value__postal_address_save (
NULL,
'test',
'test',
'TEST',
'AL',
NULL,
NULL
)
while executing
"ns_pg_bind 0or1row nsdb1 {
select ams_value__postal_address_save (
:delivery_address,
:municipality,
:region,
:postal_code..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within
"switch $driverkey {
oracle {
return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
}
..."
invoked from within
"db_exec 0or1row $db $full_name $sql"
invoked from within
"set selection [db_exec 0or1row $db $full_name $sql]"
("uplevel" body line 2)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
set selection [db_exec 0or1row $db $full_name $sql]
}"
(procedure "db_string" line 8)
invoked from within
"db_string save_value {} -default {}"
(procedure "ams::util::postal_address_save" line 13)
invoked from within
"ams::util::postal_address_save -delivery_address [template::util::address::get_property delivery_address $value] -municipality [template::util::addr..."
("form_save_value" arm line 3)
invoked from within
"switch $request {
ad_form_widget {
set help_text [attribute::help_text -attribute_id $attribute_id]
if { [string is true $optional..."
(procedure "::ams::widget::postal_address" line 3)
invoked from within
"::ams::widget::${widget} -request $request -attribute_name $attribute_name -pretty_name $pretty_name -value $value -optional_p $optional_p -form_name ..."
(procedure "ams::widget" line 32)
invoked from within
"ams::widget -widget $widget -request "form_save_value" -attribute_name $attribute_name -pretty_name $pretty_name -form_name $form_name -attribute_id $..."
invoked from within
"set value_id [ams::widget -widget $widget -request "form_save_value" -attribute_name $attribute_name -pretty_name $pretty_name -form_name $form_name -..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $code_block "
("1" arm line 1)
invoked from within
"switch $errno {
0 {
# TCL_OK
}
1 {
# TCL_ERROR
..."
("while" body line 20)
invoked from within
"while { [db_getrow $db $selection] } {
incr counter
if { [info exists array_val] } {
unset array_val
..."
("uplevel" body line 5)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
set selection [db_exec select $db $full_statement_name $sql]
set counter 0
while { [db_getrow $..."
(procedure "db_foreach" line 36)
invoked from within
"db_foreach select_elements {} {
set value_id [ams::widget -widget $widget -request "form_save_value" -attribute_name $attribute_name -pretty_name..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $transaction_code "
(procedure "db_transaction" line 39)
invoked from within
"db_transaction {
db_foreach select_elements {} {
set value_id [ams::widget -widget $widget -request "form_save_value" -attribute_name $attribute..."
(procedure "ams::ad_form::save" line 7)
invoked from within
"ams::ad_form::save -package_key "acs-admin" -object_type "person" -list_name "extra_fields" -form_name "user_info" -object_id $user_id"
("uplevel" body line 35)
invoked from within
"uplevel #$level $on_submit"
("1" arm line 592)
invoked from within
"switch $errno {
0 {
# TCL_OK
}
1 {
# TCL_E..."
(procedure "ad_form" line 612)
invoked from within
"ad_form -extend -name user_info -form {
{url:text,optional
{label "[_ acs-subsite.Home_page]"}
{html {size 50}}
{mode $elm..."
("uplevel" body line 113)
invoked from within
"uplevel {
#
# Expects:
# user_id:optional
# return_url:optional
# edit_p:optional
# message:optional
# show_groups_p:optional
auth::require_log..."
(procedure "code::tcl::/home/conaje/conaje/packages/acs-subsite/lib/user..." line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {
# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {
if { [file exists $__adp_stub.tcl] } {
# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare "
(procedure "template::adp_parse" line 30)
invoked from within
"template::adp_parse [template::util::url_to_file "/packages/acs-subsite/lib/user-info" "$__adp_stub"] [list user_id "[ad_quotehtml [lang::util::locali..."