Kaynağa Gözat

Use address 2 as city if city is undefined

Alan Lam 3 yıl önce
ebeveyn
işleme
eed5b842a8
1 değiştirilmiş dosya ile 10 ekleme ve 2 silme
  1. 10 2
      tasks/import_venues.php

+ 10 - 2
tasks/import_venues.php

@@ -188,7 +188,15 @@ for($i = 0; $data = fgetcsv($handle); $i++) {
 
 	}
 
-	if(empty($internal_id)) continue;
+	if(empty($internal_id)) {
+		continue;
+	}
+
+	if(isset($address_2) && !isset($city)) {
+		$city = $address_2;
+		$address_2 = null;
+	}
+
 	if(empty($city) && empty($postal_code)) {
 		echo sprintf("Skipping row %d as there is no city or postal code\n", $row_number);
 		continue;
@@ -202,7 +210,7 @@ for($i = 0; $data = fgetcsv($handle); $i++) {
 	]);
 
 	if(!$location) {
-		$location = new Location;
+		$location = new Location();
 		$location->customer_id = $customer_id;
 		$location->internal_id = $internal_id;
 	}