projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more quote identeiifers fixessss
[Pman.Core]
/
NotifyAction.php
diff --git
a/NotifyAction.php
b/NotifyAction.php
index
7ec2462
..
e3b9af5
100644
(file)
--- a/
NotifyAction.php
+++ b/
NotifyAction.php
@@
-31,27
+31,27
@@
class Pman_Core_NotifyAction extends Pman
}
}
- function get()
+ function get(
$v, $opts=array()
)
{
$this->jerr("invalid request");
}
{
$this->jerr("invalid request");
}
- function post()
+ function post(
$v
)
{
// needs: (Array of...)
// on_table,
// action(eg. APPROVAL)
// on_id (comma delimited.)
{
// 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...
// if watch is on it..
$n = DB_DataObject::factory('core_notify');
$n->person_id = $this->authUser->id;
// in theory in workflow, this could trigger another action...
// if watch is on it..
- foreach(array('on
_table','on_
id','action') as $k) {
+ foreach(array('on
table','on
id','action') as $k) {
if (empty($_POST[$k])) {
$this->jerr("missing argument $k");
}
if (empty($_POST[$k])) {
$this->jerr("missing argument $k");
}
- if ($k == 'on
_
id') {
+ if ($k == 'onid') {
continue;
}
$n->$k = $_POST[$k];
continue;
}
$n->$k = $_POST[$k];
@@
-59,18
+59,26
@@
class Pman_Core_NotifyAction extends Pman
$n->whereAdd('sent < act_when'); // not issued yet..
$n->whereAdd("join_watch_id_id.medium = '". $n->escape($n->action) ."'");
$n->whereAdd('sent < act_when'); // not issued yet..
$n->whereAdd("join_watch_id_id.medium = '". $n->escape($n->action) ."'");
- $n->whereAddIn('core_notify.on
_id', explode(',', $_POST['on_
id']), 'int' );
+ $n->whereAddIn('core_notify.on
id', explode(',', $_POST['on
id']), 'int' );
$n->autoJoin();
$ar = $n->fetchAll();
$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);
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");
}
}