Jump to content

Leave Of Absence v0.9


Sava
 Share

Recommended Posts

  • 1 month later...

Sava,

I really like this addon, not sure of your time frame on adding a small touch to this already great addon, but it would be nice to be able to Approve the LOA Request via a button and to send an email to the Pilot requesting the LOA, via the View page.

Thinking have an Approve button below the Information provided in the View page and when you click on that button it pulls a form up to enter your comments concerning the LOA Request approval and a send button to send that info to the requesting Pilot via email.

Thanks for your great addons. Greatly appreciated I am sure by all here.

Link to comment
Share on other sites

  • 5 months later...

I have updated the module to v1.0.

All of you who have the old version, it's best to just reinstall everything.

Details available here: https://github.com/savamarkovic/phpvms_loa#loa-module-v10

  • Added version checker - Checks current version to the current one specified on the server.
  • Modified Date Choser - The date is now selected from a dropdown menu as opposed to being typed in.
  • Date Format Modified - The displayed data formats now use the phpVMS DATE_FORMAT variable and the times are now saved as a unix timestamp as opposed to a date string.
  • Direct Method Access Prohibited - Added checks to stop load loading of page if the form was not submitted.
  • Moved Emailing functions to a separate method in the class
  • Pilot Names in the Admin CP now pulled from the pilots table, not the LoA table. Names are no longer stored in the LoA table.

  • Like 1
Link to comment
Share on other sites

I get these two errors:

In the LOA application itself (That pilots complete): Fatal error: Class 'LoAData' not found in /home/vforg/public_html/core/modules/LoA/LoA.php on line 66

Here is the code for Line 66: $pilotid_check = LoAData::CheckPilotID($data['pilotid']);

On the Admins side: Fatal error: Class 'LoAData' not found in /home/vforg/public_html/admin/modules/LOA/LOA.php on line 35

Here is the code for line 35: $leaves = LoAData::GetAllRequests(array());

I have not changed anything, all I did was slide the folders into the respective areas and used the los.sql to set up the sql side.

  • Like 1
Link to comment
Share on other sites

Great thank you! There seems to be two issues, I did a test LOA request and got back this on the pilots end:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/vforg/public_html/core/common/LoAData.class.php on line 24

Your leave of absence request has been submitted. You will recieve an email confirming your details. There is no further action required on your part.

On the Admin side, it says there is no LOA Requests, even though I just did one.

I loaded all of the files as requested, and I even did the loa.sql

Link to comment
Share on other sites

I am not getting any error, but nothing shows up in the db, or in the admin side. It sends the email, but does not insert the data. I think you are missing a file or something, as the form's action tries to get it to send via /loa/submit, yet I cannot find that file anywhere.

Link to comment
Share on other sites

Well, instead of line 24, now it is on line 25 and still not seeing any LOA requests on the admin side.

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/vforg/public_html/core/common/LoAData.class.php on line 25

Your leave of absence request has been submitted. You will recieve an email confirming your details. There is no further action required on your part.

Thank you!

Link to comment
Share on other sites

  • 1 month later...

I thought, Ooo... great mod but it doesn't want to play! Everything works OK pilot side, emails sent & received and it populates the DB. Just nothing but this error on the admin side?

Leave of Absence Admin

There are no LoA requests. Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /home2/orangea1/public_html/admin/modules/LoA/LoA.php on line 83 Warning: fclose() expects parameter 1 to be resource, boolean given in /home2/orangea1/public_html/admin/modules/LoA/LoA.php on line 84

Any ideas?

Link to comment
Share on other sites

Should be fixed now. The error is because the connection to the file checking for updates was deleted during the maintenance of the site I am doing. I reuploaded the file, and the error should disappear now.

Link to comment
Share on other sites

  • 1 month later...

I found the solution myself. :)

Open //core/common/LoAData.class and locate the following:

public function GetAllRequests ()
{
 $table = TABLE_PREFIX;
 $sql   = "SELECT loa.pilotid,
   loa.start,
   loa.end,
   loa.reason,
   phpvms_pilots.pilotid,
   phpvms_pilots.firstname,
   phpvms_pilots.lastname
   FROM loa
   JOIN phpvms_pilots ON loa.pilotid = phpvms_pilots.pilotid";
 $ret = DB::get_results($sql);
 return $ret;

And replace it with this:

public function GetAllRequests ()
{
 $table = ".TABLE_PREFIX.";
 $sql   = "SELECT loa.pilotid,
   loa.start,
   loa.end,
   loa.reason,
   pilots.pilotid,
   pilots.firstname,
   pilots.lastname
   FROM loa
   JOIN pilots ON loa.pilotid = pilots.pilotid";
 $ret = DB::get_results($sql);
 return $ret;

Now the admin function works OK. :D

Link to comment
Share on other sites

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

I thought, Ooo... great mod but it doesn't want to play! Everything works OK pilot side, emails sent & received and it populates the DB. Just nothing but this error on the admin side?

Leave of Absence Admin

There are no LoA requests. Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /home2/orangea1/public_html/admin/modules/LoA/LoA.php on line 83 Warning: fclose() expects parameter 1 to be resource, boolean given in /home2/orangea1/public_html/admin/modules/LoA/LoA.php on line 84

Any ideas?

For hosting have flag fopen=0

I make this to LoA.php module:

 protected function check ($version)
 {
 $version_to_check = $version;
// make the cURL request
$curl = curl_init('http://www.savamarkovic.com/loa.csv');
curl_setopt($curl, CURLOPT_FAILonerror, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$read = curl_exec($curl);
 if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
 if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
 if ($read[0] == $version_to_check) {
	 echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
 }else if ($critical) {
		 echo '<h4>CRITICAL UPDATE FOUND!</h4>';
		 echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
			 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
 }else if ($update){
		 echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
		 echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
			 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
 }

}

I use Curl method can help someone

Regards Fred

Link to comment
Share on other sites

  • 7 months later...

I get this is admin center

There are no LoA requests.

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /home/deltaair/public_html/admin/modules/LoA/LoA.php on line 83

Warning: fclose(): supplied argument is not a valid stream resource in /home/deltaair/public_html/admin/modules/LoA/LoA.php on line 84

Not too sure on this?

pilot side looks great

Link to comment
Share on other sites

  • 1 month later...

I get this is admin center

There are no LoA requests.

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /home/deltaair/public_html/admin/modules/LoA/LoA.php on line 83

Warning: fclose(): supplied argument is not a valid stream resource in /home/deltaair/public_html/admin/modules/LoA/LoA.php on line 84

Not too sure on this?

pilot side looks great

I get the same error. My line 83 is this:

$read = fgetcsv ($fp);

line 84 is this:

fclose ($fp); // Closes the connection

that section looks like this:

protected function check ($version)

{

$version_to_check = $version;

$url = 'http://www.savamarkovic.com/loa.csv';

$fp = @fopen ($url, 'r') or $message = "The updater checking service is currently offline"; //If the server is unreachable

$read = fgetcsv ($fp);

fclose ($fp); // Closes the connection

if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set critical to true

if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true

if ($read[0] == $version_to_check) {

echo '<p id="success">Your version of this module is up to date. Wohooooo! ;))</p>';

}else if ($critical) {

echo '<h4>CRITICAL UPDATE FOUND!</h4>';

echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:

'.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';

}else if ($update){

echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';

echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:

'.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';

}

Pilot side is wonderful, admin side isn't working. All files are located correctly, and database reads correctly. Suggestions?

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