tao.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * The tao file of design module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Shujie Tian <tianshujie@easycorp.ltd>
  8. * @package design
  9. * @link https://www.zentao.net
  10. */
  11. class designTao extends designModel
  12. {
  13. /**
  14. * 更新设计关联的代码提交记录。
  15. * Update the commit logs linked with the design.
  16. *
  17. * @param int $designID
  18. * @param int $repoID
  19. * @param array $revisions
  20. * @access protected
  21. * @return bool
  22. */
  23. protected function updateLinkedCommits($designID, $repoID, $revisions = array())
  24. {
  25. if(!$designID || !$repoID || empty($revisions)) return true;
  26. $design = $this->dao->select('project,product')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetch();
  27. if(!$design) return true;
  28. foreach($revisions as $revision)
  29. {
  30. $data = new stdclass();
  31. $data->project = $design->project;
  32. $data->product = $design->product;
  33. $data->AType = 'design';
  34. $data->AID = $designID;
  35. $data->BType = 'commit';
  36. $data->BID = $revision;
  37. $data->relation = 'completedin';
  38. $data->extra = $repoID;
  39. $this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
  40. $data->AType = 'commit';
  41. $data->AID = $revision;
  42. $data->BType = 'design';
  43. $data->BID = $designID;
  44. $data->relation = 'completedfrom';
  45. $this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
  46. }
  47. return !dao::isError();
  48. }
  49. }