Jump to content

Pax vs Cargo Pirep Problem C / P [SOLVED]


Guest Stormchaser

Recommended Posts

Guest Stormchaser

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.

Link to comment
Share on other sites

Guest Stormchaser

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']}')";

Link to comment
Share on other sites

Guest Stormchaser

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']}')";

Link to comment
Share on other sites

  • Moderators

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;

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...