X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=NotifyAction.php;h=e3b9af5cd3d43c80988a61dcc8ad9f8aa89aa4a8;hp=ffd385c99d4538d5874b846ac65ad6bad09d75dd;hb=586e4eb470252d837ba18b67e4c3c1702131fd1d;hpb=e16259313dfac9729c35a90c5f326e4468ba0552 diff --git a/NotifyAction.php b/NotifyAction.php index ffd385c9..e3b9af5c 100644 --- a/NotifyAction.php +++ b/NotifyAction.php @@ -31,18 +31,18 @@ class Pman_Core_NotifyAction extends Pman } - function get() + function get($v, $opts=array()) { $this->jerr("invalid request"); } - function post() + function post($v) { // needs: (Array of...) // on_table, // action(eg. APPROVAL) // on_id (comma delimited.) - DB_DataObject::debugLevel(1); + //DB_DataObject::debugLevel(1); $n = DB_DataObject::factory('core_notify'); $n->person_id = $this->authUser->id; // in theory in workflow, this could trigger another action... @@ -63,14 +63,22 @@ class Pman_Core_NotifyAction extends Pman $n->autoJoin(); $ar = $n->fetchAll(); + $done = array(); + foreach($ar as $n) { $nc = clone($n); $nc->sent = date('Y-m-d H:i:s'); $nc->update($n); - // add an event????? + // add an event????? - yeap... only once per object + $key = implode(':', array($nc->ontable,$nc->onid)); + if (!isset($done[$key])) { + + $e = $this->addEvent($_POST['action'],$n->object()); + } + $done[$key] = true; } - + $this->jok("updated"); }