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

Old bug forgotten to post much earlier: "312345678" is not good for replacement as could be a valid number (depending on prefixes and dial codes)

filter phone number>0 because 0 is NOT NULL too
This commit is contained in:
Alex
2015-02-24 02:13:24 +03:00
parent b7c213cca8
commit ce0d06f3de

View File

@@ -383,6 +383,7 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing =
$sql = "SELECT val as phone
FROM sample_var
WHERE sample_id = '$sample_id'
AND val > 0
AND val is NOT NULL
AND val != \"\"
AND (`type` = 2 or `type` = 3)
@@ -396,7 +397,7 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing =
foreach ($r5 as $r5v)
{
$tnum = preg_replace("/[^0-9]/", "",$r5v['phone']);
if (empty($tnum)) $tnum = "312345678"; //handle error condition
if (empty($tnum)) $tnum = "88888888"; //handle error condition
$sql = "INSERT INTO contact_phone (case_id,priority,phone,description)
VALUES ($case_id,$i,$tnum,'')";
$db->Execute($sql);
@@ -406,7 +407,7 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing =
else
{
$sql = "INSERT INTO contact_phone (case_id,priority,phone,description)
VALUES ($case_id,1,312345678,'test only')";
VALUES ($case_id,1,88888888,'test only')";
$db->Execute($sql);
}