antoniop
committed
on 22 May 18
Exploit users cache, simplify SQL
openacs-4/.../contacts/www/contact-edit.tcl (+2 -3)
159 159         
160 160         util_user_message -html -message "The $object_type <a href=\"contact?party_id=$party_id\">[contact::name -party_id $party_id]</a> was updated"
161 161
162 162         set cat_ids [list]
163 163         foreach group_id $groups_belonging_to {
164 164             set element_name "category_ids$group_id"
165 165             if {$group_id < 0} {
166 166                 set element_name "category_ids[expr - $group_id]"
167 167             }
168 168
169 169             set cat_ids [concat $cat_ids \
170 170                              [category::ad_form::get_categories \
171 171                                   -container_object_id $group_id \
172 172                                   -element_name $element_name]]
173 173         }
174 174
175 175         category::map_object -remove_old -object_id $party_id $cat_ids
176 176         if {$object_type == "organization"} {
177 177             callback contact::organization_new -package_id $package_id -contact_id $party_id -name $name
178 178             foreach employee_id [contact::util::get_employees -organization_id $party_id] {
179                   util_memoize_flush_regexp "::contact::employee::get_not_cached -employee_id $employee_id *"
180                   util_memoize_flush_regexp "::contact::employee_not_cached -employee_id $employee_id"
  179                 contact::flush -party_id $employee_id
181 180             }
182 181         } else {
183 182             callback contact::person_add -package_id $package_id -person_id $party_id
184 183         }
185 184     } -after_submit {
186 185         contact::flush -party_id $party_id
187 186         contact::search::flush_results_counts
188 187
189 188         if { ![exists_and_not_null return_url] } {
190 189             set return_url [contact::url -party_id $party_id]
191 190         }
192 191
193 192         ad_returnredirect $return_url
194 193         ad_script_abort
195 194     }
196 195
197 196
198 197
199 198
200 199