X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_company.php;h=70fbaf505f8a05b0beaec0f16456a31528e3e442;hb=c65b86d45c0dec593b719f756e9e269b568c7c29;hp=1682d44153efad1876a207a1beb5dec3bf14a612;hpb=b1929b126e27e4f99b93c78b3307b22a1c97a8a6;p=Pman.Core diff --git a/DataObjects/Core_company.php b/DataObjects/Core_company.php index 1682d441..70fbaf50 100644 --- a/DataObjects/Core_company.php +++ b/DataObjects/Core_company.php @@ -49,7 +49,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject $x = DB_DataObject::factory('core_company'); $x->comptype= 'OWNER'; $x->find(true); - + if (!empty($q['query']['company_project_id'])) { $add = ''; if (!empty($q['query']['company_include_self'])) { @@ -58,6 +58,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject if (!empty($q['query']['company_not_self'])) { $add = " AND {$tn}.id != {$x->id}"; } + $pids = array(); $pid = $q['query']['company_project_id']; if (strpos($pid, ',')) { @@ -103,8 +104,8 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject ) as comptype_display_name "); - if(!empty($q['search']['name'])){ - $s = $this->escape($q['search']['name']); + if(!empty($q['query']['name'])){ + $s = $this->escape($q['query']['name']); $this->whereAdd(" {$tn}.name LIKE '%$s%' "); @@ -122,7 +123,9 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject } // ---------- AUTHENTICATION - function isAuth() + // not sure where authetnication via company is used?? posibly media-outreach + + function isAuth() { $db = $this->getDatabaseConnection(); $sesPrefix = $db->dsn['database']; @@ -256,6 +259,17 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject function beforeUpdate($old, $q,$roo) { + echo $q['_flag_delete']; die; + if(!empty($q['_flag_delete'])){ + if($q['_flag_delete'] * 1 == 1){ + + $this->deleted_dt = $this->sqlValue("NOW()"); + $this->deleted_by = $roo->getAuthUser()->id; + } + + $this->deleted_dt = ""; + $this->deleted_by = 0; + } if(!empty($q['_check_name'])){ if($this->checkName()){ $roo->jok('OK'); @@ -277,12 +291,18 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject function beforeDelete($req, $roo) { + // should check for members.... if(!empty($this->is_system) && ($old->code != $this->code || $old->name != $this->name) ){ $roo->jerr('This company is not allow to delete'); } + + + } + function onDelete($req, $roo) + { $img = DB_DataObject::factory('Images'); $img->ontable = $this->tableName(); $img->onid = $this->id; @@ -447,7 +467,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject { $affects = array(); - $all_links = $x->databaseLinks(); + $all_links = $this->databaseLinks(); foreach($all_links as $tbl => $links) { foreach($links as $col => $totbl_col) {