Uncommited changes synced
authorAlan <alan@roojs.com>
Thu, 7 Oct 2021 01:34:14 +0000 (09:34 +0800)
committerAlan <alan@roojs.com>
Thu, 7 Oct 2021 01:34:14 +0000 (09:34 +0800)
DataObjects/Core_project.php
DataObjects/core.sql [deleted file]
DataObjects/pman.links.ini
sql/core_project.sql

index 3061770..5cc1f55 100644 (file)
@@ -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']);
@@ -174,6 +179,20 @@ 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,$event)
     {
diff --git a/DataObjects/core.sql b/DataObjects/core.sql
deleted file mode 100644 (file)
index a0047eb..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
--- file is not really used any more..
-
-
--- // core comapy types - use core enums (Company Type)
-DROP TABLE IF EXISTS core_company_type;
-
--- // old core image type - merged into enum.
-DROP TABLE IF EXISTS core_image_type;
-
-
-
-                       
-        
-    
--- ----------------------------
-
index ec12fd7..8b29a40 100644 (file)
@@ -34,7 +34,7 @@ agency_id = core_company:id
 team_id = core_group:id
 open_by = core_person:id
 owner_id = core_person:id
-
+deleted_by = core_person:id
 
 [core_group]
 leader = core_person:id
index d4d0806..8c9ef07 100644 (file)
@@ -16,9 +16,14 @@ ALTER TABLE  core_project  ADD COLUMN   type varchar(1)  NOT NULL default 'P';
 ALTER TABLE  core_project  ADD COLUMN   client_id int(11) NOT NULL default '0';
 ALTER TABLE  core_project  ADD COLUMN   team_id int(11) NOT NULL default '0';
 ALTER TABLE  core_project  ADD COLUMN file_location varchar(254)    NOT NULL default '';
-ALTER TABLE  core_project  ADD COLUMN open_date date default NULL;
-ALTER TABLE  core_project  ADD COLUMN open_by int(11) NOT NULL default '0';
-ALTER TABLE  core_project  ADD COLUMN updated_dt DATETIME NOT NULL;
+ALTER TABLE  core_project  ADD COLUMN open_date date NOT NULL DEFAULT '1000-01-01';
+ALTER TABLE  core_project  ADD COLUMN open_by int(11) NOT NULL default 0;
+
+ALTER TABLE  core_project  ADD COLUMN updated_dt DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00';
+ALTER TABLE  core_project  ADD COLUMN deleted_by INT NOT NULL DEFAULT 0;
+ALTER TABLE  core_project  ADD COLUMN deleted_dt DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00';
+
+
 
 -- these should be removed, as they are code specific..
 ALTER TABLE core_project ADD COLUMN countries varchar(128)  NOT NULL DEFAULT '';