In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Viewing Issue Simple Details Jump to Notes ] Wiki ]  Related Changesets ] View Advanced ] Issue History ] Print ]
ID Category Type Reproducibility Date Submitted Last Update
0000397 [In-Portal CMS] Data Management task always 2009-10-17 07:00 2012-07-25 05:33
Reporter alex View Status public Project Name In-Portal CMS
Assigned To alex Developer
Priority normal Resolution fixed Fixed in Version 5.2.0-B1
Status closed Product Version 5.0.1 Target Version 5.2.0
Time EstimateNo estimate
Summary 0000397: Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class
Description There are two type of events:
1. external events - events, that could be called from outside of the script, by specifying their name in url
2. internal events - events, that are called by internal subroutines only and in most cases are indirectly related to external event being called.

For example OnCreate event is pure external and it allows to create record in database based on form data form request. On the other hand OnBeforeItemCreate is pure internal event, that is called before attempt is made to create database record. This internal event is indirectly called from OnCreate event by calling kDBItem::Create method.

All seems normal at first glance, but in fact it's not. There is no way to access OnCreate event $event object from OnBeforeItemCreate event. One of purposes of such type of access is to change redirect parameters or main event. For example in case of TestField value is equals to 5 we want to redirect user to non-default template after record is successful created.
Additional Information How I see implementation:
1. add 2 methods to kDBItem class: setReferrerEvent(&$event) and removeReferrerEvent()
2. when event of any type is called from kDBItem class (via raiseEvent method), then we set it's MasterEvent attribute to referrer event in case if any was set before.
3. from OnBeforeItemCreate event OnCreate event will be accessed via $event->MasterEvent.
Tags No tags attached.
Reference
Change Log Message
Estimate Points 2
Attached Files patch file icon ability_to_use_main_event_from_internal_events.patch [^] (3,492 bytes) 2011-08-24 07:39 [Show Content]
patch file icon ability_to_use_main_event_from_internal_events_520.patch [^] (5,485 bytes) 2011-10-03 04:48 [Show Content]
patch file icon temp_handler_ignored_parent_event_fix.patch [^] (8,470 bytes) 2011-10-12 03:50 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to 0000898closed (5.2.0)alex Admin Interface for managing "Permission Types" 

-  Notes
User avatar (0003698)
alex (manager)
2011-08-24 07:42

Now events, that are called using kDBItem::raiseEvent method have $event->MasterEvent set to original event, that was specified in form submit.

This way:
OnBeforeItemCreate
OnAfterItemCreate

OnBeforeItemUpdate
OnAfterItemUpdate

OnBeforeItemDelete
OnAfterItemDelete

Now has references to OnSave,OnCreate,OnUpdate,OnMassDelete events, that indirectly raises them.
User avatar (0003880)
Dmitry (manager)
2011-09-23 20:43

New patch for 5.2.0 needed (PHP 5 format)
User avatar (0003963)
alex (manager)
2011-10-03 04:48

Will test all together.
User avatar (0003964)
alex (manager)
2011-10-03 04:49

Fix committed to 5.2.x branch. Commit Message:

Fixes 0000397: Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class
User avatar (0004042)
alex (manager)
2011-10-12 03:51

Patch "temp_handler_ignored_parent_event_fix.patch" fixed problem, when objects created within temp handler were not having reference to event, that called temp handler method in first place.
User avatar (0005111)
alex (manager)
2012-07-25 05:33

Since 5.2.0 version was released.

- Related Changesets
In-Portal CMS: 5.2.x r14657
Timestamp: 2011-10-12 03:52:40
Author: alex
Details ] Diff ]
Bug 0000397: Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class
1. Fixes problem, when objects created within temp handler were not having reference to event, that called temp handler method in first place
mod - /in-portal/branches/5.2.x/core/kernel/db/db_event_handler.php Diff ] File ]
mod - /in-portal/branches/5.2.x/core/kernel/utility/temp_handler.php Diff ] File ]
In-Portal CMS: 5.2.x r14608
Timestamp: 2011-10-03 04:49:06
Author: alex
Details ] Diff ]
Fixes 0000397: Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class
mod - /in-portal/branches/5.2.x/core/kernel/db/db_event_handler.php Diff ] File ]
mod - /in-portal/branches/5.2.x/core/kernel/db/dbitem.php Diff ] File ]
mod - /in-portal/branches/5.2.x/core/kernel/kbase.php Diff ] File ]
mod - /in-portal/branches/5.2.x/core/kernel/utility/event.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2012-07-25 05:33 alex Note Added: 0005111
2012-07-25 05:33 alex Status resolved => closed
2011-10-22 05:27 alex Estimate Points => 2
2011-10-12 03:54 alex Relationship added related to 0000898
2011-10-12 03:52 alex Changeset attached 5.2.x r14657
2011-10-12 03:51 alex Note Added: 0004042
2011-10-12 03:50 alex File Added: temp_handler_ignored_parent_event_fix.patch
2011-10-03 04:49 alex Note Added: 0003964
2011-10-03 04:49 alex Status reviewed and tested => resolved
2011-10-03 04:49 alex Fixed in Version => 5.2.0-B1
2011-10-03 04:49 alex Resolution open => fixed
2011-10-03 04:49 alex Assigned To !COMMUNITY => alex
2011-10-03 04:49 alex Changeset attached 5.2.x r14608
2011-10-03 04:48 alex Note Added: 0003963
2011-10-03 04:48 alex Status needs testing => reviewed and tested
2011-10-03 04:48 alex Time Estimate Removed 1 =>
2011-10-03 04:48 alex Status needs work => needs testing
2011-10-03 04:48 alex File Added: ability_to_use_main_event_from_internal_events_520.patch
2011-09-26 04:53 alex Time Estimate Added 1
2011-09-23 20:43 Dmitry Note Added: 0003880
2011-09-23 20:43 Dmitry Status needs testing => needs work
2011-08-24 07:42 alex Note Added: 0003698
2011-08-24 07:42 alex Assigned To alex => !COMMUNITY
2011-08-24 07:42 alex Developer => alex
2011-08-24 07:42 alex Status needs work => needs testing
2011-08-24 07:39 alex Target Version Icebox => 5.2.0
2011-08-24 07:39 alex File Added: ability_to_use_main_event_from_internal_events.patch
2009-11-25 01:19 Dmitry Assigned To => alex
2009-11-25 01:19 Dmitry Status active => needs work
2009-10-17 07:01 alex Target Version => Icebox
2009-10-17 07:00 alex New Issue



Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker