2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

added transactions

This commit is contained in:
azammitdcarf
2009-02-19 02:12:16 +00:00
parent c0cecbd25b
commit 8c7c0c014d
2 changed files with 21 additions and 5 deletions

View File

@@ -221,6 +221,9 @@ function is_respondent_selection($operator_id)
$rs = $db->GetRow($sql);
//if ($db->HasFailedTrans()) { print "FAILED in is_respondent_selection"; exit; }
if (!$db->CompleteTrans())
return false;
@@ -462,6 +465,7 @@ function get_case_id($operator_id, $create = true)
}
//if ($db->HasFailedTrans()) { print "FAILED in get_case_id"; exit; }
$db->CompleteTrans();
/**
@@ -665,6 +669,7 @@ function is_on_shift($operator_id)
$shift_id = $row['shift_id'];
}
//if ($db->HasFailedTrans()) { print "FAILED in is_on_shift"; exit; }
if ($db->CompleteTrans())
return $shift_id;
@@ -708,6 +713,7 @@ function is_on_call($operator_id)
$call_state_id = $row['state'];
}
//if ($db->HasFailedTrans()) { print "FAILED in is_on_call"; exit; }
if ($db->CompleteTrans())
return $call_state_id;
@@ -747,6 +753,7 @@ function is_on_call_attempt($operator_id)
$return = true;
}
//if ($db->HasFailedTrans()) { print "FAILED in is_on_call_attempt"; exit; }
if ($db->CompleteTrans())
return $return;
@@ -807,6 +814,7 @@ function get_call($operator_id,$respondent_id = "",$contact_phone_id = "")
}
//if ($db->HasFailedTrans()) { print "FAILED in get_call"; exit; }
if ($db->CompleteTrans())
return $id;
@@ -851,6 +859,7 @@ function get_limesurvey_url($operator_id)
}
}
//if ($db->HasFailedTrans()) { print "FAILED in get_limesurvey_url"; exit; }
$db->CompleteTrans();
return $url;
@@ -1071,6 +1080,7 @@ function end_case($operator_id)
else
$return = false;
//if ($db->HasFailedTrans()) { print "FAILED in end_case"; exit; }
if ($db->CompleteTrans())
return $return;
@@ -1120,8 +1130,6 @@ function end_call_attempt($operator_id)
if ($ca)
{
$db->StartTrans();
$sql = "UPDATE `call_attempt`
SET end = CONVERT_TZ(NOW(),'System','UTC')
WHERE call_attempt_id = '$ca'";
@@ -1131,6 +1139,7 @@ function end_call_attempt($operator_id)
$return = true;
}
//if ($db->HasFailedTrans()) { print "FAILED in end_call_attempt"; exit; }
if ($db->CompleteTrans())
return $return;
@@ -1216,6 +1225,7 @@ function get_call_attempt($operator_id)
}
}
//if ($db->HasFailedTrans()) { print "FAILED in get_call_attempt"; exit; }
if ($db->CompleteTrans())
return $id;
@@ -1266,6 +1276,7 @@ function end_call($operator_id,$outcome_id,$state = 5)
$db->Execute($sql);
}
//if ($db->HasFailedTrans()) { print "FAILED in end_call"; exit; }
if ($db->CompleteTrans())
return $o;

View File

@@ -53,7 +53,7 @@ if (isset($_GET['endwork']))
if (isset($_GET['note']))
{
$case_id = get_case_id($operator_id);
$case_id = get_case_id($operator_id,false);
$note = $db->qstr($_GET['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
@@ -61,7 +61,8 @@ if (isset($_GET['endwork']))
}
end_call_attempt($operator_id);
end_case($operator_id);
//if ($db->HasFailedTrans()){ print "<p>FAILED AT ENDWORK</p>"; exit();}
$db->CompleteTrans();
include("endwork.php");
@@ -75,7 +76,7 @@ if (isset($_GET['endcase']))
if (isset($_GET['note']))
{
$case_id = get_case_id($operator_id);
$case_id = get_case_id($operator_id,false);
$note = $db->qstr($_GET['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
@@ -84,6 +85,7 @@ if (isset($_GET['endcase']))
end_call_attempt($operator_id);
end_case($operator_id);
//if ($db->HasFailedTrans()) {print "<p>FAILED AT ENDCASE</p>"; exit();}
$db->CompleteTrans();
}
@@ -167,6 +169,9 @@ xhtml_head(T_("queXS"), true, array("css/index.css","css/tabber.css") , array("j
<?
xhtml_foot();
//if ($db->HasFailedTrans()){ print "<p>FAILED AT END of index</p>"; exit();}
$db->CompleteTrans();
?>