Jump to content

Auto Accept/Reject Pirep


Vangelis

Recommended Posts

  • Members

Hello finaly i finished it and sharing witht he comunity

Are tired of accepting or even rejecting pireps ? Then do not worry Auto Accept/Reject Pirep is here to help you

It has a admin interface so you will be able to add

1. The VA's admin pilot admin that declines the PIREP

2. Function that searches the pirep log for custom criteria and decline the pirep

3. Functionality that adds the reason why it was declined in the PIREP's Comments.

4. Custom Reason why the pirep was decliened

For Example Your Pirep has been rejected because you " Custom Text"

5. Function that send an e-mail to admin and or to pilot when pirep rejected

6. It is compartible with Simpilot's Plugin Manager

You can see a demo of the admin page at www.baggelis.com/phpvms

Login with the demo admin account and find the settings page under Pilot Reports (PIREPS) -> Auto Pirep

You can download it from here http://baggelis.com/autopirep0.zip

Screenshots Below

post-271-0-05610000-1390511470_thumb.png

post-271-0-59071600-1390511486_thumb.png

Edited by Vangelis
  • Like 3
Link to comment
Share on other sites

  • Members

Indeed there was a problem by accepting the pireps with a bigger rate of landing

you will find an updated version in the link that i provided you before or you can update the function by downloading PirepAcData.class.php and replacing the one that is in core/common

I also deleted the mistaken pireps from my beta site

Sorry for the trouble

Link to comment
Share on other sites

Hi.

Cool module!

I have got rid of the default criteria because we don't need them however it will not auto-accept any of the PIREPS.

Should it accept the PIREPS automatically or is there something I have to do in the settings to get them to auto-accept.

Thanks!

Link to comment
Share on other sites

  • Members

Make sure you have added a valid pilot id in format VBA004

and replace your PirepAcData.class.php with this one PirepAcData.class.php

i didnt thought of using it without a criteria so didnt saw that there was a problem when there was none

with this one you should be ok if not tell me

I have also updated the donwload

Best regards and sorry for the trouble

Link to comment
Share on other sites

my Pilot ID is in format VLIxxxx

it doesnt approve pireps using kACARS and CAVACARS

maybe I have it at the false line PirepData Class?

public static function updateFlightReport($pirepid, $pirepdata, $recalc_finances = true) {
    if (!is_array($pirepdata)) {
	    return false;
    }
    if ($pirepdata['depicao'] == '' || $pirepdata['arricao'] == '') {
	    return false;
	  PirepAcData::search($pirepid);
 }
    $pirepinfo = self::getReportDetails($pirepid);
    if(isset($pirepdata['fuelused']) && isset($pirepdata['fuelunitcost'])) {
	    $pirepdata['fuelprice'] = $pirepdata['fuelused'] * $pirepdata['fuelunitcost'];
    }
    if(isset($pirepdata['flighttime'])) {
	    $flighttime_stamp = str_replace('.', ':', $pirepdata['flighttime']) . ':00';
	    $pirepdata['flighttime'] = str_replace(':', ',', $pirepdata['flighttime']);
    }
    # Recalculate finances if these fields are set...

Link to comment
Share on other sites

  • Members

You placed it in the wrong function it should in PirepData.class (That is correct)

under filereport function at some point in this function put it between

# Update any pilot's information
$pilotinfo = PilotData::getPilotData($pirepdata['pilotid']);
$pilotcode = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
PilotData::UpdateLastPIREPDate($pilotinfo->pilotid);

and

# Send an email to the admin that a PIREP was submitted
$sub = "A PIREP has been submitted by {$pilotcode} ({$pirepdata['depicao']} - {$pirepdata['arricao']})";
$message="A PIREP has been submitted by {$pilotcode} ({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n"
."{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n"
."Aircraft: {$pirepdata['aircraft']}\n"
."Flight Time: {$pirepdata['flighttime']}\n"
."Filed using: {$pirepdata['source']}\n\n"
."Comment: {$pirepdata['comment']}";

$email = Config::Get('EMAIL_NEW_PIREP');
if(empty($email))
{
$email = ADMIN_EMAIL;
}

Util::SendEmail($email, $sub, $message);


CentralData::send_pirep($pirepid);

// Reset this ID back
DB::$insert_id = $pirepid;
self::$pirepid = $pirepid;
return true;

}

so it should be something like this

# Update any pilot's information
 $pilotinfo = PilotData::getPilotData($pirepdata['pilotid']);
 $pilotcode = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
 PilotData::UpdateLastPIREPDate($pilotinfo->pilotid);
  FacebookPost::FacebookPostFlight($pirepid);
	 PirepAcData::search($pirepid);

 # Send an email to the admin that a PIREP was submitted
 $sub = "A PIREP has been submitted by {$pilotcode} ({$pirepdata['depicao']} - {$pirepdata['arricao']})";
 $message="A PIREP has been submitted by {$pilotcode} ({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n"
   ."{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n"
   ."Aircraft: {$pirepdata['aircraft']}\n"
   ."Flight Time: {$pirepdata['flighttime']}\n"
   ."Filed using: {$pirepdata['source']}\n\n"
   ."Comment: {$pirepdata['comment']}";

 $email = Config::Get('EMAIL_NEW_PIREP');
 if(empty($email))
 {
  $email = ADMIN_EMAIL;
 }

 Util::SendEmail($email, $sub, $message);


 CentralData::send_pirep($pirepid);

 // Reset this ID back
 DB::$insert_id = $pirepid;
 self::$pirepid = $pirepid;
 return true;

}

That is why it doesnt work

Link to comment
Share on other sites

  • Members

as the screen shot says you have altered the PilotData and not The PirepData

look at the preview post that i made and make sure that you have put

PilotData::UpdateLastPIREPDate($pilotinfo->pilotid);

in the corect place if you are unable to do that send me your PIREPData.class.php

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...