3 * in theory a generic 'action' handler..
5 * Part of the eventual workflow code...
6 * -> at present, just flags something as done.....
11 class Pman_Core_NotifyAction extends Pman
16 $au = $this->getAuthUser();
18 $this->jerr("Not authenticated", array('authFailure' => true));
20 // workflow only applicable to owner company..
21 if ($au->company()->comptype != 'OWNER') {
22 $this->jerr("Core:NotifyAction: invalid user - not owner company.");
26 $this->authUser = $au;
27 // check that it's a supplier!!!!
35 $this->jerr("invalid request");
40 // needs: (Array of...)
42 // action(eg. APPROVAL)
43 // on_id (comma delimited.)
45 $n = DB_DataObject::factory('core_notify');
46 $n->person_id = $this->authUser->id;
47 // in theory in workflow, this could trigger another action...
48 // if watch is on it..
49 foreach(array('on_table','on_id','action') as $k) {
50 if (empty($_POST[$k])) {
51 $this->jerr("missing argument $k");
58 $ids = explode(',', $_POST['on_id']);
59 $n->whereAdd('sent < act_when'); // not issued yet..
60 $n->whereAdd("join_watch_id_id.medium = '". $n->escape($n->action) ."'");
61 $n->whereAddIn('core_notify.id', $ids, 'int' );
67 $nc->sent = date('Y-m-d H:i:s');