* - onUpload($roo)
* - setFromRoo($ar) - values from post (deal with dates etc.) - return true|error string.
*
- * - toEventString (for logging)
+ * - toEventString (for logging - this is generically prefixed to all database operations.)
*/
class Pman_Roo extends Pman
if (method_exists($x, 'onInsert')) {
$x->onInsert($_REQUEST, $this);
}
- $this->addEvent("ADD", $x, $x->toEventString());
+ $this->addEvent("ADD", $x);
// note setFrom might handle this before hand...!??!
if (!empty($_FILES) && method_exists($x, 'onUpload')) {
$this->jerr("PERMISSION DENIED");
}
+ // check any locks..
+ // only done if we recieve a lock_id.
+ // we are very trusing here.. that someone has not messed around with locks..
+ // the object might want to check in their checkPerm - if locking is essential..
+
+ $lock = DB_DataObjecT::factory('Core_locking');
+ if (is_a($lock,'DB_DataObject')) {
+
+ $lock->on_id = $x->id;
+ $lock->on_table= $x->tableName();
+ if (!empty($_REQUEST['_lock_id'])) {
+ $lock->whereAdd('id != ' . ((int)$_REQUEST['_lock_id']));
+ }
+ $lock->limit(1);
+ if ($lock->find(true)) {
+ // it's locked by someone else..
+ $p = $lock->person();
+ $this->jerr("Your lock is invalid, This record is locked by " . $p->name . " at " .$lock->created);
+ }
+ // check the users lock.. - no point.. ??? - if there are no other locks and it's not the users, then they can
+ // edit it anyways...
+
+ }
+
+
+
+
+
+
$_columns = !empty($req['_columns']) ? explode(',', $req['_columns']) : false;
} else {
$x->setFrom($req);
}
- $this->addEvent("EDIT", $x, $x->toEventString());
+ $this->addEvent("EDIT", $x);
//print_r($x);
//print_r($old);
}
// finally log it..
- $this->addEvent("DELETE", $x, $x->toEventString());
+ $this->addEvent("DELETE", $x);
$xx->delete();
}