From 06ed61a897d3da58fd83d359922a0b7329f8c464 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Wed, 2 Nov 2022 10:56:38 +0800 Subject: [PATCH] * Fix code format. --- module/story/control.php | 8 ++++++-- module/story/lang/de.php | 2 +- module/story/lang/en.php | 2 +- module/story/lang/fr.php | 2 +- module/story/lang/zh-cn.php | 4 ++-- module/story/view/blocksibling.html.php | 10 +++------- module/story/view/view.html.php | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 4e5fecc46e..7a08d976e1 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2761,8 +2761,12 @@ class story extends control /* If siblings == ,$siblingID, update siblings empty.*/ if(count(explode(',', $siblings)) == 3) $siblings = ''; - $this->dao->update(TABLE_STORY)->set('siblings')->eq('')->where('id')->eq($siblingID)->exec(); - $this->dao->update(TABLE_STORY)->set('siblings')->eq($siblings)->where('siblings')->like("%,{$_POST['siblingID']},%")->exec(); + /* batchUnset siblingID from siblings.*/ + $replaceSql = "UPDATE " . TABLE_STORY . " SET siblings = REPLACE(siblings,',$siblingID,', ',') WHERE `product` = $story->product"; + $this->dbh->exec($replaceSql); + + /* Update siblings to empty by siblingID and if siblings eq ','.*/ + $this->dao->update(TABLE_STORY)->set('siblings')->eq('')->where('id')->eq($siblingID)->orWhere('siblings')->eq(',')->exec(); if(!dao::isError()) $this->loadModel('action')->create('story', $siblingID, 'relieved'); return $this->send(array('result' => 'success', 'data' => $siblings)); diff --git a/module/story/lang/de.php b/module/story/lang/de.php index de1ebb2556..be560952bc 100644 --- a/module/story/lang/de.php +++ b/module/story/lang/de.php @@ -77,7 +77,7 @@ $lang->story->order = 'Order'; $lang->story->saveDraft = 'Save as draft'; $lang->story->doNotSubmit = 'Do Not Submit'; $lang->story->currentBranch = 'Current Branch'; -$lang->story->sibling = 'Sibling story'; +$lang->story->siblings = 'Siblings story'; $lang->story->relieved = 'Relieved'; $lang->story->relievedSiblings = 'Relieved Siblings'; diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 7f28579a1e..f7b2b4d744 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -77,7 +77,7 @@ $lang->story->order = 'Order'; $lang->story->saveDraft = 'Save as draft'; $lang->story->doNotSubmit = 'Do Not Submit'; $lang->story->currentBranch = 'Current Branch'; -$lang->story->sibling = 'Sibling story'; +$lang->story->siblings = 'Siblings story'; $lang->story->relieved = 'Relieved'; $lang->story->relievedSiblings = 'Relieved Siblings'; diff --git a/module/story/lang/fr.php b/module/story/lang/fr.php index 33b853b0cd..ac081b4e8e 100644 --- a/module/story/lang/fr.php +++ b/module/story/lang/fr.php @@ -77,7 +77,7 @@ $lang->story->order = 'Order'; $lang->story->saveDraft = 'Save as draft'; $lang->story->doNotSubmit = 'Do Not Submit'; $lang->story->currentBranch = 'Current Branch'; -$lang->story->sibling = 'Sibling story'; +$lang->story->siblings = 'Siblings story'; $lang->story->relieved = 'Relieved'; $lang->story->relievedSiblings = 'Relieved Siblings'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index ee7ba98a8f..8a9a05cea1 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -76,8 +76,8 @@ $lang->story->undetermined = '待定'; $lang->story->order = '排序'; $lang->story->saveDraft = '存为草稿'; $lang->story->doNotSubmit = '保存暂不提交'; -$lang->story->currentBranch = '当前分支'; -$lang->story->sibling = '孪生需求'; +$lang->story->currentBranch = '当前%s'; +$lang->story->siblings = '孪生需求'; $lang->story->relieved = '解除'; $lang->story->relievedSiblings = '解除孪生需求'; diff --git a/module/story/view/blocksibling.html.php b/module/story/view/blocksibling.html.php index 2e8de96107..1a5c23843f 100644 --- a/module/story/view/blocksibling.html.php +++ b/module/story/view/blocksibling.html.php @@ -1,18 +1,14 @@ story->currentBranch = sprintf($this->lang->story->currentBranch, $this->lang->product->branchName[$product->type]); js::set('relieveURL', inlink('ajaxRelieveSibling')); js::set('storyID', $story->id); js::set('relieved', $lang->story->relieved); js::set('relievedTip', $lang->story->relievedTip); js::set('cancel', $lang->cancel); + $canViewLinkStory = common::hasPriv('story', 'view'); $canRelieved = common::hasPriv('story', 'relieved'); - -foreach($siblings as $id => $sibling) -{ - if($story->branch == $sibling->branch) continue; - unset($siblings[$id]); - $siblings[] = $sibling; -} +array_unshift($siblings, $story); foreach($siblings as $sibling) { diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index db46505375..1100bbf7c9 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -402,7 +402,7 @@