Ejemplo n.º 1
1
 /**
  * @return bool
  */
 public function afterSave()
 {
     $new_thread = $this->object->get('thread');
     if ($this->old_thread != $new_thread) {
         $this->object->changeThread($this->old_thread, $new_thread);
     } else {
         $this->object->clearTicketCache();
     }
     return parent::afterSave();
 }
Ejemplo n.º 2
0
 /**
  * @return bool
  */
 public function afterSave()
 {
     if ($this->object->get('published')) {
         $this->thread->fromArray(array('comment_last' => $this->object->get('id'), 'comment_time' => $this->object->get('createdon')));
         $this->thread->save();
     }
     if ($this->guest) {
         if (!isset($_SESSION['TicketComments'])) {
             $_SESSION['TicketComments'] = array('ids' => array());
         }
         $_SESSION['TicketComments']['name'] = $this->object->get('name');
         $_SESSION['TicketComments']['email'] = $this->object->get('email');
         $_SESSION['TicketComments']['ids'][$this->object->get('id')] = 1;
     }
     $this->thread->updateCommentsCount();
     $this->object->clearTicketCache();
     return parent::afterSave();
 }
Ejemplo n.º 3
0
 public function assignResource($comment)
 {
     if (is_numeric($comment)) {
         $comment = TicketComment::findOrFail($comment);
     }
     if ($comment->link == '' || $this->id != $comment->ticket_id) {
         abort(404);
     }
     $this->link = $comment->link;
     $this->status = 'closed';
     $this->save();
     $this->comments()->where('selected', true)->update(['selected' => false]);
     $comment->selected = true;
     $comment->save();
 }
Ejemplo n.º 4
0
 public function comments()
 {
     //return $this->hasMany(TicketComment::class); //php > 5.4
     return $this->hasMany(TicketComment::getClass());
     //php <= 5.4 create Model Entity
 }
Ejemplo n.º 5
0
 /**
  *
  */
 public function logManagerAction()
 {
     $this->modx->logManagerAction($this->objectType . '_undelete', $this->classKey, $this->object->get($this->primaryKeyField));
 }
Ejemplo n.º 6
0
 public function comments()
 {
     return $this->hasMany(TicketComment::getClass());
 }
Ejemplo n.º 7
0
 /**
  * @param string $action
  */
 public function logManagerAction($action = '')
 {
     $this->modx->logManagerAction($this->objectType . '_unpublish', $this->classKey, $this->object->get($this->primaryKeyField));
 }
Ejemplo n.º 8
0
 /**
  * @return bool
  */
 public function afterSave()
 {
     $this->object->clearTicketCache();
     return parent::afterSave();
 }