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 500 Adding Asset #205

Closed
JulienAerts opened this issue Jul 24, 2014 · 5 comments
Closed

Error 500 Adding Asset #205

JulienAerts opened this issue Jul 24, 2014 · 5 comments

Comments

@JulienAerts
Copy link

Hello ,

I just found an other error when i'm adding new asset .
I change the supplier information (Delete some and create new one) , and it seems that maybe related to this error .

Here is my log for that :

[2014-07-24 14:06:57] production.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'supplier_id' at row 1 (SQL: insert into assets (status_id, warranty_months, purchase_cost, purchase_date, name, serial, model_id, order_number, notes, asset_tag, supplier_id, user_id, assigned_to, archived, physical, depreciate, requestable, updated_at, created_at) values (, , , , , , 3, , , Test2, , 1, 0, 0, 1, 0, , 2014-07-24 14:06:57, 2014-07-24 14:06:57))' in E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Connection.php:555
Stack trace:
#0 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Connection.php(338): Illuminate\Database\Connection->run('insert into as...', Array, Object(Closure)) #1 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Connection.php(295): Illuminate\Database\Connection->statement('insert into as...', Array)
#2 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Query\Processors\Processor.php(30): Illuminate\Database\Connection->insert('insert into as...', Array) #3 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(1762): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into as...', Array, 'id')
#4 [internal function]: Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#5 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(919): call_user_func_array(Array, Array)
#6 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1502): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#7 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1502): Illuminate\Database\Eloquent\Builder->insertGetId(Array, 'id')
#8 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1472): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#9 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1383): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#10 E:\snipe-it\app\controllers\admin\AssetsController.php(221): Illuminate\Database\Eloquent\Model->save()
#11 [internal function]: Controllers\Admin\AssetsController->postCreate()
#12 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(231): call_user_func_array(Array, Array)
#13 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('postCreate', Array)
#14 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(Controllers\Admin\AssetsController), Object(Illuminate\Routing\Route), 'postCreate')
#15 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\Router.php(934): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'Controllers\Adm...', 'postCreate')
#16 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}()
#17 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\Route.php(105): call_user_func_array(Object(Closure), Array)
#18 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1000): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#19 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Routing\Router.php(968): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#20 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(738): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#21 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(708): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#22 E:\snipe-it\vendor\barryvdh\laravel-debugbar\src\Barryvdh\Debugbar\Middleware.php(34): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#23 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Http\FrameGuard.php(38): Barryvdh\Debugbar\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#24 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Session\Middleware.php(72): Illuminate\Http\FrameGuard->handle(Object(Illuminate\Http\Request), 1, true)
#25 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Cookie\Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#26 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Cookie\Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#27 E:\snipe-it\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#28 E:\snipe-it\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(606): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#29 E:\snipe-it\public\index.php(49): Illuminate\Foundation\Application->run()
#30 {main} [] []

After a workaround for the error with the supplier id , i get this :

Seems like the value send by the form is empty for the column requestable .

There is the log related :

[2014-07-24 14:24:31] production.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ' ' for column 'requestable' at row 1 (SQL: insert into assets (status_id, warranty_months, purchase_cost, purchase_date, name, serial, model_id, order_number, notes, asset_tag, supplier_id, user_id, assigned_to, archived, physical, depreciate, requestable, updated_at, created_at) values (, 12, 12345, 2014-07-08, , , 3, , test, test67, 7, 1, 0, 0, 1, 0, , 2014-07-24 14:24:31, 2014-07-24 14:24:31))' in E:\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Connection.php:555

@technogenus
Copy link

There are currently two issues with Asset Add causing unhandled exceptions.

ADD ASSET ERROR - SUPPLIER, REQUESTABLE are required, no warning or validation at UI

  1. The SQL INSERT sending disallowed NULL value for 'supplier ID'

[LOGGED ERROR] production.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'supplier_id' at row 1 (SQL: insert into assets (status_id, warranty_months, purchase_cost, purchase_date, assigned_to, name, serial, model_id, order_number, notes, asset_tag, supplier_id, user_id, archived, physical,depreciate, requestable, updated_at, created_at) values (0, 12, 1000, 2014-07-16, 0, My Laptop, aasfasf, 3, amfsasf, , L45000, , 1, 0, 1, 0, , 2014-08-03 08:55:11, 2014-08-03 08:55:11))' in /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php:555

Resolution: Changed the MySQL asset table field 'supplier_id' to default with value '0' or NULL and remove Not Null specification. DB LEVEL FIX, UI still needs proper validation
Workaround: make sure to select a valid Supplier before saving the asset entry

  1. The SQL INSERT sending disallowed NULL value for 'requestable'

[LOGGED ERROR] production.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'requestable' at row 1 (SQL: insert into assets (status_id, warranty_months, purchase_cost, purchase_date, assigned_to, name, serial, model_id,order_number, notes, asset_tag, supplier_id, user_id, archived, physical, depreciate, requestable, updated_at, created_at) values (0, 12, 1000, 2014-06-18, 0, My Laptop, asfasfdsf, 1, , , L997902, 4, 1, 0, 1, 0, , 2014-08-03 08:56:29, 2014-08-03 08:56:29))' in /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php:555

Resolution: Changed the asset table field 'requestable' to default with value '0' or NULL and remove the Not Null specification. DB LEVEL FIX, UI still needs proper validation.
Workaround: make sure to check "requestable" before saving the asset entry

@technogenus
Copy link

A fix for this error is now being tested. A tentative code update will be available shortly in the cordeos/snipeit repository.

@technogenus
Copy link

This is fixed in our latest fork of Snipe IT for testing and evaluation...

cd [your snipe IT directory]
git remote add cordeos https://github.com/cordeos/snipe-it
git add .
git commit -am 'your local commit comment'
git fetch cordeos
git reset --hard cordeos/develop
** dont do fetch source this way if you have LOCAL file changes!

Run the MySQL database SQL script (included in the source code database dir)
mysql -p [your DB name] < app/database/migrations/20140810_0.4.0_snipeit_sqlmig.sql

  • you should be prompted for you MySQL password

@snipe
Copy link
Owner

snipe commented Aug 12, 2014

Thanks guys - please try to stick to the artisan db migrations method whenever possible. Database migrations and seeding should all be possible within the artisan system. At the airport now, one more leg of the flight to go, but am looking forward to reviewing your changes. Are there pull requests for everything?

@technogenus
Copy link

This issue can be closed. Working as expected in latest.

@snipe snipe closed this as completed Aug 14, 2014
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

3 participants