From: maxious Date: Thu, 10 Dec 2009 21:10:05 +0000 Subject: updated update script and merged lobbylens admin scripts X-Git-Url: https://maxious.lambdacomplex.org/git/?p=contractdashboard.git&a=commitdiff&h=a27dce471b22984d81be734578f1cc87335e31dd --- updated update script and merged lobbylens admin scripts --- --- a/admin/abr-example.php +++ b/admin/abr-example.php --- /dev/null +++ b/admin/agency2portfolio.php @@ -1,1 +1,42 @@ + '', + 'advorgunitfield' => $agency, + 'advrolefield' => '', + 'advsection' => 'All', + 'advsurnamefield' => '', + 'search' => 'Submit Query' + )); + $results = curl_exec($c); + + if (preg_match('##smi', $results, $m)) { + $nextURL = $m[1]; + } else { + $cache[$agency] = false; return false; + } + + curl_setopt($c, CURLOPT_URL, 'http://www.directory.gov.au' . $nextURL); + curl_setopt($c, CURLOPT_HTTPGET, true); + curl_setopt($c, CURLOPT_REFERER, 'http://www.directory.gov.au/searchres.php'); + $results = curl_exec($c); + if (preg_match('#portfolios:\s+([^<]+)#ims', $results, $m)) { + $cache[$agency] = $m[1]; return $m[1]; + } else { + $cache[$agency] = false; return false; + } +} + +?> + --- a/admin/convertToThematicMapping.php +++ b/admin/convertToThematicMapping.php --- /dev/null +++ b/admin/displayRepresentatives.php @@ -1,1 +1,7 @@ +SELECT representative_id,firstname,surname,party,house,division_id, portfolio +FROM portfolio2representative +INNER JOIN representatives +ON portfolio2representative.representative_id=representatives.id +INNER JOIN portfolios +ON portfolio2representative.portfolio_id=portfolios.id --- /dev/null +++ b/admin/displayUNSPSC.php @@ -1,1 +1,25 @@ +"; +while ($row = mysql_fetch_assoc($catsresult)) { + $catName = $unspsc[$row['cat']."000000"].$row['cat']; + if ($row['cat'] = "") $catName = "null"; + + echo "$catName".$row['value'].""; +} +?> --- a/admin/google-example.php +++ b/admin/google-example.php --- a/admin/import.php +++ b/admin/import.php @@ -98,17 +98,17 @@ $result = mysql_query($contractNoticeInsert); if ($result) $success++; -else echo $data[2] . " failed CN insert.
". mysql_error() ."
$contractNoticeInsert

\n"; +else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed CN insert.
". mysql_error() ."
$contractNoticeInsert

\n"; - //$result = mysql_query($agencyInsert); + $result = mysql_query($agencyInsert); if ($result) $success++; -else echo $data[2] . " failed agency insert.
". mysql_error() ."
$agencyInsert

\n"; +else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed agency insert.
". mysql_error() ."
$agencyInsert

\n"; $result = mysql_query($supplierInsert); if ($result) $success++; -else echo $data[2] . " failed supplier insert.
". mysql_error() ."
$supplierInsert

\n"; +else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed supplier insert.
". mysql_error() ."
$supplierInsert

\n"; -echo "
\n"; +//echo "
\n"; } $row++; @@ -117,3 +117,4 @@ fclose($handle); } ?> + --- a/admin/linkAmendments.php +++ b/admin/linkAmendments.php --- a/admin/setAgencyStatus.php +++ b/admin/setAgencyStatus.php --- a/admin/setAgencyURLABN.php +++ b/admin/setAgencyURLABN.php --- /dev/null +++ b/admin/updateReport.php @@ -1,1 +1,30 @@ +"; + +$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) in (select * from (SELECT DATE(importDate) +FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)"; +$result = mysql_query($query); +$stats = mysql_fetch_array($result, MYSQL_BOTH); +echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."
"; + +$query = "SELECT count(*) as count FROM `agency` WHERE `abn` = '0'"; +$result = mysql_query($query); +$stats = mysql_fetch_array($result, MYSQL_BOTH); +echo $stats["count"] . " agencies with no ABN
"; + +/*$query = "SELECT count(*) as count FROM `supplierdetails` WHERE `supplierABN` = '0' and supplierCountry LIKE 'Australia'"; +$result = mysql_query($query); +$stats = mysql_fetch_array($result, MYSQL_BOTH); +echo $stats["count"] . " Australian suppliers with no ABN
";*/ + + +echo "Last updated: ". $stats["importday"]."
"; +?> --- /dev/null +++ b/admin/updateUNSPSC.php @@ -1,1 +1,38 @@ +\n Category not found for: \n"; +// print_r($record); + } else { + $result = mysql_query("UPDATE contractnotice SET categoryUNSPSC = +'".mysql_real_escape_string($unspsc[$record['category']])."' where CNID = +'".mysql_real_escape_string($record['CNID'])."';"); + if ($result) echo $record['CNID']. " set to ". ($unspsc[$record['category']]) . "
\n"; + else echo "error".mysql_error(); + } + } +} else echo "error".mysql_error(); +asort($missing); +print_r($missing); +?>