update data
[contractdashboard.git] / admin / import.php
blob:a/admin/import.php -> blob:b/admin/import.php
--- a/admin/import.php
+++ b/admin/import.php
@@ -2,7 +2,7 @@
 if (php_sapi_name() != "cli") {
     
 include_once ("../lib/common.inc.php");
-auth();
+//auth();
 $contractNoticeFields = array(
     "importFile",
     "agencyName",
@@ -44,18 +44,20 @@
 }
 $contractNoticeInsertQ.= ");";
 $contractNoticeInsertQ = $conn->prepare($contractNoticeInsertQ);
-
 function processFile($fpath) {
     global $conn, $contractNoticeFields, $contractNoticeInsertQ;
+    $success = 0;
     $row = 1;
     $handle = fopen($fpath, "r");
     //"t" mode string translates windows line breaks to unix
+//On the 15 April 2014 AusTender Contract Notice functionality changed to improve transparency. Two new fields have been introduced to capture the ‘Amendment Value’ and the ‘Amendment Start Date’. Where applicable, these fields will display on amendment records published after this date.
     $datamapping0712 = array(
         "Agency" => "agencyName",
         "Parent CN ID" => "parentCN",
         "CN ID" => "CNID",
         "Publish Date" => "publishDate",
         "Amendment Date" => "amendDate",
+        "Amendment Publish Date" => "amendDate",
         "Status" => "",
         "StartDate" => "contractStart",
         "EndDate" => "contractEnd",
@@ -135,8 +137,9 @@
             $errors = $conn->errorInfo();
             if ($errors[1] == 7 && strpos($errors[2], "duplicate key")) {
                 
-            } elseif ($errors[1] == 0) {
-                $success++;
+            } elseif ($errors[1] <= 0) {
+//print_r($errors);
+                $success = 1;
             } else {
                 foreach ($contractNoticeFields as $key => $cnf) {
                     echo var_dump($contractNoticeInsert[$key]) . $cnf . "<br>";