OmerAslan Posted March 5, 2017 Report Share Posted March 5, 2017 (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 March 5, 2017 by OmerAslan Quote Link to comment Share on other sites More sharing options...
web541 Posted March 5, 2017 Report Share Posted March 5, 2017 (edited) Where would you display this info? Like an email? (believe that is already functioning) And are you using a module? Edited March 5, 2017 by web541 Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted March 5, 2017 Moderators Report Share Posted March 5, 2017 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. Quote Link to comment Share on other sites More sharing options...
web541 Posted March 5, 2017 Report Share Posted March 5, 2017 (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 Edited March 5, 2017 by web541 Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted March 5, 2017 Moderators Report Share Posted March 5, 2017 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. 1 Quote Link to comment Share on other sites More sharing options...
OmerAslan Posted March 5, 2017 Author Report Share Posted March 5, 2017 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? Like without pound sign and dots... Thanks Quote Link to comment Share on other sites More sharing options...
OmerAslan Posted March 5, 2017 Author Report Share Posted March 5, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.