Changeset 16376
- Timestamp:
- 05/14/08 14:44:59 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/midcom.core/midcom/baseclasses/core/dbobject.php
r15564 r16376 989 989 } 990 990 991 if ( isset($object->lang) 992 && !empty($object->name)) 993 { 994 /** 995 * ML Object with non-empty name 996 * 997 * Check that we're doing anything stupid like overwriting name 998 * derived in "lang0" with one derived from localized title 999 */ 1000 $fallback_language = mgd_get_default_lang(); 1001 if ($object->lang != $fallback_language) 1002 { 1003 debug_push_class(__CLASS__, __FUNCTION__); 1004 debug_add("Not regenerating name for {$object->guid}, current version is not the fallback-language one", MIDCOM_LOG_INFO); 1005 debug_add("\$object->lang={$object->lang} != \$fallback_language={$fallback_language}"); 1006 debug_pop(); 1007 // This is localized version of the object, do not overwrite name silently abort instead 1008 return true; 1009 } 1010 } 1011 991 1012 $name = midcom_generate_urlname_from_string($object->$titlefield); 992 1013 // Strip the incrementing count suffix from name for checking branches/MidCOM_2_8/net.nemein.calendar/event.php
r16374 r16376 248 248 } 249 249 250 /** 251 * Clears the name field if user is not allowed to set it explicitly 252 * 253 * But only when in the fallback language 254 */ 255 function _check_clear_name() 256 { 257 $fallback_language = mgd_get_default_lang(); 258 /* 259 debug_push_class(__CLASS__, __FUNCTION__); 260 debug_add("checking lang"); 261 $fallback_language = mgd_get_default_lang(); 262 debug_add("if (\$this->lang={$this->lang} != \$fallback_language={$fallback_language})"); 263 debug_pop(); 264 */ 265 if ($this->lang != $fallback_language) 266 { 267 return; 268 } 269 if (!$this->_config->get('allow_name_change')) 270 { 271 $this->name = ''; 272 } 273 } 274 250 275 function _on_creating() 251 276 { 252 if (!$this->_config->get('allow_name_change')) 253 { 254 $this->name = ''; 255 } 256 277 $this->_check_clear_name(); 257 278 if (!$this->_check_time_range()) 258 279 { … … 268 289 function _on_updating() 269 290 { 270 if ( !$this->_config->get('allow_name_change') 271 && !isset($GLOBALS['net_nemein_calendar_event_dba__on_updated_loop_{$this->guid}'])) 272 { 273 $this->name = ''; 291 if (!isset($GLOBALS['net_nemein_calendar_event_dba__on_updated_loop_{$this->guid}'])) 292 { 293 $this->_check_clear_name(); 274 294 } 275 295 … … 293 313 function _on_created() 294 314 { 315 // In theory we should never be able to loop here since it goes on to the update callbacks, but better to be safe 295 316 if (isset($GLOBALS['net_nemein_calendar_event_dba__on_created_loop_{$this->guid}'])) 296 317 {
