Jump to content

Recommended Posts

Posted (edited)

Hello,

When you accept or reject pirep, is it possible to send auto pirep to the pilot? Like your pirep Id 2008  from XXXX to YYYY has been accepted or rejected. Something like that.

Thanks.

Edited by OmerAslan
  • Moderators
Posted

In your PIREPData.class.php file there should be something like:

$ret = self::editPIREPFields($pirepid, array('accepted' => $status));

it is on the changePIREPStatus function. You can add something like this before the line stated above:

$pilot_details = PilotData::getPilotData($pirep_details->pilotid);
	if($status == PIREP_ACCEPTED) {
	$email = $pilot_details->email;
	$subject = "pirep accepted";
	$message = "Your pirep #'.$pirep_details->id.' from '.$pirep_details->depicao.' to '.$pirep_details->arricao.' has been accepted.";

	Util::SendEmail($email, $subject, $message);
} elseif($status == PIREP_REJECTED) {
	$email = $pilot_details->email;
	$subject = "pirep rejected";
	$message = "Your pirep #'.$pirep_details->id.' from '.$pirep_details->depicao.' to '.$pirep_details->arricao.' has been rejected.";

	Util::SendEmail($email, $subject, $message);
}

I did not test it but it should be working as far as I can understand, it should be working.

Posted (edited)
5 minutes ago, servetas said:

I did not test it but it should be working as far as I can understand, it should be working.

Looks Great but just one thing, your variable 'message' is spelt like 'messaage' in your post (with an extra 'a'). Must be having a late night :huh:

Edited by web541
  • Moderators
Posted
Just now, web541 said:

Looks Great but just one thing, your variable 'message' is spelt like 'messaage' in your post (with an extra 'a'). Must be having a late night ;)

hahaha Indeed! Having already written hundreds or thousands lines of code since morning. Thanks for noting that. Updated my post accordingly. :)

  • Like 1
Posted

Hi i add it and become like this:

        $pilot_details = PilotData::getPilotData($pirep_details->pilotid);
	if($status == PIREP_ACCEPTED) {
	$email = $pilot_details->email;
	$subject = "pirep accepted";
	$message = "Your pirep #'.$pirep_details->id.' from '.$pirep_details->depicao.' to '.$pirep_details->arricao.' has been accepted.";

	Util::SendEmail($email, $subject, $message);
        } elseif($status == PIREP_REJECTED) {
	$email = $pilot_details->email;
	$subject = "pirep rejected";
	$message = "Your pirep #'.$pirep_details->id.' from '.$pirep_details->depicao.' to '.$pirep_details->arricao.' has been rejected.";

	Util::SendEmail($email, $subject, $message);
        }

        $ret = self::editPIREPFields($pirepid, array('accepted' => $status));

and i get e-mail like this 

Your pirep #'.4.' from '.KLAX.' to '.NZAA.' has been accepted. Can we make that looks little better? :D Like without pound sign and dots...

Thanks

Posted

I changed to 

        $pilot_details = PilotData::getPilotData($pirep_details->pilotid);
	if($status == PIREP_ACCEPTED) {
	$email = $pilot_details->email;
	$subject = "Pirep Accepted";
	$message = "Your pirep $pirep_details->id from $pirep_details->depicao to $pirep_details->arricao has been accepted. Thanks for flying with us.";

	Util::SendEmail($email, $subject, $message);
        } elseif($status == PIREP_REJECTED) {
	$email = $pilot_details->email;
	$subject = "Pirep Rejected";
	$message = "Your pirep $pirep_details->id from $pirep_details->depicao to $pirep_details->arricao has been rejected.";

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

and result 

Your pirep 2101 from LTFJ to OMAA has been accepted. Thanks for flying with us.  and very good for me. Thank you my friend.

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