--- a/admin/importdatagov.php +++ b/admin/importdatagov.php @@ -59,11 +59,12 @@ //"t" mode string translates windows line breaks to unix $datamapping0712 = array( +// "_id" => "", "Agency Name" => "agencyName", "Parent Contract ID" => "parentCN", "Contract ID" => "CNID", "Publish Date" => "publishDate", - "Amendment Date" => "amendDate", + "AmendmentDate" => "amendDate", "Start Date" => "contractStart", "End Date" => "contractEnd", "Value" => "value", @@ -72,7 +73,7 @@ "UNSPSC Code" => "categoryUNSPSC", "Title" => "category", "Procurement Method" => "procurementMethod", - "ATM ID" => "atmID", + "TenderNumber" => "atmID", "SON ID" => "SONID", "Confidentiality Contract Flag" => "confidentialityContract", "Confidentiality Contract Reason" => "confidentialityContractReason", @@ -82,8 +83,8 @@ "Consultancy Reason" => "consultancyReason", "Amendment Reason" => "amendmentReason", "Supplier Name" => "supplierName", - "Supplier Address" => "supplierAddress", - "Supplier Suburb" => "supplierCity", + "SupplierAddress" => "supplierAddress", + "SupplierSuburb" => "supplierCity", "Supplier Postcode" => "supplierPostcode", "Supplier Country" => "supplierCountry", "Supplier ABN Exempt" => "supplierABNExempt", @@ -129,7 +130,8 @@ $contractNoticeInsert[] = null; } } elseif (($datamapping0712[$headers[$c]]) == "amendDate" || ($datamapping0712[$headers[$c]]) == "publishDate" || ($datamapping0712[$headers[$c]]) == "contractStart" || ($datamapping0712[$headers[$c]]) == "contractEnd") { - $contractNoticeInsert[] = date('Y-m-d H:i:s', strtotime($data[$c])); +//echo $datamapping0712[$headers[$c]]." ".$data[$c]." ".date('Y-m-d H:i:s', strtotime(str_replace('/','-',$data[$c])))."\n"; + $contractNoticeInsert[] = date('Y-m-d H:i:s', strtotime(str_replace('/','-',$data[$c]))); } else { if (strstr("\" =", $data[$c] > 0)) { die("Invalid Description field" . $contractNoticeInsert); @@ -141,12 +143,14 @@ } } flush(); - //print_r($contractNoticeInsert); +// print_r($contractNoticeInsert); $contractNoticeInsertQ->execute($contractNoticeInsert); $errors = $conn->errorInfo(); if ($errors[1] == 7 && strpos($errors[2], "duplicate key")) { - // echo "dupe
"; - } elseif ($errors[1] == 0) { +// echo "dupe {$data[2]} row $row
\n"; + } else { + if ($errors[1] == 0) { + echo "success {$data[2]} row $row
\n"; $success++; } else { foreach ($contractNoticeFields as $key => $cnf) { @@ -154,7 +158,7 @@ } echo $data[2] . " failed CN insert.
" . print_r($errors, true) . "
row $row

\n"; } - +} flush(); //echo "
\n"; }