Merge branch 'master' of ssh://apples.lambdacomplex.org/git/contractdashboard
Merge branch 'master' of ssh://apples.lambdacomplex.org/git/contractdashboard

Conflicts:
admin/updateUNSPSC.php

file:b/.gitignore (new)
  /admin/neo4jimporter/target/
  /admin/neo4jimporter/.settings/
  /nbproject/private/
file:a/about.php -> file:b/about.php
<?php <?php
   
   
include('./lib/common.inc.php'); include('./lib/common.inc.php');
include_header("Map"); include_header("Map");
?> ?>
<div class="msg_list"> <div class="msg_list">
<p class="msg_head">Header-1 </p> <p class="msg_head">Header-1 </p>
<div class="msg_body"> <div class="msg_body">
orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  </div>
  <p class="msg_head">Header-2</p>
  <div class="msg_body">
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  </div>
  <p class="msg_head">Header-3</p>
  <div class="msg_body">
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  </div>
</div> </div>
<p class="msg_head">Header-2</p> <?php
<div class="msg_body"> CNDistributionGraph();
orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit  
</div>  
<p class="msg_head">Header-3</p>  
<div class="msg_body">  
orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit  
</div>  
</div>  
<?php CNDistributionGraph();  
// select distinct cnid, "publishDate" from (select ("CNID" - MOD("CNID",100)) as cnid from contractnotice where "CNID" < 999999) as a, contractnotice where a.cnid = contractNotice."CNID" order by cnid // select distinct cnid, "publishDate" from (select ("CNID" - MOD("CNID",100)) as cnid from contractnotice where "CNID" < 999999) as a, contractnotice where a.cnid = contractNotice."CNID" order by cnid
?> ?>
sourced from austender sourced from austender
Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY) Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY)
ABR ABR
<?php <?php
include_once("./lib/common.inc.php"); include_once("./lib/common.inc.php");
$query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end $query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end
FROM contractnotice WHERE "childCN" = 0 AND "parentCN" = 0 AND DATE("importDate") = (select * from (SELECT DATE("importDate") FROM contractnotice WHERE "childCN" is null AND "parentCN" is null AND DATE("importDate") = (select * from (SELECT DATE("importDate")
FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) GROUP BY DATE("importDate")'; FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) GROUP BY DATE("importDate")';
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->execute(); $query->execute();
if (!$query) { databaseError($conn->errorInfo());
databaseError($conn->errorInfo());  
}  
echo "<div>"; echo "<div>";
$stats = $query->fetch(PDO::FETCH_ASSOC); $stats = $query->fetch(PDO::FETCH_ASSOC);
echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."<br>"; echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] . "<br>";
$query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end $query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end
FROM contractnotice WHERE ("childCN" != 0 OR "parentCN" != 0) AND DATE("importDate") = (select * from (SELECT DATE("importDate") FROM contractnotice WHERE ("childCN" is not null OR "parentCN" is not null) AND DATE("importDate") = (select * from (SELECT DATE("importDate")
FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) GROUP BY DATE("importDate")'; FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) GROUP BY DATE("importDate")';
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->execute(); $query->execute();
if (!$query) { databaseError($conn->errorInfo());
databaseError($conn->errorInfo());  
}  
echo "<div>"; echo "<div>";
$stats = $query->fetch(PDO::FETCH_ASSOC); $stats = $query->fetch(PDO::FETCH_ASSOC);
echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."<br>"; echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] . "<br>";
echo "Last updated: ". $stats["importday"]."<br>"; echo "Last updated: " . $stats["importday"] . "<br>";
/* Check for null Procurement method and 0 ABN when not ABN exempt */ /* Check for null Procurement method and 0 ABN when not ABN exempt */
include_footer(); include_footer();
?> ?>
   
<?php <?php
$query = 'select "CNID" from contractnotice where "CNID" like \'%00_\' and "parentCN" is not null and length("CNID") > 6'; include_once("../lib/common.inc.php");
   
  $query = 'update contractnotice set "parentCN" = null where "parentCN" = \'0\'';
  $result = $conn->prepare($query);
  $result->execute();
  $query = 'update contractnotice set "childCN" = null where "childCN" = \'0\'';
  $result = $conn->prepare($query);
  $result->execute();
  $query = 'select "CNID","parentCN" from contractnotice where "CNID" like \'%00_\' and "parentCN" is not null';
  $result = $conn->prepare($query);
  $result->execute();
  foreach ($result->fetchAll() as $record) {
  $oldCN = $record['CNID'];
  $parentCN = substr($oldCN,0,-3);
  if ($parentCN == $record['parentCN']) {
  $newCN = $parentCN . "-A". substr($oldCN,-1);
  $updateresult = $conn->exec('UPDATE contractnotice SET "CNID" =
  \'' . $newCN . '\' where "CNID" = \'' . $oldCN . '\';');
  echo "$oldCN => $newCN (from parent CN $parentCN) <br>\n";
  }
  else {
  // echo "parent CN unexpected - $oldCN doesn't look like child of {$record['parentCN']} <br>\n";
  }
  }
   
<?php <?php
include_once ("../lib/common.inc.php"); include_once ("../lib/common.inc.php");
$query = 'SELECT c."CNID",c."parentCN",p."childCN" FROM contractnotice as c LEFT OUTER JOIN contractnotice as p on c."parentCN" = p."CNID" $query = 'SELECT c."CNID",c."parentCN",p."childCN" FROM contractnotice as c LEFT OUTER JOIN contractnotice as p on c."parentCN" = p."CNID"
WHERE WHERE
c."parentCN" > 0 AND p."childCN" IS NULL '; c."parentCN" IS NOT NULL AND p."childCN" IS NULL ';
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->execute(); $query->execute();
if (!$query) {  
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
}  
foreach ($query->fetchAll() as $row) { foreach ($query->fetchAll() as $row) {
$conn->exec('UPDATE contractnotice SET "childCN" = \'' . $conn->exec('UPDATE contractnotice SET "childCN" = \'' .
$row['CNID'] . '\' where "CNID" = \'' . $row['CNID'] . '\' where "CNID" = \'' .
$row['parentCN'] . '\';'); $row['parentCN'] . '\';');
echo 'UPDATE contractnotice SET "childCN" = \'' . echo 'UPDATE contractnotice SET "childCN" = \'' .
$row['CNID'] . '\' where "CNID" = \'' . $row['CNID'] . '\' where "CNID" = \'