Merge pull request '* Optimize codes.' (#36) from daitingting_bug_fix into master
Reviewed-on: https://git.zcorp.cc/easycorp/zentaopms/pulls/36
This commit is contained in:
@@ -680,7 +680,7 @@ class bug extends control
|
||||
if(!$comment)
|
||||
{
|
||||
$changes = $this->bug->update($bug, $oldBug);
|
||||
if(!$changes) return $this->send($this->bugZen->errorEdit());
|
||||
if($changes === false) return $this->send($this->bugZen->errorEdit());
|
||||
}
|
||||
|
||||
$this->bugZen->processAfterEdit($bugID, $this->post->comment, $changes);
|
||||
|
||||
+2
-2
@@ -222,13 +222,13 @@ class bugTao extends bugModel
|
||||
* 更新相关bug。
|
||||
* Update the linked bug.
|
||||
*
|
||||
* @param int $bugID
|
||||
* @param string $bugID
|
||||
* @param string $linkBug
|
||||
* @param string $oldLinkBug
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
protected function updateLinkBug(int $bugID, string $linkBug, string $oldLinkBug): bool
|
||||
protected function updateLinkBug(string $bugID, string $linkBug, string $oldLinkBug): bool
|
||||
{
|
||||
$linkBugs = explode(',', $linkBug);
|
||||
$oldLinkBugs = explode(',', $oldLinkBug);
|
||||
|
||||
@@ -2156,7 +2156,10 @@ class bugTest
|
||||
$allRelatedLinkBugs = array_merge($addedLinkBugs, $removedLinkBugs, array($bugID));
|
||||
|
||||
global $tester;
|
||||
$linkBugPairs = $tester->dao->select('id,linkBug')->from(TABLE_BUG)->where('id')->in(array_filter($allRelatedLinkBugs))->andWhere('deleted')->eq('0')->fetchPairs();
|
||||
$linkBugPairs = $tester->dao->select('id, linkBug')->from(TABLE_BUG)
|
||||
->where('id')->in(array_filter($allRelatedLinkBugs))
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetchPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $linkBugPairs;
|
||||
|
||||
@@ -44,10 +44,10 @@ cid=1
|
||||
|
||||
initData();
|
||||
|
||||
$bugIDList = array(1, 2, 3);
|
||||
$bugIDList = array('1', '2', '3');
|
||||
|
||||
$bug = new bugTest();
|
||||
r($bug->updateLinkBugTest($bugIDList[0], '2', '')) && p('2', ';') && e('1'); //测试关联bug2的关联bug同步更新为1
|
||||
r($bug->updateLinkBugTest($bugIDList[0], '3', '2')) && p('2;3', ';') && e('~~;1'); //测试关联bug2的关联bug同步更新为空,bug3的关联bug为1
|
||||
r($bug->updateLinkBugTest($bugIDList[0], '2,3', '3')) && p('2') && e('1'); //测试关联bug2的关联bug同步更新为1
|
||||
r($bug->updateLinkBugTest($bugIDList[1], '1,3', '1')) && p('3', ';') && e('1,2'); //测试关联bug3的关联bug同步更新为1,2
|
||||
r($bug->updateLinkBugTest($bugIDList[1], '1,3', '1')) && p('3', ';') && e('1,2'); //测试关联bug3的关联bug同步更新为1,2
|
||||
|
||||
@@ -1183,7 +1183,7 @@ class fileModel extends model
|
||||
*/
|
||||
public function processFile4Object($objectType, $oldObject, $newObject, $extra = '', $filesName = 'files', $labelsName = 'labels')
|
||||
{
|
||||
$oldFiles = empty($oldObject->files) ? '' : join(',', array_keys($oldObject->files));
|
||||
$oldFiles = empty($oldObject->files) ? '' : implode(',', array_keys($oldObject->files));
|
||||
$deleteFiles = $newObject->deleteFiles;
|
||||
if(!empty($deleteFiles))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user