X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=UpdateCurrencyRate.php;h=fc37c1f9476e210ecbf176896fdbf480b6231319;hb=fec5bf43d91f14f72e1c52f94baae3bb73702ae2;hp=461d4b0e8854393ad8566caf867321a3d82c129b;hpb=794eab1c796e35266cea28cd6e50ceb89fd4aa5d;p=Pman.Core diff --git a/UpdateCurrencyRate.php b/UpdateCurrencyRate.php index 461d4b0e..fc37c1f9 100644 --- a/UpdateCurrencyRate.php +++ b/UpdateCurrencyRate.php @@ -29,9 +29,7 @@ class Pman_Core_UpdateCurrencyRate extends Pman } function get() - { - echo "obtain the currency lists... \n"; - + { $currency = array(); $response = $this->curl($this->actionUrl, array(), 'GET'); @@ -58,7 +56,12 @@ class Pman_Core_UpdateCurrencyRate extends Pman $fromDate = date('m/d/y', strtotime("-6 MONTH")); $toDate = date('m/d/y'); - foreach ($currency as $c){ + $total = count($currency); + + foreach ($currency as $k => $c){ + + echo "\nProcessing Currency : $c ($k / $total) \n"; + $params = array( 'lang' => 'en', 'result' => 1, @@ -96,15 +99,17 @@ class Pman_Core_UpdateCurrencyRate extends Pman $o = clone($curr); } - $curr->setForm(array( + $curr->setFrom(array( 'rate' => $rate, - 'from' => date('Y-m-d H:i:s', strtotime($fromDate), - 'to' => date('Y-m-d H:i:s', strtotime($toDate), + 'from' => date('Y-m-d H:i:s', strtotime($fromDate)), + 'to' => date('Y-m-d H:i:s', strtotime($toDate)) )); + (empty($o)) ? $curr->insert() : $curr->update($o); + } - + $this->jok("DONE"); }