Page 1 of 1

Error on file upload - Can't execute SQL.

Posted: Wed Aug 08, 2018 3:02 pm
by Nick0
Hello all,

Recently, I decided to implement "Mods for Hesk" on our helpdesk system at work.

I backed up the files and then updated to the latest version of Hesk, as I always do, I also wanted to add some mods that I have been reading about from this resource:

https://www.mods-for-hesk.com/

Unfortunately, I received an error message part way through: An error occurred! (Error Code: 151)

The installation seemed to roll back, but I deleted everything and used the backup that I had taken before upgrading and installing the mods.

Then I tried to re-run the upgrade to get it to the current version of the un-modded installation, but I was getting getting this error:
Update failed: Cannot write to your hesk_settings.inc.php file. I fixed this by changing the files permissions and all seemed to work well.

Now, when a customer tries to submit a file, they are getting this error:
Can't execute SQL

Please notify webmaster at (email address)
I have access to the directory that hesk is installed in, but not the MySQL database, since ICT here at work set that up. No doubt I can ask them questions if needed but I am at a bit of a loss at to what the problem might be so I am here looking for some guidance, please.

Thank you,
Nick.

Re: Error on file upload - Can't execute SQL.

Posted: Wed Aug 08, 2018 3:18 pm
by mkoch227
If you enable debug mode in settings, and then try the file upload again, you should see the exact SQL error, which will be helpful in troubleshooting.

Re: Error on file upload - Can't execute SQL.

Posted: Wed Aug 08, 2018 3:24 pm
by Nick0
Hello Mike,

Many thanks and here is the error with debug mode enabled:

Code: Select all

Can't execute SQL: SELECT `t1`.`id`,`t1`.`user`,`t1`.`name`, `t1`.`email`, `t1`.`language`, `t1`.`isadmin`, `t1`.`categories`, `t1`.`notify_assigned`, `t1`.`heskprivileges`, (SELECT COUNT(*) FROM `hesk_tickets` FORCE KEY (`statuses`) WHERE `owner`=`t1`.`id` AND `status` IN ('0','1','2','4','5') ) as `open_tickets` FROM `hesk_users` AS `t1` WHERE `t1`.`autoassign`='1' ORDER BY `open_tickets` ASC, RAND()

MySQL said:
Key column 'statuses' doesn't exist in table
I hope that helps.

All the best,
Nick.

Re: Error on file upload - Can't execute SQL.

Posted: Wed Aug 08, 2018 3:40 pm
by mkoch227
It looks like Mods for HESK drops that key when rolling back a failed install (or during an uninstall). Whoops!

To fix this, you or your DBA will need to run the following SQL to get that key back:

Code: Select all

ALTER TABLE `hesk_tickets` ADD KEY `statuses` (`status`)
Where "hesk_" is your DB prefix (which can be found in settings).

Re: Error on file upload - Can't execute SQL.

Posted: Wed Aug 08, 2018 4:09 pm
by Nick0
Hello Mike,

This is very much appreciated and I have passed this on to DBA. I'll get back to you and let you know the outcome.

Very many thanks,
Nick.

Re: Error on file upload - Can't execute SQL.

Posted: Wed Sep 12, 2018 11:36 am
by Nick0
Hello Mike,

Just to update you. ICT have added the key as you suggested and that has fixed things, it would seem. I just want to say very many thanks to you for your help - you have truly saved the day for me.

Can you tell me if it should be okay for me to add Mods for Hesk again now, without fear of any mishaps if the installation fails?

All the best,
Nick.

Re: Error on file upload - Can't execute SQL.

Posted: Wed Sep 12, 2018 5:04 pm
by mkoch227
Based on your initial issue (installation part 151 failing), I would advise holding off at this time. There appears to be part of the installation that doesn't work on some installations, so I will need to rewrite that part for the next release. Once I have it re-written, I will send it to you to run against your installation.

Re: Error on file upload - Can't execute SQL.

Posted: Wed Oct 03, 2018 2:48 pm
by Nick0
Excellent, many thanks for all of your hard work and for helping to get my issues fixed! I will wait to hear from you.

Re: Error on file upload - Can't execute SQL.

Posted: Mon Oct 22, 2018 5:13 pm
by mkoch227
I believe this change should fix the installation error 151 issue. Replace your current file at /install/migrations/v310/ConvertPresetToIndividualColors.php with the one at https://gitlab.com/mike-koch/Mods-for-H ... Colors.php