diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-04 03:31:01 +0000 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-04 03:31:01 +0000 |
| commit | 81a6dc26cb9bcbb3a494c2df5ea279788559bd7f (patch) | |
| tree | ca8463b49ba71561fd6f653d45daa29f66f4879b /modules/notification/helpers/notification_event.php | |
| parent | e33ad56b99740fa360bb9ac530686ece79795195 (diff) | |
Send 1 items added notification per batch of items
Diffstat (limited to 'modules/notification/helpers/notification_event.php')
| -rw-r--r-- | modules/notification/helpers/notification_event.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index 3fccdfbe..df06a2f1 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -23,7 +23,9 @@ class notification_event_Core { } static function item_created($item) { - notification::send_item_add($item); + if (!batch::in_progress("add")) { + notification::send_item_add($item); + } } static function item_before_delete($item) { @@ -51,4 +53,24 @@ class notification_event_Core { ->where("user_id", $user->id) ->delete_all(); } + + static function operation($name, $item) { + if ($name == "add") { + $id = Session::instance()->get("notification_batch_item_id"); + if ($id && $item->id != $id) { + notification::send_batch_add($id); + } + Session::instance()->set("notification_batch_item_id", $item->id); + } + } + + static function end_operation($name) { + if ($name == "add") { + $id = Session::instance()->get_once("notification_batch_item_id"); + if ($id) { + notification::send_batch_add($id); + } + } + } + } |
