diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index 3dae4e74fb..2c415cfe99 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -172,21 +172,43 @@ echo "\n"; + //define phone label options + if (is_array($_SESSION["contact"]["phone_label"]) && @sizeof($_SESSION["contact"]["phone_label"]) != 0) { + sort($_SESSION["contact"]["phone_label"]); + foreach($_SESSION["contact"]["phone_label"] as $row) { + $label_options[] = ""; + } + } + //loop through user columns $x = 0; foreach ($line_fields as $line_field) { $line_field = trim(trim($line_field), $enclosure); echo "\n"; echo " \n"; echo " \n"; echo "\n"; $x++; @@ -251,8 +274,9 @@ exit; } - //user selected fields + //user selected fields, labels $fields = $_POST['fields']; + $labels = $_POST['labels']; //set the domain_uuid $domain_uuid = $_SESSION['domain_uuid']; @@ -312,6 +336,9 @@ if ($field_name != "username" && $field_name != "group_name") { $array[$parent][$row_id][$table_name][$y]['domain_uuid'] = $domain_uuid; $array[$parent][$row_id][$table_name][$y][$field_name] = $result[$key]; + if ($field_name == 'phone_number') { + $array[$parent][$row_id][$table_name][$y]['phone_label'] = $labels[$key]; + } } } @@ -337,11 +364,12 @@ } } } + if (is_array($array[$parent][$row_id])) { $y++; } } //process a chunk of the array if ($row_id === 1000) { - + //save to the data $database = new database; $database->app_name = 'contacts'; @@ -349,8 +377,8 @@ $database->save($array); //clear the array - unset($array); - + unset($array); + //set the row id back to 0 $row_id = 0; } @@ -359,6 +387,7 @@ $row_number++; $row_id++; } //end while + fclose($handle); //save to the data
\n"; - //echo " ".$text['label-zzz']."\n"; echo $line_field; echo " \n"; - echo " \n"; echo " \n"; foreach($schema as $row) { echo " \n"; foreach($row['fields'] as $field) { + if ($field == 'phone_label') { continue; } $selected = ''; if ($field == $line_field) { $selected = "selected='selected'"; @@ -198,8 +220,9 @@ echo " \n"; } echo " \n"; - //echo "
\n"; - //echo $text['description-zzz']."\n"; + echo " \n"; echo "