From 083caabb8cedf3f71ddbdf06db33e48b075fe0e5 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 7 Oct 2021 09:34:14 +0800 Subject: [PATCH] Uncommited changes synced --- DataObjects/Core_project.php | 21 ++++++++++++++++++++- DataObjects/core.sql | 21 --------------------- DataObjects/pman.links.ini | 2 +- sql/core_project.sql | 11 ++++++++--- 4 files changed, 29 insertions(+), 26 deletions(-) delete mode 100644 DataObjects/core.sql diff --git a/DataObjects/Core_project.php b/DataObjects/Core_project.php index 3061770e..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']); @@ -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 index a0047eba..00000000 --- a/DataObjects/core.sql +++ /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; - - - - - - - --- ---------------------------- - diff --git a/DataObjects/pman.links.ini b/DataObjects/pman.links.ini index ec12fd76..8b29a404 100644 --- a/DataObjects/pman.links.ini +++ b/DataObjects/pman.links.ini @@ -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 diff --git a/sql/core_project.sql b/sql/core_project.sql index d4d0806f..8c9ef073 100644 --- a/sql/core_project.sql +++ b/sql/core_project.sql @@ -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 ''; -- 2.39.2