* add insert param for cover or insert exist data.

This commit is contained in:
wangyidong
2020-05-29 10:08:11 +08:00
parent 7a9cc4070a
commit 91de6e934c
4 changed files with 51 additions and 43 deletions
+17 -15
View File
@@ -557,13 +557,14 @@ class caselib extends control
/**
* Show import case.
*
* @param int $libID
* @param int $pagerID
* @param int $maxImport
* @param int $libID
* @param int $pagerID
* @param int $maxImport
* @param string|int $insert 0 is covered old, 1 is insert new.
* @access public
* @return void
*/
public function showImport($libID, $pagerID = 1, $maxImport = 0)
public function showImport($libID, $pagerID = 1, $maxImport = 0, $insert = '')
{
$this->loadModel('testcase');
@@ -581,7 +582,7 @@ class caselib extends control
}
else
{
die(js::locate(inlink('showImport', "libID=$libID&pagerID=" . ($this->post->pagerID + 1) . "&maxImport=$maxImport"), 'parent'));
die(js::locate(inlink('showImport', "libID=$libID&pagerID=" . ($this->post->pagerID + 1) . "&maxImport=$maxImport&insert=" . zget($_POST, 'insert', '')), 'parent'));
}
}
@@ -775,16 +776,17 @@ class caselib extends control
$this->view->title = $this->lang->caselib->common . $this->lang->colon . $this->lang->testcase->showImport;
$this->view->position[] = $this->lang->testcase->showImport;
$this->view->modules = $modules;
$this->view->cases = $this->dao->select('id,module,stage,status,pri,type')->from(TABLE_CASE)->where('lib')->eq($libID)->andWhere('deleted')->eq(0)->andWhere('product')->eq(0)->fetchAll('id');
$this->view->caseData = $caseData;
$this->view->stepData = $stepData;
$this->view->libID = $libID;
$this->view->isEndPage = $pagerID >= $allPager;
$this->view->allCount = $allCount;
$this->view->allPager = $allPager;
$this->view->pagerID = $pagerID;
$this->view->maxImport = $maxImport;
$this->view->modules = $modules;
$this->view->cases = $this->dao->select('id,module,stage,status,pri,type')->from(TABLE_CASE)->where('lib')->eq($libID)->andWhere('deleted')->eq(0)->andWhere('product')->eq(0)->fetchAll('id');
$this->view->caseData = $caseData;
$this->view->stepData = $stepData;
$this->view->libID = $libID;
$this->view->isEndPage = $pagerID >= $allPager;
$this->view->allCount = $allCount;
$this->view->allPager = $allPager;
$this->view->pagerID = $pagerID;
$this->view->maxImport = $maxImport;
$this->view->dataInsert = $insert;
$this->display();
}
}
+6 -4
View File
@@ -100,13 +100,15 @@ $(function()
<tr>
<td colspan='9' class='text-center form-actions'>
<?php
if(!$insert)
$submitText = $isEndPage ? $this->lang->save : $this->lang->file->saveAndNext;
if(!$insert and $dataInsert === '')
{
echo "<button type='button' data-toggle='modal' data-target='#importNoticeModal' class='btn btn-primary btn-wide'>{$lang->save}</button>";
echo "<button type='button' data-toggle='modal' data-target='#importNoticeModal' class='btn btn-primary btn-wide'>{$submitText}</button>";
}
else
{
echo html::submitButton($isEndPage ? $this->lang->save : $this->lang->file->saveAndNext);
echo html::submitButton($submitText);
if($dataInsert !== '') echo html::hidden('insert', $dataInsert);
echo html::hidden('isEndPage', $isEndPage ? 1 : 0);
echo html::hidden('pagerID', $pagerID);
}
@@ -117,7 +119,7 @@ $(function()
</tr>
</tfoot>
</table>
<?php if(!$insert) include '../../common/view/noticeimport.html.php';?>
<?php if(!$insert and $dataInsert === '') include '../../common/view/noticeimport.html.php';?>
</form>
</div>
<?php endif;?>
+22 -20
View File
@@ -1500,14 +1500,15 @@ class testcase extends control
/**
* Show import data
*
* @param int $productID
* @param int $branch
* @param int $pagerID
* @param int $maxImport
* @param int $productID
* @param int $branch
* @param int $pagerID
* @param int $maxImport
* @param string|int $insert 0 is covered old, 1 is insert new.
* @access public
* @return void
*/
public function showImport($productID, $branch = 0, $pagerID = 1, $maxImport = 0)
public function showImport($productID, $branch = 0, $pagerID = 1, $maxImport = 0, $insert = '')
{
$file = $this->session->fileImport;
$tmpPath = $this->loadModel('file')->getPathOfImportedFile();
@@ -1523,7 +1524,7 @@ class testcase extends control
}
else
{
die(js::locate(inlink('showImport', "productID=$productID&branch=$branch&pagerID=" . ($this->post->pagerID + 1) . "&maxImport=$maxImport"), 'parent'));
die(js::locate(inlink('showImport', "productID=$productID&branch=$branch&pagerID=" . ($this->post->pagerID + 1) . "&maxImport=$maxImport&insert=" . zget($_POST, 'insert', '')), 'parent'));
}
}
@@ -1706,20 +1707,21 @@ class testcase extends control
$this->view->title = $this->lang->testcase->common . $this->lang->colon . $this->lang->testcase->showImport;
$this->view->position[] = $this->lang->testcase->showImport;
$this->view->stories = $stories;
$this->view->modules = $modules;
$this->view->cases = $this->dao->select('id, module, story, stage, status, pri, type')->from(TABLE_CASE)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->fetchAll('id');
$this->view->caseData = $caseData;
$this->view->stepData = $stepData;
$this->view->productID = $productID;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->isEndPage = $pagerID >= $allPager;
$this->view->allCount = $allCount;
$this->view->allPager = $allPager;
$this->view->pagerID = $pagerID;
$this->view->branch = $branch;
$this->view->product = $this->products[$productID];
$this->view->maxImport = $maxImport;
$this->view->stories = $stories;
$this->view->modules = $modules;
$this->view->cases = $this->dao->select('id, module, story, stage, status, pri, type')->from(TABLE_CASE)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->fetchAll('id');
$this->view->caseData = $caseData;
$this->view->stepData = $stepData;
$this->view->productID = $productID;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->isEndPage = $pagerID >= $allPager;
$this->view->allCount = $allCount;
$this->view->allPager = $allPager;
$this->view->pagerID = $pagerID;
$this->view->branch = $branch;
$this->view->product = $this->products[$productID];
$this->view->maxImport = $maxImport;
$this->view->dataInsert = $insert;
$this->display();
}
+6 -4
View File
@@ -125,13 +125,15 @@ $(function()
<tr>
<td colspan='10' class='text-center form-actions'>
<?php
if(!$insert)
$submitText = $isEndPage ? $this->lang->save : $this->lang->file->saveAndNext;
if(!$insert and $dataInsert === '')
{
echo "<button type='button' data-toggle='modal' data-target='#importNoticeModal' class='btn btn-primary btn-wide'>{$lang->save}</button>";
echo "<button type='button' data-toggle='modal' data-target='#importNoticeModal' class='btn btn-primary btn-wide'>{$submitText}</button>";
}
else
{
echo html::submitButton($isEndPage ? $this->lang->save : $this->lang->file->saveAndNext);
echo html::submitButton($submitText);
if($dataInsert !== '') echo html::hidden('insert', $dataInsert);
echo html::hidden('isEndPage', $isEndPage ? 1 : 0);
echo html::hidden('pagerID', $pagerID);
}
@@ -142,7 +144,7 @@ $(function()
</tr>
</tfoot>
</table>
<?php if(!$insert) include '../../common/view/noticeimport.html.php';?>
<?php if(!$insert and $dataInsert === '') include '../../common/view/noticeimport.html.php';?>
</form>
</div>
<?php endif;?>