Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:导入case,不能导入到指定的module目录,只能导入到product根目录的问题。问题的解决,也适用于导入bug #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion protected/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ public function actionInfoImport()
{
$productId = $_REQUEST['product_id'];
$infoType = $_REQUEST['type'];
$productModuleId = $_REQUEST['productmodule_id'];
$error = "";
$msg = "";
$fileElementName = 'casefilename';
Expand All @@ -379,7 +380,7 @@ public function actionInfoImport()
}

$importService = new ImportService();
$msg = $importService->import($fileName, $productId, $infoType);
$msg = $importService->import($fileName, $productId, $infoType,$productModuleId);
echo json_encode(array('error' => '', 'msg' => $msg));
@unlink($_FILES[$fileElementName]);
}
Expand Down
6 changes: 3 additions & 3 deletions protected/service/ImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function basicInfoConv($basicInfo, $infoType)
}
else
{
$basicInfo['productmodule_id'] = 0;
//$basicInfo['productmodule_id'] = 0;
}
}
// hard code for id
Expand Down Expand Up @@ -208,7 +208,7 @@ private function getResultMsg($results)
* @param mixed $sheet file or string
* @param string $infoType
*/
public function import($sheet, $productId, $infoType)
public function import($sheet, $productId, $infoType,$productModuleId)
{
$sheetConv = new SheetConv();
$data = $sheetConv->xml2array($sheet);
Expand All @@ -222,7 +222,7 @@ public function import($sheet, $productId, $infoType)
foreach($items as $iidx => $item)
{
// hard code for product_id
$basicInfo = array('product_id' => $productId);
$basicInfo = array('product_id' => $productId, 'productmodule_id' => $productModuleId);
$customInfo = array();
$isEmpty = true;
foreach($item as $key => $val)
Expand Down
3 changes: 2 additions & 1 deletion themes/classic/views/info/_import_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<script type="text/javascript">
var $productId = <?php echo $productId; ?>;
var $infoType = '<?php echo $infoType; ?>';
var $productModuleId = <?php echo $productModuleId; ?>;
function ajaxFileUpload(){
$('#uploadbutton').attr('disabled','disable');
$("#loading").show();
Expand All @@ -11,7 +12,7 @@ function ajaxFileUpload(){
secureuri:false,
fileElementId:'casefilename',
dataType: 'json',
data:{product_id:$productId,type:$infoType},
data:{product_id:$productId,type:$infoType,productmodule_id:$productModuleId},
success: function (data, status)
{
$('#uploadbutton').removeAttr('disabled');
Expand Down
2 changes: 1 addition & 1 deletion themes/classic/views/info/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function caseBatchRun()
'defaultShowFieldOptionStr' => $defaultShowFieldOptionStr));
if((Info::TYPE_CASE == $infoType) || (Info::TYPE_BUG == $infoType))
{
echo $this->renderPartial('_import_info', array('productId' => $productId, 'infoType'=>$infoType));
echo $this->renderPartial('_import_info', array('productId' => $productId, 'infoType'=>$infoType, 'productModuleId' => $productModuleId));
}

if($showType == Info::SHOW_TYPE_GRID)
Expand Down