Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl,v
diff -u -r1.89 -r1.90
--- openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 28 Jun 2018 09:20:14 -0000 1.89
+++ openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 28 Jun 2018 09:41:24 -0000 1.90
@@ -197,14 +197,34 @@
ad_proc -public person::update {
{-person_id:required}
- {-first_names:required}
- {-last_name:required}
+ -first_names
+ -last_name
+ -bio
} {
- update the name of a person
+ Update person information.
} {
+ set cols [list]
+ foreach var {first_names last_name bio} {
+ if { [info exists $var] } {
+ lappend cols "$var = :$var"
+ }
+ }
+ if {[llength $cols] == 0} {
+ return
+ }
+
db_dml update_person {}
- db_dml update_object_title {}
- person::flush_cache -person_id $person_id
+
+ # update object title if changed
+ if {[info exists first_names] ||
+ [info exists last_name]} {
+ db_dml update_object_title {}
+ # need to flush also objects attributes for the party
+ person::flush_cache -person_id $person_id
+ } else {
+ # only need to flush person information (e.g. bio)
+ person::flush_person_info -person_id $person_id
+ }
}
# DRB: Though I've moved the bio field to type specific rather than generic storage, I've
@@ -251,13 +271,17 @@
} {
Update the bio for a person.
+ This proc will be deprecated in the future. Please use
+ person::update as now supports optional parameters.
+
+ @see person::update
+
@param person_id The ID of the person to edit bio for
@param bio The new bio for the person
@author Lars Pind (lars@collaboraid.biz)
} {
- db_dml update_bio {}
- person::flush_person_info -person_id $person_id
+ person::update -person_id $person_id -bio $bio
}
@@ -267,8 +291,10 @@
} {
Change the membership state of a user.
} {
- set rel_id [db_string select_rel_id {} -default {}]
+ set rel_id [acs_user::get_user_info \
+ -user_id $user_id -element rel_id]
+ # most likely this is is not a registered user
if {$rel_id eq ""} {
return
}
Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.xql,v
diff -u -r1.33 -r1.34
--- openacs-4/packages/acs-tcl/tcl/community-core-procs.xql 28 Jun 2018 09:10:14 -0000 1.33
+++ openacs-4/packages/acs-tcl/tcl/community-core-procs.xql 28 Jun 2018 09:41:24 -0000 1.34
@@ -5,8 +5,7 @@
update persons
- set first_names = :first_names,
- last_name = :last_name
+ set [join $cols ", "]
where person_id = :person_id
@@ -22,14 +21,6 @@
-
-
- update persons
- set bio = :bio
- where person_id = :person_id
-
-
-
@@ -51,16 +42,6 @@
-
-
-
- select 1
- from registered_users
- where user_id = :user_id
-
-
-
-
@@ -133,14 +114,4 @@
-
-
-
- select rel_id
- from cc_users
- where user_id = :user_id
-
-
-
-