sync
[web.mtrack] / MTrackWeb / Ticket.php
index be4a56b..7170d20 100644 (file)
@@ -180,6 +180,38 @@ class MTrackWeb_Ticket extends MTrackWeb
         $this->issue->updated = $CS->id;
         $this->issue->update($old);
         
+        
+        
+        
+        if (!empty($_FILES['attachments'])) {
+            foreach ($_FILES['attachments']['name'] as $fileid => $name) {
+                $i = DB_DataObject::factory('Images');
+                $i->object($this->issue);
+                $i->ontable = $this->issue->tableName();
+                $i->onid = $this->issue->id;
+                $i->created_by = $this->authUser->id;
+                $i->mimetype = $_FILES['attachments']["type"][$fileid];
+                $i->createFrom($_FILES['attachments']['tmp_name'][$fileid],$_FILES['attachments']['name'][$fileid]);
+                
+                //    MTrackAttachment::add("ticket:{$this->issue->tid}",
+                //        $_FILES['attachments']['tmp_name'][$fileid],
+                //        $_FILES['attachments']['name'][$fileid],
+                //        $CS
+                //    );
+                //}
+            }
+        }
+        /*
+        if (!count($this->error) && $this->id != 'new') {
+            require_once 'MTrack/Attachment.php';
+            MTrackAttachment::process_delete("ticket:{$this->issue->tid}", $CS);
+        } 
+        */
+        
+        
+        
+        
+        
         $notify_query = "
                 (ontable='mtrack_ticket' and onid = {$this->issue->id})
                  OR
@@ -205,11 +237,13 @@ class MTrackWeb_Ticket extends MTrackWeb
             );
         //DB_DataObject::debugLevel(1);
         // who to notify..
-       
+        // who to notify.. -- originall did not send to issuer..
+        // we should probably make this configurable..
         $w->notify( 'mtrack_ticket' , $this->issue->id,
-                 " ( $notify_query )
+                    $notify_query 
+                /* " ( $notify_query )
                     AND
-                    (person_id != {$this->authUser->id})   "  
+                    (person_id != {$this->authUser->id})   "   */
         );
         
         
@@ -217,25 +251,7 @@ class MTrackWeb_Ticket extends MTrackWeb
         // if the owner has changed.. then we should add them to the watch list...
  
         // MTrackWatch::watch_object('ticket', $this->issue->tid,  $this->issue->owner);
-        /*         
-        if (!count($this->error)) {
-            if (!empty($_FILES['attachments'])) {
-                require_once 'MTrack/Attachment.php';
-                foreach ($_FILES['attachments']['name'] as $fileid => $name) {
-                      
-                    MTrackAttachment::add("ticket:{$this->issue->tid}",
-                        $_FILES['attachments']['tmp_name'][$fileid],
-                        $_FILES['attachments']['name'][$fileid],
-                        $CS
-                    );
-                }
-            }
-        }
-        if (!count($this->error) && $this->id != 'new') {
-            require_once 'MTrack/Attachment.php';
-            MTrackAttachment::process_delete("ticket:{$this->issue->tid}", $CS);
-        } 
-        */
+        
         $this->jok("OK");
         
     }
@@ -256,7 +272,7 @@ class MTrackWeb_Ticket extends MTrackWeb
         $pd = DB_DataObject::factory('ProjectDirectory');
         $pd->project_id = $this->currentProject();
         $pd->whereAdd("ProjectDirectory.role != ''");
-        $pd->joinAdd(DB_DataObject::factory('Person'), 'LEFT');
+        $pd->joinAdd(DB_DataObject::factory('core_person'), 'LEFT');
         $pd->selectAdd();
         $pd->selectAdd("distinct(Person.id) as id ,  CONCAT(Person.name , '<', Person.email , '>') as name");
         $pd->groupBy('Person.id, Person.name');