X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FCore_project.php;h=3611b98d60880944db8d01b6f59c359a802dd861;hp=20bc6198ee7865998a23275a1519ac903cf8b5e6;hb=HEAD;hpb=fb272020ac4f98a7b6f40069dd7f33b3a9ad4c67 diff --git a/DataObjects/Core_project.php b/DataObjects/Core_project.php index 20bc6198..5cc1f559 100644 --- a/DataObjects/Core_project.php +++ b/DataObjects/Core_project.php @@ -27,6 +27,8 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject public $languages; // string(128) not_null public $agency_id; // int(11) not_null public $updated_dt; // datetime(19) not_null binary + public $deleted_by; // INT + public $deleted_dt; // datetime(19) not_null binary /* the code above is auto generated do not remove the tag below */ @@ -89,7 +91,10 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject function applyFilters($q, $au, $roo) { - + if (empty($q['_show_deleted']) && empty($q['_is_update_request'])) { + $this->whereAdd('core_project.deleted_by = 0'); + } + $tn = $this->tableName(); if (!empty($q['query']['project_search'])) { $s = $this->escape($q['query']['project_search']); @@ -130,7 +135,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject //&& $au->hasPerm('Documents.Documents','S') << this is dependant on the doc modules - if (!$au->hasPerm('Core.Projects_All','S') ) { + if (php_sapi_name() != 'cli' && !$au->hasPerm('Core.Projects_All','S') ) { @@ -174,8 +179,22 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject } + + function beforeUpdate($old, $q, $roo) + { + if (!empty($q['_flag_deleted'])) { + //DB_DataObject::DebugLevel(1); + $this->deleted_by = $roo->getAuthUser()->id; + $this->deleted_dt = date("Y-m-d H:i:s"); + } + if (!empty($q['_flag_undeleted'])) { + $this->deleted_by = 0; + $this->deleted_dt = '1000-01-01 00:00:00'; + } + } + - function onInsert($request,$roo) + function onInsert($request,$roo,$event) { $oo = clone($this); if (empty($this->code)) { @@ -186,7 +205,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject } } - function onUpdate($old, $request, $roo) + function onUpdate($old, $request, $roo,$event) { $oo = clone($this); if (empty($this->code)) {