Forum OpenACS Development: Re: AMS pkg NULL value

Collapse
3: Re: AMS pkg NULL value (response to 2)
Posted by Iuri Sampaio on
That's weird!
- I guess it isn't the reason. I filled out the fields as mnemonic values as you can see at the sql query bellow:

Error in include template "/home/conaje/conaje/packages/acs-subsite/lib/user-info": Transaction aborted: 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, 'street', 'state', '407689', 'BR', NULL, NULL )

Just in case!!! I just checkout postal address from cvs HEAD and installed. The bug remains the same.

- plus, why the values that i submited to a text box, they don't show on the list? And the api call is just fine

Collapse
4: Re: AMS pkg NULL value (response to 3)
Posted by Iuri Sampaio on
more info:

in order to prove that the api calls are working:

The api to add the extra fields is fine. The fields are in the user form.

ad_form -extend -name user_info -form [ams::ad_form::elements -package_key "acs-subsite" -object_type "person" -list_name "extra_info"]

and the api to save the values is fine as well

ams::ad_form::save -package_key "acs-subsite" -object_type "person" -list_name "extra_info" -form_name "user_info" -object_id $user_id

i checked the textbox as required submit new values in the form. So if the values weren't being passed the red warning would come up. but it didn;t.

then why the api isn;t working :(
ams::values -package_key "acs-subsite" -object_id $user_id -object_type "person" -list_name "extra_info"

Collapse
5: Re: AMS pkg NULL value (response to 4)
Posted by Iuri Sampaio on
so far i've put a ns_notice at the api just ams::saveto see what value is being passed to value_save

****************************
set value_id [ams::widget -widget $widget -request "form_save_value" -attribute_name $attribute_name -pretty_name $pretty_name -form_name $form_\
name -attribute_id $attribute_id]

ns_log notice "TEST: $attribute_name: $value_id"

ams::attribute::value_save -object_id $object_id -attribute_id $attribute_id -value_id $value_id
*******************************

and the weird message come up on the error.log file
I was expecting to come TEST: followed with the fields that are on ams-list

*************************************
[20/Feb/2007:06:06:18][10468.49156][-conn:conaje::0] Notice: TEST: aol_msg:
NOTICE: adding missing FROM-clause entry for table "acs_object_id_seq"
CONTEXT: PL/pgSQL function "acs_object__new" line 17 at select into variables
PL/pgSQL function "acs_object__new" line 11 at return
PL/pgSQL function "ams_value__postal_address_save" line 43 at assignment
[20/Feb/2007:06:06:18][10468.49156][-conn:conaje::0] Error: Ns_PgExec: result status: 7 message: 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

[20/Feb/2007:06:06:18][10468.49156][-conn:conaje::0] Error: Error in include template "/home/conaje/conaje/packages/acs-subsite/lib/user-info": Transaction aborted: 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
...

Collapse
6: Re: AMS pkg NULL value (response to 5)
Posted by Iuri Sampaio on
Hi MAlte,
good news! Somehow i fixed the error. The fileds were inserted using the same proc i was using before, but i changed the list_name to extended_fields. Somehow it worked!

ad_form -extend -name user_info -form [ams::ad_form::elements -package_key "acs-subsite" -object_type "person" -list_name "extra_info"]

ams::ad_form::save -package_key "acs-subsite" -object_type "person" -list_name "extra_info" -form_name "user_info" -object_id $user_id

Then, I changed the api ams::values -package_key ...
to
ams::ad_form::values -package_key "acs-subsite" -object_id $user_id -object_type "person" -list_name "extra_info"

However i did update the pkgs ams and postal-address and the NULL sql error's still there.
are you sure the version commited is ok??

Collapse
7: Re: AMS pkg NULL value (response to 6)
Posted by Malte Sussdorff on
Hi Iuri, i am pretty sure it works. Just look in the postgresql/upgrade directory. If there is nothing there, make a new checkout. You should see this file:
http://cvs.openacs.org/cvs/openacs-4/packages/postal-address/sql/postgresql/upgrade/
Collapse
8: Re: AMS pkg NULL value (response to 7)
Posted by Iuri Sampaio on
hi Malte,

I found the file, i just ran
psql -f conaje/packages/postal-address/sql/postgresql/upgrade/upgrade-0.2d1-0.2d2.sql conaje

and it worked out. I can leave street blank and it doesn;t return any error.

Although the file were there, i didn't see on the GUI (browser) the option to upgrade it.

I was wondering what makes some packages such as ams pkg shows up at the upgrade pkg GUI section.

So how does the kernel recognize the ones to upgrade.

I know the wise developer has to trust in the code instead of the eyes. :)
So i went to the server and both pgks have the same hierarchy of directories.