OpenSpending csv updates
[contractdashboard.git] / exportData.csv.php
blob:a/exportData.csv.php -> blob:b/exportData.csv.php
--- a/exportData.csv.php
+++ b/exportData.csv.php
@@ -16,18 +16,12 @@
 EXTRACT(EPOCH FROM "publishDate") as "publishDate",
 EXTRACT(EPOCH FROM "contractStart") as "contractStart",
 EXTRACT(EPOCH FROM "contractEnd") as "contractEnd",
-value,description,"procurementMethod",category as cat3,
-(substr( "categoryUNSPSC"::text, 0, 3 ) || \'000000\'::text) as "cat1",  
-(substr( "categoryUNSPSC"::text, 0, 5 ) || \'0000\'::text) as "cat2",
- "supplierABN","supplierName",
-(
- case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID,
- 
+value,description,category,
+"supplierName",(case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID,
 (\'https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN\'::text || "CNID"::text) as sourceURL 
 FROM contractnotice join agency on contractnotice."agencyName"=agency."agencyName"  
 where "childCN" is null'
         , array(PDO::ATTR_CURSOR => PDO::FETCH_ORI_NEXT));
-// "supplierCity","supplierPostcode","supplierCountry","contactPostcode",
 $query->execute();
 $errors = $conn->errorInfo();
 if ($errors[2] != "") {
@@ -55,9 +49,9 @@
                     || $headers[$key] == "contractEnd") {
                 $colvalue = date("Y-m-d", $colvalue);
             }
-            if ($headers[$key] == "CNID") {
+           /* if ($headers[$key] == "CNID") {
                 $colvalue = str_replace("A","", $colvalue);
-}
+}*/
             if ($headers[$key] == "cat1" || $headers[$key] == "cat2"
                     || $headers[$key] == "cat3") {
                 $colvalue = $unspsc[$colvalue];