コード例 #1
0
ファイル: add_pirep.php プロジェクト: Galihom/phpVMS
//$data = array(
//	'pilotid'=>1,
//	'code'=>'vms',
//	'flightnum'=>1,
//	//'route' => 'HYLND DCT PUT J42 RBV J230 BYRDD J48 MOL DCT FLCON',
//	'depicao'=>'lfll',
//	'arricao'=>'egll',
//	'aircraft'=>'1',
//	'route' => 'BUSIL UT133 AMORO',
//	'flighttime'=>'3',
//	'submitdate'=>'NOW()',
//	'fuelused'=>6000,
//	'source'=>'unittest',
//	'comment'=>'Test Flight',
//	);
$pirepid = PIREPData::fileReport($data);
if ($ret == false) {
    echo PIREPData::$lasterror;
}
echo "PIREP ID is {$pirepid}";
$report_info = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
echo '<br />';
print_r($report_info);
echo '<strong>Deleting...</strong><br />';
#PIREPData::deletePIREP($pirepid);
//$report_info = PIREPData::findPIREPS(array('p.pirepid'=>$pirepid));
if (!$report_info) {
    echo 'PIREP deleted';
} else {
    echo 'Failed to delete PIREP!';
}
コード例 #2
0
ファイル: SchedulePIREPTest.php プロジェクト: Galihom/phpVMS
 /**
  * SchedulePIREPTest::testPIREPRejected()
  * 
  * @return void
  */
 public function testPIREPRejected()
 {
     $this->resetPilot();
     $sched = $this->findSchedule();
     Config::Set('PIREP_CHECK_DUPLICATE', false);
     Config::Set('EMAIL_SEND_PIREP', false);
     # Update this schedule to only pay per-hour
     SchedulesData::editScheduleFields($sched->id, array('payforflight' => 0));
     $sched = $this->findSchedule();
     $this->assertEquals(0, $sched->payforflight, 'Pay per-flight set to 0');
     $pirep_test = array('pilotid' => $this->samplePilotID, 'code' => $sched->code, 'flightnum' => $sched->flightnum, 'route' => $sched->route, 'depicao' => $sched->depicao, 'arricao' => $sched->arricao, 'aircraft' => $sched->aircraft, 'flighttime' => $sched->flighttime, 'submitdate' => 'NOW()', 'fuelused' => 6000, 'source' => 'unittest', 'comment' => 'Test Flight');
     # Update Pilot Pay to be set to zero
     PilotData::updateProfile($this->samplePilotID, array('totalpay' => 0));
     $pilot_data = PilotData::getPilotData($this->samplePilotID);
     $this->assertEquals($pilot_data->totalpay, 0, 'Reset Pilot Pay to 0');
     # File the flight report
     $pirepid = PIREPData::fileReport($pirep_test);
     $this->assertGreaterThan(0, $pirepid, PIREPData::$lasterror);
     $pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
     $this->assertGreaterThan(0, count($pirepdata), 'No PIREPs returned');
     # Work on one...
     $pirepdata = $pirepdata[0];
     # Verify the little bits of this PIREP....
     $this->assertEquals(PILOT_PAY_HOURLY, $pirepdata->paytype, 'PIREP Pay Type');
     $this->assertEquals($pilot_data->payrate, $pirepdata->pilotpay, 'PIREP Pay Amount');
     # Check the pilot pay
     $pilot_data = PilotData::getPilotData($this->samplePilotID);
     $this->assertEquals(0, $pilot_data->totalpay, 'Check pilot pay after PIREP FILE');
     # Reject the PIREP and then check the pilot pay
     $status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_REJECTED);
     $pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
     $this->assertEquals(PIREP_REJECTED, $pirepdata[0]->accepted, 'changePIREPStatus to ACCEPTED');
     $pirepdata = $pirepdata[0];
     # Check the schedule flown count:
     $post_accept = $this->findSchedule();
     $this->assertEquals($sched->timesflown, $post_accept->timesflown, "Schedule increment count");
     $post_pilot_data = PilotData::getPilotData($this->samplePilotID);
     $this->assertEquals(0, $post_pilot_data->totalpay, 'Check pilot pay after PIREP REJECT');
     $this->assertEquals($pilot_data->totalflights, $post_pilot_data->totalflights, 'Total Flights');
     # Delete the PIREP
     PIREPData::deletePIREP($pirepid);
     # Verify delete
     $data = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
     $this->assertEmpty($data, 'PIREPDdata::deletePIREP()');
 }
コード例 #3
0
ファイル: add_pirep.php プロジェクト: deanstalker/phpVMS
<?php

include '../core/codon.config.php';
echo '<pre>';
$schedules = SchedulesData::findSchedules(array('s.flighttype' => 'P'));
$idx = rand(0, count($schedules) - 1);
$sched = $schedules[$idx];
unset($schedules);
echo '<strong>Filing report...</strong><br />';
$data = array('pilotid' => 1, 'code' => $sched->code, 'flightnum' => $sched->flightnum, 'depicao' => $sched->depicao, 'arricao' => $sched->arricao, 'aircraft' => $sched->aircraft, 'flighttime' => $sched->flighttime, 'submitdate' => 'NOW()', 'fuelused' => 6000, 'source' => 'unittest', 'comment' => 'Test Flight');
$data = array('pilotid' => 1, 'code' => 'vms', 'flightnum' => 1, 'depicao' => 'lfll', 'arricao' => 'egll', 'aircraft' => '1', 'route' => 'BUSIL UT133 AMORO', 'flighttime' => '3', 'submitdate' => 'NOW()', 'fuelused' => 6000, 'source' => 'unittest', 'comment' => 'Test Flight');
$ret = PIREPData::fileReport($data);
if ($ret == false) {
    echo PIREPData::$lasterror;
}
$pirepid = DB::$insert_id;
$pirepid = PIREPData::$pirepid;
echo "pirep id is {$pirepid}";
$report_info = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
echo '<br />';
DB::debug();
print_r($report_info);
#$pilotinfo = PilotData::findPilots(array('p.pilotid'=>1));
#print_r($pilotinfo);
echo '<strong>Deleting...</strong><br />';
#PIREPData::deletePIREP($pirepid);
$report_info = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
if (!$report_info) {
    echo 'PIREP deleted';
}