Guest lorathon Posted August 4, 2010 Report Posted August 4, 2010 Since the live fuel server stopped allowing phpVMS users to access the live fuel I have been seeing too many flights with a zero for fuel price. I am assuming this was due to the copy that Nabeel put up for the live lookup. I still wanted to use the live lookup ( I dont like the idea of all of the airports having the same fuel price) so I just looked for a work around. What I wanted was to be able to poll the live fuel server, if there was a price there then use it. If not then use the default. The problem became that sometimes a zero was sent back. The script would then run the fuel calc with zero as the fuel price. So I dug in and worked out a way to accomplish what I wanted. Bare in mind that this modification is too a class file that will be overwritten during and upgrade. core/common/FuelData.class.php public static function getFuelPrice($apt_icao) { $price = false; $aptinfo = OperationsData::GetAirportInfo($apt_icao); // Live pricing enabled, and the airport is set to '0' for a live price if(Config::Get('FUEL_GET_LIVE_PRICE') == true && ($aptinfo->fuelprice == '0' || $aptinfo->fuelprice == '')) { $price = self::get_cached_price($apt_icao); if(!$price) { $price = self::get_from_server($apt_icao); if(!is_bool($price)) { if($price != '0' && $price != '') //This checks if the return is a zero or blank if it is not then it returns the good price { return $price; // Returns the JetA price } } } else { if($price->jeta != '0' && $price->jeta != '') //Same as above { return $price->jeta; } } } /* Live price stuff above failed or was "off" */ if($aptinfo->fuelprice == '' || $aptinfo->fuelprice == 0) return Config::Get('FUEL_DEFAULT_PRICE'); else return $aptinfo->fuelprice; } Quote
Moderators mark1million Posted August 4, 2010 Moderators Report Posted August 4, 2010 Thanks Jeff Nice work around, thats one more thing added to the list to update once an update has been done Too many updates in that sentence there... Quote
Moderators joeri Posted August 4, 2010 Moderators Report Posted August 4, 2010 but i thouth the live feulpricing wan't working annymore Quote
TAV1702 Posted August 4, 2010 Report Posted August 4, 2010 but i thouth the live feulpricing wan't working annymore Nabeel says and I quote I've changed the API to refer to the last updated fuel price, so they may be off (they were updated last week). That means that the last fuel update that he was able to capture is the current one in use. So with this work around it should give prices the way that should be as of when that last update was made to the API. Now the fuel prices are going to be old as dust now, but at least all airports will not have the same fuel prices and should get no $0.00 fuel prices. That has been a major problem that I have been running in to lately. Quote
Moderators joeri Posted August 4, 2010 Moderators Report Posted August 4, 2010 Nabeel says and I quote That means that the last fuel update that he was able to capture is the current one in use. So with this work around it should give prices the way that should be as of when that last update was made to the API. Now the fuel prices are going to be old as dust now, but at least all airports will not have the same fuel prices and should get no $0.00 fuel prices. That has been a major problem that I have been running in to lately. t(hanks ray will see iff its getting the last prices :-) Quote
TAV1702 Posted August 4, 2010 Report Posted August 4, 2010 Well, if you go to each airport you added and click look up or what ever it is, all it does is say Live price check: Waiting for ICAO change... Now I just need to go back and try a couple flights from a few of those 0$ fuel price airports and see if this cleared up that problem for me. Quote
sdurward Posted March 16, 2011 Report Posted March 16, 2011 sorry i'm not so good with editing php, do i just replace the whole fueldata.class.php with the insert above? or do i need to edit a specific part? Thanks Quote
TAV1702 Posted March 16, 2011 Report Posted March 16, 2011 Nope. Not the whole thing. A quick tip to doing this kind of thing is take a close look at the opening line of code, and then look at the closing line of code. Find the two corresponding lines in your php file and replace it from start line to end line. Quote
druptown Posted January 21, 2012 Report Posted January 21, 2012 any been able to check if this works? Mine keeps saying "Waiting for ICAO to change" and price stays "0" Quote
Ghiby Posted September 3, 2012 Report Posted September 3, 2012 We could also use at least as a reference this mundi index http://www.indexmund...modity=jet-fuel maybe some kind of feed can be used from here and added to the phpVMS (I'm not a coder, just saying) note he price is FOB (freight on board) for U.S. Gulf Coast, so to have a fair estimate, some extra shipping and handling costs should be added for the destination airport Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.