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

Checkout licences issue after v3 upgrade #3469

Closed
shindelhu opened this issue Mar 31, 2017 · 6 comments
Closed

Checkout licences issue after v3 upgrade #3469

shindelhu opened this issue Mar 31, 2017 · 6 comments
Labels

Comments

@shindelhu
Copy link

After a successfull update, I was trying to check out licences to people, and no matter which one was clicked, getting an error.

[2017-03-31 17:18:18] production.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /var/www/html/snipeit/app/Models/Asset.php:205
Stack trace:
#0 /var/www/html/snipeit/app/Models/Asset.php(205): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to get p...', '/var/www/html/s...', 205, Array)
#1 /var/www/html/snipeit/bootstrap/cache/compiled.php(11335): App\Models\Asset->getDetailedNameAttribute(NULL)
#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(11295): Illuminate\Database\Eloquent\Model->mutateAttribute('detailed_name', NULL)
#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(11287): Illuminate\Database\Eloquent\Model->getAttributeValue('detailed_name')
#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(11651): Illuminate\Database\Eloquent\Model->getAttribute('detailed_name')
#5 /var/www/html/snipeit/bootstrap/cache/compiled.php(11635): Illuminate\Database\Eloquent\Model->__isset('detailed_name')
#6 /var/www/html/snipeit/bootstrap/cache/compiled.php(6439): Illuminate\Database\Eloquent\Model->offsetExists('detailed_name')
#7 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Support/helpers.php(426): Illuminate\Support\Arr::exists(Object(App\Models\Asset), 'detailed_name')
#8 /var/www/html/snipeit/bootstrap/cache/compiled.php(6558): data_get(Object(App\Models\Asset), Array)
#9 /var/www/html/snipeit/bootstrap/cache/compiled.php(12745): Illuminate\Support\Arr::pluck(Array, 'detailed_name', 'id')
#10 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php(271): Illuminate\Support\Collection->pluck('detailed_name', 'id')
#11 /var/www/html/snipeit/bootstrap/cache/compiled.php(12749): Illuminate\Database\Eloquent\Collection->pluck('detailed_name', 'id')
#12 /var/www/html/snipeit/app/Helpers/Helper.php(343): Illuminate\Support\Collection->lists('detailed_name', 'id')
#13 /var/www/html/snipeit/app/Http/Controllers/LicensesController.php(450): App\Helpers\Helper::detailedAssetList()
#14 [internal function]: App\Http\Controllers\LicensesController->getCheckout('333')
#15 /var/www/html/snipeit/bootstrap/cache/compiled.php(9424): call_user_func_array(Array, Array)
#16 /var/www/html/snipeit/bootstrap/cache/compiled.php(9486): Illuminate\Routing\Controller->callAction('getCheckout', Array)
#17 /var/www/html/snipeit/bootstrap/cache/compiled.php(9466): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\LicensesController), Object(Illuminate\Routing\Route), 'getCheckout')
#18 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#19 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#20 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#21 /var/www/html/snipeit/bootstrap/cache/compiled.php(9948): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 /var/www/html/snipeit/bootstrap/cache/compiled.php(9467): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#23 /var/www/html/snipeit/bootstrap/cache/compiled.php(9454): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\LicensesController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'getCheckout')
#24 /var/www/html/snipeit/bootstrap/cache/compiled.php(8524): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'getCheckout')
#25 /var/www/html/snipeit/bootstrap/cache/compiled.php(8511): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))
#26 /var/www/html/snipeit/bootstrap/cache/compiled.php(8225): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#27 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#28 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#29 /var/www/html/snipeit/app/Http/Middleware/CheckPermissions.php(28): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#30 [internal function]: App\Http\Middleware\CheckPermissions->handle(Object(Illuminate\Http\Request), Object(Closure), 'licenses.checko...')
#31 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#32 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#34 /var/www/html/snipeit/app/Http/Middleware/CheckPermissions.php(28): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#35 [internal function]: App\Http\Middleware\CheckPermissions->handle(Object(Illuminate\Http\Request), Object(Closure), 'licenses.view')
#36 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#37 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#38 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#39 /var/www/html/snipeit/app/Http/Middleware/Authenticate.php(45): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#40 [internal function]: App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#42 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#43 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#44 /var/www/html/snipeit/app/Http/Middleware/CheckForTwoFactor.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#45 [internal function]: App\Http\Middleware\CheckForTwoFactor->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#47 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#48 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#49 /var/www/html/snipeit/app/Http/Middleware/CheckLocale.php(42): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#50 [internal function]: App\Http\Middleware\CheckLocale->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#52 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#53 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#54 /var/www/html/snipeit/bootstrap/cache/compiled.php(3225): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#55 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#57 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#58 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#59 /var/www/html/snipeit/bootstrap/cache/compiled.php(13213): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#60 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#61 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#62 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#63 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#64 /var/www/html/snipeit/bootstrap/cache/compiled.php(13150): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#65 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#66 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#67 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#68 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#69 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#70 /var/www/html/snipeit/bootstrap/cache/compiled.php(9948): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#71 /var/www/html/snipeit/bootstrap/cache/compiled.php(8226): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#72 /var/www/html/snipeit/bootstrap/cache/compiled.php(8217): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#73 /var/www/html/snipeit/bootstrap/cache/compiled.php(8207): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#74 /var/www/html/snipeit/bootstrap/cache/compiled.php(2419): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#75 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#76 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#77 /var/www/html/snipeit/vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#78 [internal function]: Barryvdh\Debugbar\Middleware\Debugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#79 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#80 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#81 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#82 /var/www/html/snipeit/app/Http/Middleware/CheckForDebug.php(25): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#83 [internal function]: App\Http\Middleware\CheckForDebug->handle(Object(Illuminate\Http\Request), Object(Closure))
#84 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#85 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#86 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#87 /var/www/html/snipeit/vendor/fideloper/proxy/src/TrustProxies.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#88 [internal function]: Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#89 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#90 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#91 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#92 /var/www/html/snipeit/app/Http/Middleware/CheckForSetup.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#93 [internal function]: App\Http\Middleware\CheckForSetup->handle(Object(Illuminate\Http\Request), Object(Closure))
#94 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#95 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#96 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#97 /var/www/html/snipeit/app/Http/Middleware/NosniffGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#98 [internal function]: App\Http\Middleware\NosniffGuard->handle(Object(Illuminate\Http\Request), Object(Closure))
#99 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#100 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#101 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#102 /var/www/html/snipeit/app/Http/Middleware/XssProtectHeader.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#103 [internal function]: App\Http\Middleware\XssProtectHeader->handle(Object(Illuminate\Http\Request), Object(Closure))
#104 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#105 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#106 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#107 /var/www/html/snipeit/app/Http/Middleware/FrameGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#108 [internal function]: App\Http\Middleware\FrameGuard->handle(Object(Illuminate\Http\Request), Object(Closure))
#109 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#110 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#111 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#112 /var/www/html/snipeit/bootstrap/cache/compiled.php(13474): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#113 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#114 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#115 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#116 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#117 /var/www/html/snipeit/bootstrap/cache/compiled.php(11964): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#118 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#119 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#120 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#121 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#122 /var/www/html/snipeit/vendor/misterphilip/maintenance-mode/src/MisterPhilip/MaintenanceMode/Http/Middleware/CheckForMaintenanceMode.php(145): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#123 [internal function]: MisterPhilip\MaintenanceMode\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#124 /var/www/html/snipeit/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#125 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#126 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#127 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#128 /var/www/html/snipeit/bootstrap/cache/compiled.php(9948): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#129 /var/www/html/snipeit/bootstrap/cache/compiled.php(2366): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#130 /var/www/html/snipeit/bootstrap/cache/compiled.php(2350): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#131 /var/www/html/snipeit/public/index.php(60): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#132 {main}

