Jump to content

[SOLVED] Pirep Accepted (Pirep Status Email)


OmerAslan

Recommended Posts

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators
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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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