Jump to content
Vangelis

Auto Accept/Reject Pirep

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

when i try to add the sql i get this error 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM AUTO_INCREMENT=38' at line 9

any ideas what could be wrong?

Share this post


Link to post
Share on other sites

i just tried the new one and got

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `phpvms_autopirep` (`id`, `criteria_description`, `created_by`, `ena' at line 12

Share this post


Link to post
Share on other sites

sorry still getting the first error its strange 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 9

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

What if my pilot ID's are HAxxx?

Doesn't matter the only requirement for the auto comment to work is that you inserted your full username beware that this is the name that will be shown in the comments

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I am glad to hear that

it woked at the first try but not at second time

I get same error message I have posted before

Share this post


Link to post
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...