Please help me out!

Thanks

@snipe
Copy link
Owner

snipe commented Apr 1, 2017

Please provide answers to the questions you deleted.

  • Version of Snipe-IT you're running
  • What OS and web server you're running Snipe-IT on
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)
  • Confirm whether the error is reproduceable on the demo.
  • Indicate whether or not you've manually edited any data directly in the database

Also tell me what's on line 205 of /var/www/html/snipeit/app/Models/Asset.php

@shindelhu
Copy link
Author

shindelhu commented Apr 3, 2017

Version of Snipe-IT you're running
v3.6.4

What OS and web server you're running Snipe-IT on
Rhel 7.0+ Apache

What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)

It was an upgrade from v2

Confirm whether the error is reproduceable on the demo.

Indicate whether or not you've manually edited any data directly in the database
NO

Also tell me what's on line 205 of /var/www/html/snipeit/app/Models/Asset.php

return $this->asset_tag . ' - ' . $this->name . ' (' . $user_name . ') ' . $this->model->name;

@shindelhu
Copy link
Author

Dear @snipe would you have an idea, what can I do with the issue above, as this is a production server, we would need to get it work soon?

Thanks

@shindelhu
Copy link
Author

No suggestion at all?

@shindelhu
Copy link
Author

Dear @snipe we have found a workaround, in the asset.php we made these changes:

public function getDetailedNameAttribute()
{

try { $a='';
if ($this->assignedUser) {
$user_name = $this->assignedUser->fullName();
$a= $this->asset_tag . ' - ' . $this->name . ' (' . $user_name . ') ' . $this->model->name;
} else {
$user_name = "Unassigned";
}
}
catch (Exception $e) {}
return $a; // $this->asset_tag . ' - ' . $this->name . ' (' . $user_name . ') ' . $this->model->name;
}
public function validationRules($id = '0')
{
return $this->rules;
}

With the changes above, we can now check out the licences, but some of the assets not showing in the dropdown to chose from. Possibly the ones, which are archived.
This is now a workaround, but not a proper solution, could you divert us to the right direction?
Thanks

@stale
Copy link

stale bot commented Jan 20, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jan 20, 2018
@snipe snipe closed this as completed Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants