Imanol Posted January 9, 2014 Report Posted January 9, 2014 Hello, I need to know if there is a way to send an e-mail to a pilot when a PIREP has been rejected. Thanks. Quote
Members Vangelis Posted January 9, 2014 Members Report Posted January 9, 2014 When you reject a pirep in admin side an email is sended automaticly to the email of the pilot protected function reject_pirep_post() { $pirepid = $this->post->pirepid; $comment = $this->post->comment; if($pirepid == '' || $comment == '') return; PIREPData::ChangePIREPStatus($pirepid, PIREP_REJECTED); // 2 is rejected $pirep_details = PIREPData::GetReportDetails($pirepid); // If it was previously accepted, subtract the flight data if(intval($pirep_details->accepted) == PIREP_ACCEPTED) { PilotData::UpdateFlightData($pirep_details->pilotid, -1 * floatval($pirep->flighttime), -1); } //PilotData::UpdatePilotStats($pirep_details->pilotid); RanksData::CalculateUpdatePilotRank($pirep_details->pilotid); PilotData::resetPilotPay($pirep_details->pilotid); StatsData::UpdateTotalHours(); // Send comment for rejection if($comment != '') { $commenter = Auth::$userinfo->pilotid; // The person logged in commented PIREPData::AddComment($pirepid, $commenter, $comment); // Send them an email $this->set('firstname', $pirep_details->firstname); $this->set('lastname', $pirep_details->lastname); $this->set('pirepid', $pirepid); $message = Template::GetTemplate('email_commentadded.tpl', true); Util::SendEmail($pirep_details->email, 'Comment Added', $message); } LogData::addLog(Auth::$userinfo->pilotid, 'Rejected PIREP #'.$pirepid); # Call the event CodonEvent::Dispatch('pirep_rejected', 'PIREPAdmin', $pirep_details); } Quote
Imanol Posted January 9, 2014 Author Report Posted January 9, 2014 I found it but I don't understand. Do I have to copy this and paste it on somewhere? Quote
mseiwald Posted January 9, 2014 Report Posted January 9, 2014 No actually it should already send that mail to the pilot by default. Quote
Members Vangelis Posted January 10, 2014 Members Report Posted January 10, 2014 Sory for the confusion That is what i mean that it should work and i pasted the code from pirepdata class to prove my answer Quote
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.