예제 #1
0
 /**
  * Reset the pilot pay from all of the PIREPs, do it from
  * scratch
  * 
  * @param mixed $pilotid
  * @return
  */
 public static function resetLedgerforPilot($pilotid)
 {
     DB::query("DELETE FROM `" . TABLE_PREFIX . "ledger` WHERE `pirepid` > 0 AND `pilotid`=" . $pilotid);
     $sql = 'SELECT `pirepid` FROM `' . TABLE_PREFIX . 'pireps`
             WHERE `pilotid`=' . $pilotid . ' AND `accepted`=' . PIREP_ACCEPTED;
     $results = DB::get_results($sql);
     if (!$results) {
         return false;
     }
     foreach ($results as $pirep) {
         PIREPData::calculatePIREPPayment($pirep->pirepid);
     }
     return self::resetPilotPay($pilotid);
 }