Skip to content

Commit

Permalink
Dev Fixed issue with deleting dependent records inside a transaction.
Browse files Browse the repository at this point in the history
Dev Removed unused files.
  • Loading branch information
SamMousa committed Jun 30, 2015
1 parent 89aace1 commit ac87009
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 192 deletions.
16 changes: 12 additions & 4 deletions application/controllers/admin/dataentry.php
Expand Up @@ -786,7 +786,9 @@ public function editdata($subaction, $id, $surveyid, $language='')
}

$oquery="SELECT other FROM {{questions}} WHERE qid={$fname['qid']} AND {{questions}}.language = '{$sDataEntryLanguage}'";
$oresult=dbExecuteAssoc($oquery) or throw new \CHttpException(500, "Couldn't get other for list question<br />".$oquery."<br />");
if (false === $oresult = dbExecuteAssoc($oquery)) {
throw new \CHttpException(500, "Couldn't get other for list question<br />".$oquery."<br />");
}
foreach($oresult->readAll() as $orow)
{
$fother=$orow['other'];
Expand Down Expand Up @@ -1454,7 +1456,9 @@ public function update()
$updateqr = substr($updateqr, 0, -3);
$updateqr .= " WHERE id=$id";

$updateres = dbExecuteAssoc($updateqr) or throw new \CHttpException(500, "Update failed:<br />\n<br />$updateqr");
if (false === $updateres = dbExecuteAssoc($updateqr)) {
throw new \CHttpException(500, "Update failed:<br />\n<br />$updateqr");
}

$onerecord_link = $this->getController()->createUrl('/admin/responses/sa/view/surveyid/'.$surveyid.'/id/'.$id);
$allrecords_link = $this->getController()->createUrl('/admin/responses/sa/index/surveyid/'.$surveyid);
Expand Down Expand Up @@ -2000,7 +2004,9 @@ public function view($surveyid, $lang=NULL)
$cdata['dearesult'] = $dearesult->readAll();

$oquery="SELECT other FROM {{questions}} WHERE qid={$deqrow['qid']} AND language='{$baselang}'";
$oresult=dbExecuteAssoc($oquery) or throw new \CHttpException(500, "Couldn't get other for list question<br />".$oquery);
if (false === $oresult = dbExecuteAssoc($oquery)) {
throw new \CHttpException(500, "Couldn't get other for list question<br />" . $oquery);
}
foreach($oresult->readAll() as $orow)
{
$cdata['fother']=$orow['other'];
Expand Down Expand Up @@ -2070,7 +2076,9 @@ public function view($surveyid, $lang=NULL)
}

$oquery="SELECT other FROM {{questions}} WHERE qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}'";
$oresult=dbExecuteAssoc($oquery) or throw new \CHttpException(500, "Couldn't get other for list question<br />");
if (false === $oresult=dbExecuteAssoc($oquery)) {
throw new \CHttpException(500, "Couldn't get other for list question<br />");
}
foreach($oresult->readAll() as $orow)
{
$fother=$orow['other'];
Expand Down
34 changes: 0 additions & 34 deletions application/errors/error_404.php

This file was deleted.

34 changes: 0 additions & 34 deletions application/errors/error_db.php

This file was deleted.

34 changes: 0 additions & 34 deletions application/errors/error_general.php

This file was deleted.

10 changes: 0 additions & 10 deletions application/errors/error_php.php

This file was deleted.

10 changes: 0 additions & 10 deletions application/errors/index.html

This file was deleted.

45 changes: 0 additions & 45 deletions application/extensions/AdminFooter/AdminFooter.php

This file was deleted.

9 changes: 0 additions & 9 deletions application/extensions/AdminFooter/views/footer.php

This file was deleted.

8 changes: 0 additions & 8 deletions application/extensions/GridViewWidget.php

This file was deleted.

2 changes: 1 addition & 1 deletion application/models/Question.php
Expand Up @@ -893,7 +893,7 @@ public function dependentRelations() {
* @throws CDbException
*/
public function deleteDependent() {
if (App()->db->getCurrentTransaction() != null) {
if (App()->db->getCurrentTransaction() == null) {
$transaction = App()->db->beginTransaction();
}
foreach($this->dependentRelations() as $relation) {
Expand Down
2 changes: 1 addition & 1 deletion application/models/QuestionGroup.php
Expand Up @@ -156,7 +156,7 @@ public function dependentRelations() {
* @throws CDbException
*/
public function deleteDependent() {
if (App()->db->getCurrentTransaction() != null) {
if (App()->db->getCurrentTransaction() == null) {
$transaction = App()->db->beginTransaction();
}
foreach($this->dependentRelations() as $relation) {
Expand Down
2 changes: 1 addition & 1 deletion application/models/Quota.php
Expand Up @@ -101,7 +101,7 @@ public function dependentRelations() {
* @throws CDbException
*/
public function deleteDependent() {
if (App()->db->getCurrentTransaction() != null) {
if (App()->db->getCurrentTransaction() == null) {
$transaction = App()->db->beginTransaction();
}
foreach($this->dependentRelations() as $relation) {
Expand Down
3 changes: 2 additions & 1 deletion application/models/Survey.php
Expand Up @@ -50,7 +50,8 @@ public function attributeLabels() {
'completedResponseCount' => gT("Completed"),
'partialResponseCount' => gT("Partial"),
'responseCount' => gT("Total"),
'responseRate' => gT('Rate')
'responseRate' => gT('Rate'),
'sid' => gT('Survey ID')


];
Expand Down
13 changes: 13 additions & 0 deletions application/models/import/Group.php
@@ -0,0 +1,13 @@
<?php
namespace ls\models\import;

/**
* Import class for QuestionGroup model
*/
class Group extends \QuestionGroup
{
public function rules() {

}

}

0 comments on commit ac87009

Please sign in to comment.