Author Topic: Error adding new fleet  (Read 97 times)

adanesh

  • Newbie
  • *
  • Posts: 15
    • View Profile
Error adding new fleet
« on: July 16, 2017, 02:51:28 PM »
I am just experimenting with VAM to set up a VA for my son who is an avid virtual aviator.

If I understand the data structure correctly, one needs to define fleet type and then specific fleet (i.e. aircraft) of specific types. I have created a couple of fleet types and have tried to add a New Fleet -- but every time I try I get this error:

There was an error running the query [Field 'parameter_id' doesn't have a default value]

This is being displayed (on an otherwise blank page) at this relative URL:

/vamcore/fleets/add

Before I start looking through the code to try to understand my mistake, has anyone experienced this and can offer a suggestion?

adanesh

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Error adding new fleet
« Reply #1 on: July 17, 2017, 05:50:58 AM »
Have dug into this a bit -- and found that parameter_id isn't specified on line 79 of /vamcore/app/Controllers/FleetsController.php:

Code: [Select]
$sql = "insert into va_finances (finance_date,amount,description,report_type) values (now(),$aircraftvalue,'$description','New Aircraft')";
So, I hacked this line to specify an arbitrary parameter_id just to see what happens and then I got the same error but for gvauser_id. I do see that in the table definition in db_schema.sql, these fields are specified NOT NULL but without default values so it doesn't surprise me these errors are thrown given the values are defined in the SQL query.

Are these know problems with this controller? Has somethings gone wrong with my installation? For reference -- I had a lot of problems with the db_schema not working -- for instance invalid default values on datetime fields and had to make small adjustments in the schema for it to work in my MySQL 5.7 environment. However, I didn't edit any of these tables/fields.

adanesh

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Error adding new fleet
« Reply #2 on: July 22, 2017, 12:04:00 PM »
Does anyone have any insight on the issues I describe? It seems strange there are so few reports of db_schema or related errors being reported.

Jose

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Error adding new fleet
« Reply #3 on: July 22, 2017, 05:18:33 PM »
Hi!

In the spanish forum i posted this solution for the first error you have.

Link: http://virtualairlinesmanager.net/foro//index.php?topic=1363.msg5526#msg5526

They didnt report the issue with the gvauser_id, so i believe it was solved.

Check that post, try to do it in your web and if you still have problems let me know!

Regards!

adanesh

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Error adding new fleet
« Reply #4 on: July 22, 2017, 08:05:30 PM »

Thanks. Not reading Spanish I haven't really looked through those threads.

That said, this is exactly what I ended up doing to resolve the parameter_id problem -- although the best solution probably would be to update the table definition in db_schema to specify a default value.