feedbackassignto.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * The feedback assignto entry point of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package entries
  9. * @version 1
  10. * @link https://www.zentao.net
  11. */
  12. class feedbackAssignToEntry extends entry
  13. {
  14. /**
  15. * GET method.
  16. *
  17. * @param int $feedbackID
  18. * @access public
  19. * @return string
  20. */
  21. public function get($feedbackID)
  22. {
  23. $control = $this->loadController('feedback', 'assignTo');
  24. $control->assignTo($feedbackID);
  25. $data = $this->getData();
  26. if(!$data) return $this->send400('error');
  27. if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
  28. return $this->send(200, $data);
  29. }
  30. /**
  31. * POST method.
  32. *
  33. * @param int $feedbackID
  34. * @access public
  35. * @return string
  36. */
  37. public function post($feedbackID)
  38. {
  39. $control = $this->loadController('feedback', 'assignTo');
  40. $feedback = $this->loadModel('feedback')->getById($feedbackID);
  41. $fields = 'assignedTo,comment,mailto';
  42. $this->batchSetPost($fields);
  43. $control->assignTo($feedbackID);
  44. $data = $this->getData();
  45. if(!$data) return $this->send400('error');
  46. if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
  47. $feedback = $this->loadModel('feedback')->getById($feedbackID);
  48. return $this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'));
  49. }
  50. }