Skip to content

Commit 5de8f52

Browse files
Fix on Bug#8626: Upload Issue, not uploading in custom_listid because of delimiter issue
1 parent d1ce521 commit 5de8f52

File tree

1 file changed

+51
-13
lines changed

1 file changed

+51
-13
lines changed

goUploadLeads/goUploadMe.php

+51-13
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
$delimiters = explode(" ", $_REQUEST["custom_delimiter"]);
5959
$str = file_get_contents($csv_file);
60-
$str1 = str_replace($delimiters, $default_delimiter, $str);
60+
$str1 = str_replace($delimiters, $default_delimiter, $str);
6161
file_put_contents($csv_file, $str1);
6262
}
6363

@@ -305,7 +305,12 @@
305305
$goCustomUpdateData = array();
306306

307307
foreach($custom_array as $custom_key => $map_data){
308-
$goCustomValues = $col[$map_data];
308+
$goCustomValues = preg_replace($field_regx, "", $col[$map_data]);
309+
//8626
310+
if(is_null($goCustomValues) || $goCustomValues === "")
311+
$goCustomValues = "";
312+
else
313+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
309314
array_push($goCustomKeyData, "$custom_key");
310315
array_push($goCustomValuesData, "'$goCustomValues'");
311316
array_push($goCustomUpdateData, "$custom_key='$goCustomValues'");
@@ -333,7 +338,12 @@
333338

334339
for($ax=0; $ax < $totalExplode; $ax++) {
335340
$goHeaderOfCustomFields = $goGetLastCustomFiledsName2[$ax]; #get the header name of the custom fields
336-
$goCustomValues = $col[$goGetLastHeader2[$ax]]; #get the values of the custom fields
341+
$goCustomValues = preg_replace($field_regx, "",$col[$goGetLastHeader2[$ax]]); #get the values of the custom fielde"
342+
//8626
343+
if(is_null($goCustomValues) || $goCustomValues === "")
344+
$goCustomValues = "";
345+
else
346+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
337347
array_push($goCustomValuesData, "'$goCustomValues'");
338348
array_push($goCustomUpdateData, "$goHeaderOfCustomFields='$goCustomValues'");
339349
}
@@ -420,7 +430,12 @@
420430
$goCustomUpdateData = array();
421431

422432
foreach($custom_array as $custom_key => $map_data){
423-
$goCustomValues = $col[$map_data];
433+
$goCustomValues = preg_replace($field_regx, "",$col[$map_data]);
434+
//8626
435+
if(is_null($goCustomValues) || $goCustomValues === "")
436+
$goCustomValues = "";
437+
else
438+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
424439
array_push($goCustomKeyData, "$custom_key");
425440
array_push($goCustomValuesData, "'$goCustomValues'");
426441
array_push($goCustomUpdateData, "$custom_key='$goCustomValues'");
@@ -448,7 +463,12 @@
448463

449464
for($ax=0; $ax < $totalExplode; $ax++) {
450465
$goHeaderOfCustomFields = $goGetLastCustomFiledsName2[$ax]; #get the header name of the custom fields
451-
$goCustomValues = $col[$goGetLastHeader2[$ax]]; #get the values of the custom fields
466+
$goCustomValues = preg_replace($field_regx, "",$col[$goGetLastHeader2[$ax]]); #get the values of the custom fields
467+
//8626
468+
if(is_null($goCustomValues) || $goCustomValues === "")
469+
$goCustomValues = "";
470+
else
471+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
452472
#$goQueryCustomFields .= "INSERT INTO custom_$theList (lead_id,".$goHeaderOfCustomFields.") VALUES ('$goLastInsertedLeadIDDUPCAMP','".$goCustomValues."');";
453473
#$rsltGoQueryCustomFields = mysqli_query($link, $goQueryCustomFields);
454474

@@ -540,7 +560,12 @@
540560
$goCustomUpdateData = array();
541561

542562
foreach($custom_array as $custom_key => $map_data){
543-
$goCustomValues = $col[$map_data];
563+
$goCustomValues = preg_replace($field_regx, "",$col[$map_data]);
564+
//8626
565+
if(is_null($goCustomValues) || $goCustomValues === "")
566+
$goCustomValues = "";
567+
else
568+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
544569
array_push($goCustomKeyData, "$custom_key");
545570
array_push($goCustomValuesData, "'$goCustomValues'");
546571
array_push($goCustomUpdateData, "$custom_key='$goCustomValues'");
@@ -568,8 +593,12 @@
568593

569594
for($ax=0; $ax < $totalExplode; $ax++) {
570595
$goHeaderOfCustomFields = $goGetLastCustomFiledsName2[$ax]; #get the header name of the custom fields
571-
$goCustomValues = $col[$goGetLastHeader2[$ax]]; #get the values of the custom fields
572-
596+
$goCustomValues = preg_replace($field_regx, "",$col[$goGetLastHeader2[$ax]]); #get the values of the custom fields
597+
//8626
598+
if(is_null($goCustomValues) || $goCustomValues === "")
599+
$goCustomValues = "";
600+
else
601+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
573602
#$goQueryCustomFields = "INSERT INTO custom_$theList (lead_id,".$goHeaderOfCustomFields.") VALUES ('$goLastInsertedLeadIDDUPLIST','".$goCustomValues."');";
574603
#$goQueryCustomFields = "INSERT INTO custom_$theList(lead_id, $goHeaderOfCustomFields) VALUES('$goLastInsertedLeadIDDUPLIST', '$goCustomValues') ON DUPLICATE KEY UPDATE $goHeaderOfCustomFields='$goCustomValues'";
575604
#$rsltGoQueryCustomFields = $astDB->rawQuery($goQueryCustomFields);
@@ -649,7 +678,12 @@
649678
$goCustomUpdateData = array();
650679

651680
foreach($custom_array as $custom_key => $map_data){
652-
$goCustomValues = $col[$map_data];
681+
$goCustomValues = preg_replace($field_regx, "",$col[$map_data]);
682+
//8626
683+
if(is_null($goCustomValues) || $goCustomValues === "")
684+
$goCustomValues = "";
685+
else
686+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
653687
array_push($goCustomKeyData, "$custom_key");
654688
array_push($goCustomValuesData, "'$goCustomValues'");
655689
array_push($goCustomUpdateData, "$custom_key='$goCustomValues'");
@@ -678,8 +712,12 @@
678712

679713
for($ax=0; $ax < $totalExplode; $ax++) {
680714
$goHeaderOfCustomFields = $goGetLastCustomFiledsName2[$ax]; #get the header name of the custom fields
681-
$goCustomValues = $col[$goGetLastHeader2[$ax]]; #get the values of the custom fields
682-
715+
$goCustomValues = preg_replace($field_regx, "",$col[$goGetLastHeader2[$ax]]); #get the values of the custom fields
716+
//8626
717+
if(is_null($goCustomValues) || $goCustomValues === "")
718+
$goCustomValues = "";
719+
else
720+
$goCustomValues = str_replace($default_delimiter, "", $goCustomValues);
683721
#$rsltGoQueryCustomFields = mysqli_query($link, $goQueryCustomFields);
684722

685723
// $goQueryCustomFields .= "INSERT INTO custom_$theList(lead_id, $goHeaderOfCustomFields) VALUES('$goLastInsertedLeadIDNODUP', '$goCustomValues') ON DUPLICATE KEY UPDATE $goHeaderOfCustomFields='$goCustomValues';";
@@ -716,9 +754,9 @@
716754
if($goCountInsertedLeads > 0 && $duplicates < 1) {
717755
$apiresults = array("result" => "success", "message" => "Total Uploaded Leads: $goCountInsertedLeads" , "alex_data" => $alex);
718756
}elseif($goCountInsertedLeads > 0 && $duplicates > 0){
719-
$apiresults = array("result" => "success", "message" => "Uploaded:$goCountInsertedLeads Duplicates:$duplicates");
757+
$apiresults = array("result" => "success", "message" => "Uploaded:$goCountInsertedLeads \nDuplicates:$duplicates");
720758
} elseif($goGetCheckcustomFieldNamesCorrect == "error"){
721-
$apiresults = array("result" => "error" , "message" => "Error: Lead File Not Compatible with List. Incompatible Field Names. Check the File Headers $goGetCheckcustomFieldNamesCorrect");
759+
$apiresults = array("result" => "error" , "message" => "Error: Lead File Not Compatible with List. \nIncompatible File Headers \n\nPlease use \"Lead Mapping\" function instead");
722760
}elseif($duplicates > 0){
723761
$apiresults = array("result" => "error" , "message" => "Duplicates Found : $duplicates");
724762
}else {

0 commit comments

Comments
 (0)