Open jayavman opened 2 weeks ago
If you set debug to true and tail the log at the time you're running the import, does that show you anything useful? We have some more verbose output there IIRC.
select from users
where id
= 1 and users
.deleted_at
is null limit 1
810μsfredons_assetEloquentUserProvider.php#59
select permission_groups
., users_groups
.user_id
as pivot_user_id
, users_groups
.group_id
as pivot_group_id
from permission_groups
inner join users_groups
on permission_groups
.id
= users_groups
.group_id
where users_groups
.user_id
= 1
480μsfredons_assetUser.php#147
select from custom_fields
380μsfredons_assetAssetsController.php#123
select count() as aggregate from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
where assets
.deleted_at
is null
3.81msfredons_assetAssetsController.php#386
select count() as aggregate from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
where assets
.deleted_at
is null
3.69msfredons_assetAssetsController.php#389
select assets
. from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
where assets
.deleted_at
is null order by name
asc limit 300 offset 0
3.07msfredons_assetAssetsController.php#390
select from locations
where locations
.id
in (38, 49, 50, 51, 303, 314, 322, 324, 376, 377, 378, 381, 382, 383, 430, 534, 537, 698, 897, 1166) and locations
.deleted_at
is null
700μsfredons_assetAssetsController.php#390
select from status_labels
where status_labels
.id
in (12, 14, 15, 16, 17, 18) and status_labels
.deleted_at
is null
670μsfredons_assetAssetsController.php#390
select from companies
where companies
.id
in (1)
510μsfredons_assetAssetsController.php#390
select from locations
where locations
.id
in (38, 49, 50, 51, 303, 314, 322, 324, 376, 377, 378, 381, 382, 383, 430, 534, 537, 698, 897, 1166) and locations
.deleted_at
is null
680μsfredons_assetAssetsController.php#390
select from models
where models
.id
in (18, 23, 108, 109, 148, 149, 196, 222, 223, 229, 230, 231, 512, 548, 621, 667, 668, 672, 688, 689, 812)
700μsfredons_assetAssetsController.php#390
select from categories
where categories
.id
in (25, 27, 28, 29, 49, 50) and categories
.deleted_at
is null
460μsfredons_assetAssetsController.php#390
select from manufacturers
where manufacturers
.id
in (22, 33, 37, 47, 55, 99, 110) and manufacturers
.deleted_at
is null
310μsfredons_assetAssetsController.php#390
select from custom_fieldsets
where custom_fieldsets
.id
in (2)
270μsfredons_assetAssetsController.php#390
select from suppliers
where suppliers
.id
in (7, 11) and suppliers
.deleted_at
is null
380μsfredons_assetAssetsController.php#390
select custom_fields
., custom_field_custom_fieldset
.custom_fieldset_id
as pivot_custom_fieldset_id
, custom_field_custom_fieldset
.custom_field_id
as pivot_custom_field_id
, custom_field_custom_fieldset
.required
as pivot_required
, custom_field_custom_fieldset
.order
as pivot_order
from custom_fields
inner join custom_field_custom_fieldset
on custom_fields
.id
= custom_field_custom_fieldset
.custom_field_id
where custom_field_custom_fieldset
.custom_fieldset_id
= 2 order by pivot_order
asc
730μsfredons_assetAssetsTransformer.php#102
select from depreciations
where depreciations
.id
= 1 limit 1
570μsfredons_assetAsset.php#452
select from depreciations
where depreciations
.id
= 2 limit 1
640μsfredons_assetAsset.php#452
select * from depreciations
where depreciations
.id
= 2 limit 1
i do get flooded alot by the str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in endor/laravel/framework/src/Illuminate/Support/helpers.php on line 75
No I mean tailing the log file itself as you click on Import. tail -f storage/logs/laravel.log
via command line
[2024-06-20 23:09:01] production.WARNING: User ID 1 initiated a PURGE! [2024-06-20 23:22:37] production.ERROR: ErrorException: Attempt to read property "id" on null in /home/fredons/public_html/asset/app/Importer/AssetImporter.php: 24 Stack trace:
[2024-06-20 23:22:37] production.ERROR: Attempt to read property "id" on null {" userId":1,"exception":"[object] (ErrorException(code: 0): Attempt to read proper ty \"id\" on null at /home/fredons/public_html/asset/app/Importer/AssetImporter. php:24) [stacktrace]
"}
That code is:
if (!is_null(Statuslabel::first())) {
$this->defaultStatusLabelId = Statuslabel::deployable()->first()->id;
}
It cannot find a deployable status label, and a status label was not provided in the import.
Why does it need to be deployable to change a category? Shouldn't we be able to change a category for any status (even archived or undeployable)
Also when importing you only need the asset number as the reference. I loaded the exact csv in as per demo at the top of my post ast and category
We only use that default status label on asset creation (when no status label was provided), not on updating.
@snipe tried the possible fix still an issue with me
says its updated after i import, but when i go to the asset, it still has "Speakers" as the category and not "Audio"
Again, that should only fire if it you're creating a new asset, so I think it's seeing the assets as new, not existing.
Debug mode
Describe the bug
Importer not updating category asset
Reproduction steps
Did not change. Tried many times changing assets to different category's and they just dont work via import.
Only thing in debug :
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in asset/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 75
Expected behavior
Importing changes to category's should change asset to the assigned category.
Screenshots
No response
Snipe-IT Version
v7.0.4 build 14011 (g20d558785)
Operating System
almalinux
Web Server
apache
PHP Version
8.1.29
Operating System
No response
Browser
No response
Version
No response
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
No response
Additional context
No response