Skip to content

Commit

Permalink
Fixed issue #09758: Selecting to show last 50 responses does not show…
Browse files Browse the repository at this point in the history
… the last 50 responses anymore

Fixed issue : unable to delete multiple response in some condition
Dev: get the default order/page and rowNum by query ($_GET no $_POST)
Dev: delete response only if request is post for CRSF
Dev: deleteByPk must work with array or pseudo array, but sometimes it don't work ???
Dev: Fix Timing delete var : iResponseID to iResponseId
  • Loading branch information
Shnoulle committed Jul 17, 2015
1 parent 45316f0 commit ec59767
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
18 changes: 12 additions & 6 deletions application/controllers/admin/responses.php
Expand Up @@ -568,6 +568,9 @@ function browse($iSurveyId)
else
$column_names[] = $column['name'];
}
$aData['sortorder']= Yii::app()->request->getQuery('order', 'asc');
$aData['limit']= Yii::app()->request->getQuery('limit', 25);
$aData['page']= intval(Yii::app()->request->getQuery('start', 0))+1;

$aData['issuperadmin'] = Permission::model()->hasGlobalPermission('superadmin');
$aData['surveyid']= $iSurveyId;
Expand Down Expand Up @@ -829,13 +832,16 @@ public function actionResponses($iSurveyId)
*/
public function actionDelete($iSurveyId,$sResponseId)
{
if(Permission::model()->hasSurveyPermission($iSurveyId,'responses','delete'))
if(Permission::model()->hasSurveyPermission($iSurveyId,'responses','delete') && App()->request->isPostRequest)
{
$oSurvey=Survey::model()->findByPk($iSurveyId);
//SurveyDynamic::model($iSurveyId)->deleteByPk($sResponseId);
Response::model($iSurveyId)->findByPk($sResponseId)->delete(true);
if($oSurvey->savetimings == "Y"){// TODO : add it to response delete (maybe test if timing table exist)
SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID);
$aResponseId=explode(",",$sResponseId); // deleteByPk lust work with array, but seems don't work ? Maybe before delete broke this ?column_model_txt
foreach($aResponseId as $iResponseId)
{
Response::model($iSurveyId)->findByPk($iResponseId)->delete(true);
$oSurvey=Survey::model()->findByPk($iSurveyId);
if($oSurvey->savetimings == "Y"){// TODO : add it to response delete (maybe test if timing table exist)
SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseId);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions application/views/admin/responses/listResponses_view.php
Expand Up @@ -44,6 +44,10 @@

var colNames = <?php echo $column_names_txt; ?>;
var colModels = <?php echo $column_model_txt; ?>;
var sortorder = '<?php echo $sortorder; ?>';
var rows = '<?php echo $limit; ?>';
var page = '<?php echo $page; ?>';

<?php if($hasUpload) { ?>
var sDownLoad='<?php eT("Download files"); ?>' ;
var sDownLoadMarked='<?php eT("Download marked files"); ?>' ;
Expand Down
5 changes: 3 additions & 2 deletions scripts/admin/listresponse.js
Expand Up @@ -59,13 +59,14 @@ $(function() {
height : "100%",
//shrinkToFit : false,
ignoreCase : true,
rowNum : 25,
rowNum : rows,
page : page,
editable : false,
scrollOffset : 0,
sortable : true,
hidegrid : false,
sortname : 'id',
sortorder : 'asc',
sortorder : sortorder,
viewrecords : true,
rowList : [ 25, 50, 100, 250, 500, 1000 ],
multiselect : true,
Expand Down

0 comments on commit ec59767

Please sign in to comment.