DB Item Clear method and field option customizations

0 views
Skip to first unread message

S.G.

unread,
Dec 18, 2009, 6:56:20 AM12/18/09
to In-Portal Bugs
In kDBItem class we have method called Clear. It's goal is to reset
item, so it should look like after it was recalled for the first time.
But what Clear do not is resetting field options in item object. So,
if you made modifications for the item like setting required option or
something alike, it stays after Clear.

My suggestion is to add call of kDBBase method defineFields to Clear.
It should reassign field properties from unit config, so the goal will
be achieved.

TO THINK ABOUT: what other item object options should be reloaded by
Clear method?

Alexander Obuhovich

unread,
Dec 18, 2009, 7:07:58 AM12/18/09
to in-port...@googlegroups.com
That was not intension of Clear method. Clear method is designed to clear data, loaded from database, validation errors etc., so next Create/Update method call wouldn't mix with previous call.

How come, that you use your dummy item object in some kind of iteration process, where required fields are set on the fly? Can't really imagine situation like this right now. Maybe you should set required fields like this (in OnBeforeItemCreate/OnBeforeItemUpdate):

$object->setRequired('FieldName', $custom_codition ? true : false);

and not like this:

if ($custom_condition) {
    $object->setRequired('FieldName', true);
}

Please provide an example.

The worst (because it maybe slower, then current Clear method content) way is to call OnItemBuild event, when Clear method is called.


--

You received this message because you are subscribed to the Google Groups "In-Portal Bugs" group.
To post to this group, send email to in-port...@googlegroups.com.
To unsubscribe from this group, send email to in-portal-bug...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/in-portal-bugs?hl=en.





--
Best Regards,

http://www.in-portal.org
http://www.alex-time.com
Reply all
Reply to author
Forward
0 new messages