Jump to content

Pirep accepted email[SOLVED]


Virtualei

Recommended Posts

  • Moderators

okay, remove the following and place it at the end right before the </body> and after ?>. Now it sends only one email to you when you hit it.

<input type="button" onclick="<?php echo Util::SendEmail($email, $sub, $message);?>" value="Send Email">

Link to comment
Share on other sites

  • Moderators

okay man, I just found a very simple way that you wouldn't even believe it :o

copy the following, go to admin/modules/PIREPAdmin/PIREPAdmin.php and find this function approve_pirep_post() and place it at the end before the bracket :D:

It's tested.

$this->set('firstname', $pirep_details->firstname);
$this->set('lastname', $pirep_details->lastname);
$this->set('pirepid', $pirepid);
$message = Template::GetTemplate('email_pirep_accep.tpl', true);
Util::SendEmail($pirep_details->email, 'Comment Added', $message);

How easy was that!!!!???

Link to comment
Share on other sites

Sorry mate not working have I put it in the correct place

    if (!PIREPData::updateFlightReport($this->post->pirepid, $data)) {
	    $this->set('message', 'There was an error editing your PIREP');
	    $this->render('core_error.tpl');
	    return false;
    }
    PIREPData::SaveFields($this->post->pirepid, $_POST);
    //Accept or reject?
    $this->post->id = $this->post->pirepid;
    $submit = strtolower($this->post->submit_pirep);
    // Add a comment
    if (trim($this->post->comment) != '' && $submit != 'reject pirep') {
	    PIREPData::AddComment($this->post->pirepid, Auth::$userinfo->pilotid, $this->post->comment);
    }
    if ($submit == 'accept pirep') {
	    $this->approve_pirep_post();
	    $this->set('firstname', $pirep_details->firstname);
	  $this->set('lastname', $pirep_details->lastname);
	  $this->set('pirepid', $pirepid);
	  $message = Template::GetTemplate('email_pirep_accep.tpl', true);
	  Util::SendEmail($pirep_details->email, 'Comment Added', $message); 
    } elseif ($submit == 'reject pirep') {
	    $this->reject_pirep_post();

    }
    StatsData::UpdateTotalHours();
    # Refresh the PIREP
    # $pirepInfo = PIREPData::getReportDetails($this->post_action->pirepid);
    PilotData::updatePilotStats($pirepInfo->pilotid);
    LogData::addLog(Auth::$userinfo->pilotid, 'Edited PIREP #' . $this->post->id);
    return true;
   }
}

Link to comment
Share on other sites

  • Moderators

Nope. Here like this:

protected function approve_pirep_post()
{
 $pirepid = $this->post->id;

 if($pirepid == '') return;

 $pirep_details  = PIREPData::GetReportDetails($pirepid);

 # See if it's already been accepted
 if(intval($pirep_details->accepted) == PIREP_ACCEPTED) return;

 # Update pilot stats
 SchedulesData::IncrementFlownCount($pirep_details->code, $pirep_details->flightnum);
 PIREPData::ChangePIREPStatus($pirepid, PIREP_ACCEPTED); // 1 is accepted
 PilotData::UpdateFlightData($pirep_details->pilotid, $pirep_details->flighttime, 1);
 PilotData::UpdatePilotPay($pirep_details->pilotid, $pirep_details->flighttime);

 RanksData::CalculateUpdatePilotRank($pirep_details->pilotid);
 PilotData::GenerateSignature($pirep_details->pilotid);
 StatsData::UpdateTotalHours();

 LogData::addLog(Auth::$userinfo->pilotid, 'Approved PIREP #'.$pirepid);

 # Call the event
 CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details);

  $this->set('firstname', $pirep_details->firstname);
  $this->set('lastname', $pirep_details->lastname);
  $this->set('pirepid', $pirepid);

  $message = Template::GetTemplate('email_pirep_accep.tpl', true);
  Util::SendEmail($pirep_details->email, 'PIREP Accepted.', $message);
}

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
  • 6 years later...

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