X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_company.php;h=a5b5169664e7016ac87f057e9467ab9879cb0486;hb=ef46d9bc89c79c44436dae90698ae73f1a2dac4b;hp=13d3a72987e96504651e478c0b20bc936b7aceef;hpb=049bee5b373990a090bf841bb011e116af4cc41a;p=Pman.Core diff --git a/DataObjects/Core_company.php b/DataObjects/Core_company.php index 13d3a729..a5b51696 100644 --- a/DataObjects/Core_company.php +++ b/DataObjects/Core_company.php @@ -82,10 +82,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject $this->whereAddIn('comptype', explode(',', $q['query']['comptype']), 'string'); } - /*if (!empty($q['query']['deleted_by'])) { - $deleted_by = $this->escape($q['query']['deleted_by']); - $this->whereAdd("deleted_by = '$deleted_by'"); - }*/ + // depricated - should be moved to module specific (texon afair) if (!empty($q['query']['province'])) { @@ -262,16 +259,15 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject function beforeUpdate($old, $q,$roo) { - var_dump($roo); exit; + if(!empty($q['_flag_delete']) && $q['_flag_delete'] * 1 == 1){ - //$delete_dt = date('Y-m-d H:i:s'); - $this->deleted_dt = date('Y-m-d H:i:s'); - $this->deleted_by = $roo->getAuthUser(); - $this->id = $q['_ids']; - var_dump($this); die; - $this->update(); - //$roo->query("UPDATE {$old->tableName()} SET deleted_by = {$roo->getAuthUser()} , deleted_dt = {$delete_dt} WHERE id = {$req['_update_id']}"); - //$this->addEvent("UPDATE", false, "update core_company record"); + $this->deleted_dt = $this->sqlValue("NOW()"); + $this->deleted_by = $roo->getAuthUser()->id; + } + + if(!empty($q['_flag_undelete']) && $q['_flag_undelete'] * 1 == 1){ + $this->deleted_dt = ""; + $this->deleted_by = 0; } if(!empty($q['_check_name'])){ if($this->checkName()){ @@ -329,7 +325,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject return true; } - + print_r($au->company()->comptype);exit; if ($au->company()->comptype != 'OWNER') {