Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when saving a PIREP without filling some fields and attempting to edit it #414

Closed
bbuske opened this issue Oct 24, 2019 · 5 comments
Closed
Milestone

Comments

@bbuske
Copy link
Contributor

bbuske commented Oct 24, 2019

Describe the bug

Hi @nabeel,

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.

Version
7.0.0.0 Beta

To Reproduce
Just go to file a manual PIREP and leave the aircraft field (or possibly other fields but not tested) blank, save the PIREP and then try to Edit it again.

Expected behavior
The PIREP Edit form should open without any error, allowing to edit / submit the manual PIREP.

@nabeelio
Copy link
Member

@buske-it Can you try the latest dev version from the repo or from here?
http://downloads.phpvms.net/phpvms-7.0.0-dev.tar.gz

I think I had addressed that. If you still see it in dev, I'll mark it as a proper bug and fix it. Thanks!!

@bbuske
Copy link
Contributor Author

bbuske commented Oct 24, 2019

Is there an easy way to upgrade the current install? The manual is not mentioning anything...

Also, I have tried to download the above package this morning and uploaded it... However, it would come up only with a blank page... nothing else... no installer... Anything I am missing here?

Let me know and I will be happy to test it for you.

Cheers

@nabeelio
Copy link
Member

You should just have to overwrite the files. Blank page, nothing in storage/logs?

@bbuske
Copy link
Contributor Author

bbuske commented Oct 25, 2019

I just uploaded it into a test directory and just get a blank page where the installer should be. It works fine with the regular download. Anyway, I made a backup. Tomorrow I will do it as you mentioned it, just overwriting the files.

Give me until later in the morning and I will let you know if it worked.
Cheers

@bbuske
Copy link
Contributor Author

bbuske commented Oct 26, 2019

Hi Nabeel,

as I mentioned on Discord, I have checked now and the error still exists in the latest dev version.
You have marked the flight number and the arrival and destination airports as required. However, you did not mark the aircraft field as required. Hence in the database it gets assigned NULL:

image

This in return causes a PHP error when you try to edit the PIREP after saving it:

image

It is calling function load() on null, which is not possible. Assigning an aircraft ID manually via phpmyadmin to the PIREP fixes the issue.

I suggest making the aircraft field required as well. That way you are forcing the user to fill it out, preventing the error.

To reproduce: File a manual PIREP and leave the aircraft field default (blank) as it is. Save the PIREP then try to edit it. The above PHP error comes up.

Cheers

@nabeelio nabeelio added this to the beta-2 milestone Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants