Jump to content

Auto Accept/Reject Pirep


Vangelis
 Share

Recommended Posts

4 hours ago, AlexOlPed said:

No, in my file PilotData.class.php not exists the function updatePilotPay.

 

It's for this reason the problem?

 

Yep; few posts up I posted about this -- he calls a function that is missing from phpvms (dunno why) but I re-added it and then his module worked fine. Here is the function you need to add back to that class file.

 

/**
	 * Update a pilot's pay. Pass the pilot ID, and the number of
	 * hours they are being paid for
	 *
	 * @param int $pilotid The pilot ID
	 * @param int $flighthours Number of hours to pay the pilot for
	 * @return bool Success
	 *
	 */
	public static function updatePilotPay($pilotid, $flighthours)
	{
		$sql = 'SELECT payrate
					FROM '.TABLE_PREFIX.'ranks r, '.TABLE_PREFIX.'pilots p
					WHERE p.rank=r.rank
						AND p.pilotid='.$pilotid;

		$payrate = DB::get_row($sql);

		$payupdate = self::getPilotPay($flighthours, $payrate->payrate);

		$sql = 'UPDATE '.TABLE_PREFIX.'pilots
					SET totalpay=totalpay+'.$payupdate.'
					WHERE pilotid='.$pilotid;

		DB::query($sql);

		if(DB::errno() != 0)
			return false;

		return true;
	}

 

Link to comment
Share on other sites

1 hour ago, Ither said:

 

Yep; few posts up I posted about this -- he calls a function that is missing from phpvms (dunno why) but I re-added it and then his module worked fine. Here is the function you need to add back to that class file.

 


/**
	 * Update a pilot's pay. Pass the pilot ID, and the number of
	 * hours they are being paid for
	 *
	 * @param int $pilotid The pilot ID
	 * @param int $flighthours Number of hours to pay the pilot for
	 * @return bool Success
	 *
	 */
	public static function updatePilotPay($pilotid, $flighthours)
	{
		$sql = 'SELECT payrate
					FROM '.TABLE_PREFIX.'ranks r, '.TABLE_PREFIX.'pilots p
					WHERE p.rank=r.rank
						AND p.pilotid='.$pilotid;

		$payrate = DB::get_row($sql);

		$payupdate = self::getPilotPay($flighthours, $payrate->payrate);

		$sql = 'UPDATE '.TABLE_PREFIX.'pilots
					SET totalpay=totalpay+'.$payupdate.'
					WHERE pilotid='.$pilotid;

		DB::query($sql);

		if(DB::errno() != 0)
			return false;

		return true;
	}

 

oooh, I'm going to try it, I'll tell you how it went shortly. Thank you very much.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Bumping an old topic, so hopefully someone can help! :)

 

So, I've been playing with this module for a few weeks now. FINALLY got it to auto accept/reject (after reading all 12 pages here) BUT, when a Pilot submits a PIREP using our SMARTCARS or manually, it throws a connection error (but still files the PIREP and processes it accordingly).   The issue comes from the line that's added to PIREPdata.class.php (because when I remove it, the error goes away and it doesn't autoaccept/reject), which is: 

PirepAcData::search($pirepid);

Thoughts?

 

Thanks! 

Edited by Dyl1103
Link to comment
Share on other sites

  • 2 months later...
  • 7 months later...
  • 1 month later...
On 9/23/2021 at 12:08 PM, Vangelis said:

 

Good day I have a question i have installed this  and followed the read me file just to verify if I installed this and nothing pop up you said to switch the tpl files to php or what would I do in this instance now 

phpVMS Admin Panel - Google Chrome 11_14_2021 11_43_44 AM.png

Link to comment
Share on other sites

On 11/18/2021 at 2:50 PM, Vangelis said:

I would have a look first if you have added the right criteria according your pirep 

Ok because I can see it in my phpMyAdmin in the server but it doesn't show up exactly in the admin center off the website 

 

Link to comment
Share on other sites

  • Members

Then it is not installed correctly as there should have been a menu on the left where you insert the criteria in order for the pirep to be declined 

If for some reason you havent put any criteria then the module wont wo

Link to comment
Share on other sites

9 hours ago, Vangelis said:

Then it is not installed correctly as there should have been a menu on the left where you insert the criteria in order for the pirep to be declined 

If for some reason you havent put any criteria then the module wont wo

ok thx i will try again and if i run into a issue ill let you know 

 

Link to comment
Share on other sites

17 hours ago, Vangelis said:

Then it is not installed correctly as there should have been a menu on the left where you insert the criteria in order for the pirep to be declined 

If for some reason you havent put any criteria then the module wont wo

Hey I try to implement it again and got nothing you can look at the photos below to see and probably tell me where I went wrong but I followed all the instructions.1203316075_xenon.tfdidesign.com_localhost_westerna_phpvms_phpvms_autopirep_phpMyAdmin4.9.7-GoogleChrome11_21_20218_06_34PM.thumb.png.27deca4e9ff6c934360a0ee195d17c5d.png1178712615_xenon.tfdidesign.com_localhost_westerna_phpvms_phpvms_autopirep_phpMyAdmin4.9.7-GoogleChrome11_21_20218_09_30PM.thumb.png.a8eb99fbccbaf6673315d796fb79d36d.png 

core_navigation.tpl - cPanel File Manager v3 - Google Chrome 11_21_2021 8_10_07 PM.png

xenon.tfdidesign.com _ localhost _ westerna_phpvms _ phpvms_autopirep _ phpMyAdmin 4.9.7 - Google Chrome 11_21_2021 8_06_16 PM.png

xenon.tfdidesign.com _ localhost _ westerna_phpvms _ phpvms_autopirep _ phpMyAdmin 4.9.7 - Google Chrome 11_21_2021 8_06_22 PM.png

Link to comment
Share on other sites

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

×
×
  • Create New...