Jump to content

Virtualei

Members
  • Posts

    367
  • Joined

  • Last visited

Posts posted by Virtualei

  1. Hi Parko,

    I have had a look at this today with a fresh head. The last code sends out multiple emails[all the same email] even before the pirep has been accepted by admin. I tried moving the code from the Admin/modules to core/modules but the same thing happened. I tried adding

    if($pirepdata['accepted'] == "1")
    

    but then nothing was emailed.

    Are we at a loose end mate :(

    Alan

  2. Hi Parko mate,

    Ok here is my email_pirep_accep.tpl which I placed in my skins folder

    Dear <?php echo $firstname. ' ' .$lastname?>,
    Your pirep has been accepted.
    To view it, visit:
    <?php echo SITE_URL;?>/index.php/pireps/view/<?php echo $pirepid;?>
    Thanks!
    The <?php echo SITE_NAME;?> Team
    

    now I have added the code you supplied from line 800. but i dont think I have it in the right place

    * Update a specific PIREP
     *
     * @param int $pirepid ID of PIREP to update
     * @param array $pirepdata Dictionary array of fields to update
     * @param bool $recalc_finances Recalculate finances or not (fields must be passed!)
     * @return
     */
    public static function updateFlightReport($pirepid, $pirepdata, $recalc_finances = true) {
     if (!is_array($pirepdata)) {
    	 return false;
     }
     if ($pirepdata['depicao'] == '' || $pirepdata['arricao'] == '') {
    	 return false;
     }
     $pirepinfo = self::getReportDetails($pirepid);
     if(isset($pirepdata['fuelused']) && isset($pirepdata['fuelunitcost'])) {
    	 $pirepdata['fuelprice'] = $pirepdata['fuelused'] * $pirepdata['fuelunitcost'];
     }
     if(isset($pirepdata['flighttime'])) {
    	 $flighttime_stamp = str_replace('.', ':', $pirepdata['flighttime']) . ':00';
    	 $pirepdata['flighttime'] = str_replace(':', ',', $pirepdata['flighttime']);
     }
     # Send an email to the pilot who submitted that PIREP
    	 //PILOT INFO
    	 $pilotfirstname = $pilotinfo->firstname;
    	 $pilotlastname= $pilotinfo->lastname;
    	 $email = $pilotinfo->email;
    	 //PIREP INFO (This all goes into the email, we will need to add those into the TPL
    		 $code = $pirepdata['code'];
    	 $flightnum = $pirepdata['flightnum'];
    		 Template::Set('pilotinfo', $pilotinfo);
    	 Template::Set('flight', $pirepdata);
    	 $sub = 'Flight Report for: '.$code.''.$flightnum;
     $message = Template::Get('email_pirep_accep.tpl', true);
    	 $pireps = self::getLastReports($pilotinfo->pilotid, 1);
    	 if($pireps->accepted == "1")
     {
    		 Util::SendEmail($email, $sub, $message);
     }
     # Recalculate finances if these fields are set...
     if($recalc_finances === true) {
    
    	 $data = array(
    		 'price' => $pirepdata['price'],
    		 'load' => $pirepdata['load'],
    		 'expenses' => $pirepdata['expenses'],
    		 'fuelprice' => $pirepdata['fuelprice'],
    		 'pilotpay' => $pirepdata['pilotpay'],
    		 'flighttime' => $pirepdata['flighttime'],
    	 );
    
    	 $gross = floatval($pirepdata['load']) * floatval($pirepdata['price']);
    	 $revenue = self::getPIREPRevenue($data, $pirepinfo->paytype);
    	 $pirepdata = array_merge($pirepdata, array(
    		 'flighttime_stamp' => $flighttime_stamp,
    		 'gross' => $gross,
    		 'revenue' => $revenue,
    		 )
    	 );
    

    Am I in the correct file core/common/PIREPData.class.php

    Salamaty :)

  3. Hi,

    Has anyone ever produced something that sends an email to the pilot when their pirep has been accepted. I have looked in the forums and have found similar like email pireps data but have been unable to find what I am after. Maybe even an email to say Pirep accepted or if rejected and the reason ??

    Looking forward to hearing from someone :)

  4. Hi all,

    If a pilot files a manual pirep it gives a landing rate of 0.

    I understand why this happens but I have been reading this post http://forum.phpvms....t-modification/ and would like to use it. I think I display it a different way as I keep getting errors. I have it on my front page and this is my code.

    <h2>LAST FIVE FLIGHTS</h2>
    <div style="width:550px;height:130px;border:2px solid green;">
    <?php>
    $count = 5;
    $pireps = PIREPData::getRecentReportsByCount($count);
    ?>
    <div>
    <table>
    <thead>
     <tr>
     <th>Flight </th>
     <th>Departure</th>
     <th>Arrival</th>
     <th>Duration</th>
     <th>Pilot</th>
     <th>Landing Rate</th>
     </tr>
    </thead>
    <tbody>
    </div>
    <?php
    if(count($pireps) > 0)
    {
    foreach ($pireps as $pirep)
    {
    $pilotinfo = PilotData::getPilotData($pirep->pilotid);
    $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
     echo '<td>'.$pirep->code.$pirep->flightnum.'</td>';
    echo '<td>'.$pirep->depicao.'</td>';
    echo '<td>'.$pirep->arricao.'</td>';
    echo '<td>'.$pirep->flighttime.'</td>';
    echo '<td>'.$pilotid.' '.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</td>';
    echo '<td>'.$pirep->landingrate.'</td>';
    echo '</tr>';
    }
    }
    else
    {
    echo '<tr><td colspan="6">There are no recent flights!</td></tr>';
    }
    ?>
    </table>
    </div>
    
    

    Can anyone tell me how to change the code to get it to work. Thanks in advance.

    Alan

×
×
  • Create New...