Fix #6032 - change the release index page to plain html
[Pman.Core] / DataObjects / Core_company.php
index abc1506..aca5be8 100644 (file)
@@ -12,7 +12,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject
     public $__table = 'core_company';                       // table name
     public $code;                            // string(32)  not_null
     public $name;                            // string(128)  
-    public $remarks;                         // blob(65535)  blob
+    public $remarks;                         // blob(65535)  blobeforeDeleteb
     public $owner_id;                        // int(11)  not_null
     public $address;                         // blob(65535)  blob
     public $tel;                             // string(32)  
@@ -255,6 +255,18 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject
     {
         // we still use comptype in some old systems...
         
+        if(!empty($q['comptype']) && empty($q['comptype_id'])) {
+            $en = DB_DataObject::Factory('core_enum');
+            $en->setFrom(array(
+                'etype' => 'COMPTYPE',
+                'name' => $q['comptype'],
+                'active' => 1
+            ));
+            if($en->find(true)) {
+                $this->comptype_id = $en->id;
+            }
+        }
+        
         if (!empty($q['comptype_id'])) {
             $en = DB_DataObject::Factory('core_enum');
             $en->get($q['comptype_id']);
@@ -274,13 +286,24 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject
     {
         // we still use comptype in some old systems...
         
+        if(!empty($q['comptype']) && empty($q['comptype_id'])) {
+            $en = DB_DataObject::Factory('core_enum');
+            $en->setFrom(array(
+                'etype' => 'COMPTYPE',
+                'name' => $q['comptype'],
+                'active' => 1
+            ));
+            if($en->find(true)) {
+                $this->comptype_id = $en->id;
+            }
+        }
+        
         if (!empty($q['comptype_id'])) {
             $en = DB_DataObject::Factory('core_enum');
             $en->get($q['comptype_id']);
             $this->comptype = $en->name;
         }
         
-        
         if(!empty($q['_flag_delete'])){
             $this->deleted_dt = $this->sqlValue("NOW()");
             $this->deleted_by = $roo->getAuthUser()->id;
@@ -328,7 +351,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject
         $img->onid = $this->id;
         $img->find();
         while ($img->fetch()) {
-            $img->beforeDelete();
+            $img->beforeDelete(array(), $roo);
             $img->delete();
         }
         return true;