Jump to content

Disable PIREP Edit


bbuske

Recommended Posts

Hello,

when people try to edit a PIREP after they have sent it, an error is coming up about a missing function.

While this would be nice to work, editing PIREPs is not really necessary anyway. So I wonder if there is an option to disable it somewhere. I know there was an app.config file in V5 but I have not found something similar in V7.

Any help is appreciated.

Cheers

Link to comment
Share on other sites

  • 5 months later...

Hello and sorry the lack of time here, Just this moment saw your post.

I have disabled mine a very long time ago, there is no reason what so ever a Pilot should edit a filed PIREP. there are 2 ways to disable this very easily.

The very easy way is this;

<?php
	// Only show this column if they're logged in, and the pilot viewing is the
	//	owner/submitter of the PIREPs
	if(Auth::LoggedIn() && Auth::$pilot->pilotid == $pirep->pilotid) {
		?>
	<td align="right">
		<a href="<?php echo url('/pireps/addcomment?id='.$pirep->pirepid);?>">Add Comment</a><br />
		<a href="<?php echo url('/pireps/editpirep?id='.$pirep->pirepid);?>">Edit PIREP</a>
	</td>
	<?php
	}
	?>

<?php
	// Only show this column if they're logged in, and the pilot viewing is the
	//	owner/submitter of the PIREPs
	if(Auth::LoggedIn() && Auth::$pilot->pilotid == $pirep->pilotid) {
		?>
	<!--<td align="right">
		<a href="<?php echo url('/pireps/addcomment?id='.$pirep->pirepid);?>">Add Comment</a><br />
		<a href="<?php echo url('/pireps/editpirep?id='.$pirep->pirepid);?>">Edit PIREP</a>
	</td>-->
	<?php
	}
	?>

First paragraph is what you have, you will see in the second paragraph a simple remarked "OUT", this remarks out the visible Add comment and Edit PIREP lines, this is the easy way of using a remark jesture for HTML and/or php, the <!--    //// my stuff //// -->  remarks out anything in between the <!--   and the -->  REMEMBER IMPORTANT type it exactly the way I've got it for the 2 remarks, the 

<!-- and --> are the remark calls.... Hope this helps anyone.

Link to comment
Share on other sites

  • Moderators

Almost, but with that, he'll lost the ability for his pilots to write a comment.  It'd be better to just comment out the "edit PIREP" link:

<td align="right">
		<a href="<?php echo url('/pireps/addcomment?id='.$pirep->pirepid);?>">Add Comment</a><br />
		<!––<a href="<?php echo url('/pireps/editpirep?id='.$pirep->pirepid);?>">Edit PIREP</a>––>
	</td>

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Administrators

In v7, there is a read-only mode which is active after it's been accepted/rejected or cancelled. It can still be edited beforehand, in case there's some additions that need to be added - mainly custom fields or pax/cargo counts which may not get filled in through ACARS

Link to comment
Share on other sites

  • 3 months later...
On 7/17/2019 at 7:55 AM, Nabeel said:

In v7, there is a read-only mode which is active after it's been accepted/rejected or cancelled. It can still be edited beforehand, in case there's some additions that need to be added - mainly custom fields or pax/cargo counts which may not get filled in through ACARS

Still, when pilots try to edit a PIREP after sending it or even saving it, a PHP error shows up and it says Ooops something went wrong.

It would be nice to disable that option so it doesn't appear or to let the pilot know he is not allowed to edit a PIREP. That error message doesn't look nice.. :P

 

Link to comment
Share on other sites

  • Administrators
12 hours ago, bbuske said:

Still, when pilots try to edit a PIREP after sending it or even saving it, a PHP error shows up and it says Ooops something went wrong.

It would be nice to disable that option so it doesn't appear or to let the pilot know he is not allowed to edit a PIREP. That error message doesn't look nice.. :P

 

That means there was an error that shouldn't have happened. Can you replicate it and then upload the storage/logs/laravel.log file here so I can see what the error is? If you can post an issue on Github, that will be the easiest way for me to keep track.

Link to comment
Share on other sites

Hi @Nabeel,

I am able to reproduce the error and I found a solution for it.

By default, when you open the manual PIREP form, there are no required fields. In our case the issue was the aircraft field. By default, when you load the PIREP form, it will show all fields blank, including the aircraft field. In this particular case, we had saved the PIREP before assigning an aircraft to it, just leaving the field blank. The result was that a NULL entry in the database was created for aircraft ID. When we tried to edit the PIREP the Ooops something went wrong message came up as a PHP error was generated.

Logging into phpMyAdmin, manually changing the NULL value to any valid aircraft ID makes the EDIT form come up normally and without an error. I could imagine that the error would occur as well if other fields were left empty and get assigned NULL as a result. 

My suggestion would be to either mark those fields as required, hence preventing a PIREP to be saved without all required information entered first, or have the fields contain some kind of default value, which is accepted by the database. In the case of Aircraft maybe something like "Please select Aircraft" which is assigned ID 1... or possibly as a third option, go ahead and change the mySQL table in such a way, that the value NULL is accepted and no longer causing an error.

I hope this helps you.

Cheers

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...
×
×
  • Create New...