Jump to content

Recommended Posts

  • Moderators
Posted

It's because the PIREP has not been accepted, so it sends out the email once it gets null value. Let me work on it to see how we can do this and let you know. ;)

  • Moderators
Posted

Okay. Open admin/templates/pirep_list.tpl go down around line 60 and find "Current Status". Now there is an if statement that says "If($pirep->accepted == PIREP_ACCEPTED)" open a bracket like "{" and paste the following after that and close the bracket like "}" then try and send a PIREP. I swear if it doesn't work I'm gonna pull my hair. :huh:

$pilotfirstname = Auth::$userinfo->firstname;
 $pilotlastname= Auth::$userinfo->lastname;
 $email = Auth::$userinfo->email;
 $code = $pirep->code;
 $flightnum = $pirep->flightnum;
 Template::Set('pilotinfo', Auth::$userinfo);
 Template::Set('flight', $pirep);
 $sub = 'Flight Report for: '.$code.''.$flightnum;
 $message = Template::Get('email_pirep_accep.tpl', true);
 Util::SendEmail($email, $sub, $message);
 echo 'Accepted';

  • Moderators
Posted

here, replace with this:

<?php
if($pirep->accepted == PIREP_ACCEPTED)
 {
 $pilotfirstname = Auth::$userinfo->firstname;
 $pilotlastname= Auth::$userinfo->lastname;
 $email = Auth::$userinfo->email;
 $code = $pirep->code;
 $flightnum = $pirep->flightnum;
 Template::Set('pilotinfo', Auth::$userinfo);
 Template::Set('flight', $pirep);
 $sub = 'Flight Report for: '.$code.''.$flightnum;
 $message = Template::Get('email_pirep_accep.tpl', true);
 Util::SendEmail($email, $sub, $message);
 echo 'Accepted';
 }
elseif($pirep->accepted == PIREP_REJECTED)
 {
 echo 'Rejected';
 }
elseif($pirep->accepted == PIREP_PENDING)
 {
 echo 'Approval Pending';
 }

?>

  • Moderators
Posted

Okay, that's good news. Now, we can add a button right next to the "Accept" status to send the the email manually once it's accepted.

  • Moderators
Posted

Something like this:

<?php
if($pirep->accepted == PIREP_ACCEPTED)
{
$pilotid = Auth::$userinfo->pilotid;
$rep = PIREPData::getLastReports($pilotid, 1);
$pilotfirstname = Auth::$userinfo->firstname;
$pilotlastname= Auth::$userinfo->lastname;
$email = Auth::$userinfo->email;
$code = $rep->code;
$flightnum = $rep->flightnum;
Template::Set('pilotinfo', Auth::$userinfo);
Template::Set('flight', $pirep);
$sub = 'Flight Report for: '.$code.''.$flightnum;
$message = Template::Get('email_pirep_accep.tpl', true);
echo 'Accepted';
?>
<input type="button" onclick="<?php echo Util::SendEmail($email, $sub, $message);?>" value="Send Email">
<?php
}
elseif($pirep->accepted == PIREP_REJECTED)
{
echo 'Rejected';
}
elseif($pirep->accepted == PIREP_PENDING)
{
echo 'Approval Pending';
}

?>

  • Moderators
Posted

Okay. You see, I added a button to send an email once the pirep is accepted and that has to be done by the admin manually but I think it disappears when you hit the accept button. Now if you go to view recent pireps the button should be there right next to the status field.

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