Guest Stormchaser Posted December 22, 2010 Report Share Posted December 22, 2010 Just noticed tonight my pirep DB all flights are logged P or Passenger regardless if the schedule is a cargo/pass flight. I thought it was maybe acars problem so did a manual pirep with a cargo schedule still same problem logged as P passenger flight. Did load it with appropriate cargo for plane but still P in pirep DB. Don't know how to fix this. Noticed the problem when I added totalpass() to frontpage and got 1.6 million even though only have 100 flights. Fixed the problem by manually changing all the cargo pireps to C in mysqladmin. Quote Link to comment Share on other sites More sharing options...
Guest Stormchaser Posted December 22, 2010 Report Share Posted December 22, 2010 Fixed problem myself. Have to edit PIREPDATA.class.php in the common folder and add two lines: $sql = "INSERT INTO ".TABLE_PREFIX."pireps( `pilotid`, `code`, `flightnum`, `depicao`, `arricao`, `route`, `route_details`, `distance`, `aircraft`, `flighttime`, `flighttime_stamp`, `landingrate`, `flighttype`, `submitdate`, `accepted`, `log`, `load`, `fuelused`, `expenselist`, `source`, `exported`, `rawdata`) VALUES ( {$pirepdata['pilotid']}, '{$pirepdata['code']}', '{$pirepdata['flightnum']}', '{$pirepdata['depicao']}', '{$pirepdata['arricao']}', '{$pirepdata['route']}', '{$pirepdata['route_details']}', '{$pirepdata['distance']}', '{$pirepdata['aircraft']}', '{$pirepdata['flighttime']}', '{$flighttime_stamp}', '{$pirepdata['landingrate']}', '{$sched->flighttype}', NOW(), ".PIREP_PENDING.", '{$pirepdata['log']}', '{$pirepdata['load']}', '{$pirepdata['fuelused']}', '0', '{$pirepdata['source']}', {$pirepdata['exported']}, '{$pirepdata['rawdata']}')"; Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted December 23, 2010 Administrators Report Share Posted December 23, 2010 Thanks, what line numbers? Quote Link to comment Share on other sites More sharing options...
Guest Stormchaser Posted December 24, 2010 Report Share Posted December 24, 2010 Sorry using notepad, but its about in the middle. I'll add some above lines to help narrow it down. /* Escape the comment field */ $pirepdata['log'] = DB::escape($pirepdata['log']); $comment = DB::escape($pirepdata['comment']); /* Proper timestamp */ $flighttime_stamp = str_replace('.', ':', $pirepdata['flighttime']).':00'; $pirepdata['flighttime'] = str_replace(':', '.', $pirepdata['flighttime']); /* Export status as 0 */ $pirepdata['exported'] = 0; $sql = "INSERT INTO ".TABLE_PREFIX."pireps( `pilotid`, `code`, `flightnum`, `depicao`, `arricao`, `route`, `route_details`, `distance`, `aircraft`, `flighttime`, `flighttime_stamp`, `landingrate`, `flighttype`, `submitdate`, `accepted`, `log`, `load`, `fuelused`, `expenselist`, `source`, `exported`, `rawdata`) VALUES ( {$pirepdata['pilotid']}, '{$pirepdata['code']}', '{$pirepdata['flightnum']}', '{$pirepdata['depicao']}', '{$pirepdata['arricao']}', '{$pirepdata['route']}', '{$pirepdata['route_details']}', '{$pirepdata['distance']}', '{$pirepdata['aircraft']}', '{$pirepdata['flighttime']}', '{$flighttime_stamp}', '{$pirepdata['landingrate']}', '{$sched->flighttype}', NOW(), ".PIREP_PENDING.", '{$pirepdata['log']}', '{$pirepdata['load']}', '{$pirepdata['fuelused']}', '0', '{$pirepdata['source']}', {$pirepdata['exported']}, '{$pirepdata['rawdata']}')"; Quote Link to comment Share on other sites More sharing options...
Moderators joeri Posted December 24, 2010 Moderators Report Share Posted December 24, 2010 question what version are you on i am on the 1 befor the lest beta this is what i have in there /* Proper timestamp */ $pirepdata['flighttime'] = str_replace(':', '.', $pirepdata['flighttime']); $pirepdata['flighttime_stamp'] = str_replace('.', ':', $pirepdata['flighttime']).':00'; /* Export status as 0 */ $pirepdata['exported'] = 0; $pirepdata['submitdate'] = 'NOW()'; $pirepdata['accepted'] = PIREP_PENDING; $pirepdata['expenselist'] = '0'; # Do the insert based on the columns here $cols = array(); $col_values = array(); foreach($pirepdata as $key => $value) { switch($key) { case 'submitdate': $cols[] = "`{$key}`"; $col_values[] = 'NOW()'; break; case 'comment': continue; break; default: $cols[] = "`{$key}`"; $value = DB::escape($value); $col_values[] = "'{$value}'"; break; } } $cols = implode(', ', $cols); $col_values = implode(', ', $col_values); $sql = 'INSERT INTO '.TABLE_PREFIX."pireps ({$cols}) VALUES ({$col_values});"; DB::query($sql); $pirepid = DB::$insert_id; Quote Link to comment Share on other sites More sharing options...
Cor Posted February 22, 2011 Report Share Posted February 22, 2011 Hello all, Because I detected the problem now during testing I have changed it. The first change i added at line 761 and the second at line 783. This is a fix as I understand for scheduled flight, but what the do for a charterflight with for example Kacars or Flightkeeper. The should be a box which you can tick to determen if it is a paggengersflight or Cargo flight. Regards, Cor Quote Link to comment Share on other sites More sharing options...
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.