snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

"All Assets" page is blank (No matching records found)

Open cgaybba opened this issue 7 years ago • 25 comments

Please confirm you have done the following before posting your bug report:

Describe the bug Snipe-IT is on a pinned tab in Chrome. I lost my tabs and had to re-open them. When I opened up Snipe-IT, the "All Assets" page is blank with a "No matching records found" error. When typing anything in the "Search" bar, the list of assets that contains that word comes up e.g. if I type in a person's name, all the assets under that person's name shows up. Deleting the search and the results stay the same.

I've cleared my browser's cookies, I've run the the following commands:

composer dump-autoload composer clear-compiled php artisan config:clear php artisan view:clear php artisan cache:clear php artisan route:clear

I've searched the net and found 1 similar issue on Github but without any real explanation on how to fix this. I've enabled "debug mode" but don't see the debug screen nor the debug icon to expand the debug screen. I've done quite a few things without any success.

Under "Console" when Inspecting on Chrome I'm getting a 500 (Internal Server Error) for the following URL: https://sub.domain.com/public/api/v1/hardware?status=&order_number=&company_id=&status_id=&search=&sort=name&order=asc&offset=0&limit=20

Even clicking on "All Deployed" or "All Ready to Deploy" gives the same result = no results

When I click on "Dashboard" it shows the total amount of assets on the system.

dashboard

all-assets

To Reproduce Steps to reproduce the behavior:

  1. Go to the domain it is installed under
  2. Login
  3. Click on List All under Assets
  4. "No matching records found"

Expected behavior When I click on "All Assets" I normally could have seen all the assets that I've submitted. This includes deployed, ready to deployed assets.

Screenshots If applicable, add screenshots to help explain your problem.

Server (please complete the following information):

  • Snipe-IT Version : v4.6.15
  • OS: Debian GNU/Linux 8 (jessie)
  • Web Server: Apache
  • PHP Version: 5.6.40

Desktop (please complete the following information):

  • OS: macOS Mojave 10.14.3
  • Browser: Chrome
  • Version: 73.0.3683.103

Error Messages

  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
  • If a stacktrace is provided in the error, include that too.
  • Any errors that appear in your browser's error console.
  • Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo : NO
  • Include any additional information you can find in storage/logs and your webserver's logs. laravel.txt

Additional context

  • Is this a fresh install or an upgrade?: Fresh install
  • What OS and web server you're running Snipe-IT on: GNU/Linux 8 (jessie) with Apache
  • What method you used to install Snipe-IT: terminal ssh get github...
  • Include what you've done so far in the installation, and if you got any error messages along the way: Installation went well, added assets without problems and now
  • Indicate whether or not you've manually edited any data directly in the database: No I haven't touched the database

Add any other context about the problem here.

cgaybba avatar Apr 17 '19 09:04 cgaybba

This sounds like a permission issue, a colleague of mine had the similar issue and after I made him superadmin he was able to see the assets

EarlRamirez avatar Apr 17 '19 11:04 EarlRamirez

This sounds like a permission issue, a colleague of mine had the similar issue and after I made him superadmin he was able to see the assets

I installed it on a shared server and I am a SuperAdmin and still seeing it.

cgaybba avatar Apr 17 '19 11:04 cgaybba

I've made a clean installation of Snipe-IT on another domain on a completely different server. I exported the Database from the original installation and imported it into the new installation and the results were the same. Again, no results on the "All Assets" page.

Might it be a problem with the database?

I can't seem to export the list from within Snipe-IT as the CSV gives me the same result.

cgaybba avatar Apr 18 '19 07:04 cgaybba

I seemed to get the "debug" working on the new installation and get the following error:

production.ERROR: ErrorException: date_interval_create_from_date_string(): Unknown or bad format ( months) at position 0 (m): The timezone could not be found in the database in /usr/www/users/username/app/Presenters/AssetPresenter.php:396

cgaybba avatar Apr 18 '19 07:04 cgaybba

Can you tell me what date format you're using in the "Time and Date Display" field in Admin Settings > Localization screen?

snipe avatar Apr 18 '19 18:04 snipe

Also what timezone do you have set in your .env?

snipe avatar Apr 18 '19 18:04 snipe

My date format in my .env file is set to 'Africa/Johannesburg' and my date in localisation is set to dd/mm/yyyy which is standard date format used in my country.

cgaybba avatar Apr 18 '19 18:04 cgaybba

Hm, I'm not able to reproduce this at all. It's clearly complaining about the timezone/time format, but when I switch my .env timezone to Africa/Johannesburg, switch to d/m /Y, and load the assets page with no issues. Screen Shot 2019-04-18 at 2 50 23 PM Screen Shot 2019-04-18 at 2 50 32 PM

snipe avatar Apr 18 '19 19:04 snipe

I know... I've done the changes on the demo, but couldn't reproduce the problem. It was working fine for a week and I could see all assets until I had to reopen the app a few days back.

cgaybba avatar Apr 18 '19 19:04 cgaybba

Did anything get updated on the server? New versions of software, security updates, etc?

snipe avatar Apr 18 '19 19:04 snipe

Did anything get updated on the server? New versions of software, security updates, etc?

No nothing that I know of. It is located on a shared server hosted by my hosting company, but nothing was updated or changed to my knowledge. Normally they send out notifications when they do.

cgaybba avatar Apr 18 '19 19:04 cgaybba

Can you try a different timezone in your .env (and clear the config cache) and see if that changes anything? I'm really trying to determine whether it's the time format method or the timezone itself that PHP doesn't like.

snipe avatar Apr 18 '19 19:04 snipe

Can you try a different timezone in your .env (and clear the config cache) and see if that changes anything? I'm really trying to determine whether it's the time format method or the timezone itself that PHP doesn't like.

I've tried using "America/Detroit" and ran the php artisan config:clear in terminal every time I make changes to my .env file but that didn't work either. I've also updated the timezones in Localization to correspond with my .env file, also without success.

cgaybba avatar Apr 18 '19 19:04 cgaybba

Okay, so it sounds like the env timezone isn't the issue here, but the date formatter. Is d/m/Y the only one that doesn't work?

snipe avatar Apr 18 '19 19:04 snipe

Okay, so it sounds like the env timezone isn't the issue here, but the date formatter. Is d/m/Y the only one that doesn't work?

I've tried all of the date formatters without success. Chrome's console keeps on giving me a 500 error for the following URL: https://sub.domain.co.za/public/api/v1/hardware?status=&order_number=&company_id=&status_id=&sort=custom_fields._snipeit_mac_address_1&order=desc&offset=0&limit=20

cgaybba avatar Apr 18 '19 19:04 cgaybba

Aha... looks like the issue relates to the EOL:

 public function eol_date()
    {

        if (( $this->purchase_date ) && ( $this->model )) {
            $date = date_create($this->purchase_date);
            date_add($date, date_interval_create_from_date_string($this->model->model->eol . ' months'));
            return date_format($date, 'Y-m-d');
        }

    }

Do you have an EOL set for those models? If so, what is it?

snipe avatar Apr 18 '19 19:04 snipe

Some of my assets was setup for 60 months

cgaybba avatar Apr 18 '19 19:04 cgaybba

In /usr/www/users/username/app/Presenters/AssetPresenter.php, can you replace the first line of the existing eol_date() method with this:

 if (( $this->purchase_date ) && ( $this->model ) && ( $this->model->model->eol ) ) {

Clear all your caches and hard reload that page.

snipe avatar Apr 18 '19 19:04 snipe

(If it still gives you an error, let me know what the new error is.)

snipe avatar Apr 18 '19 19:04 snipe

Seems to be working now. I do have some limited PHP experience and knowledge and is quite interested and curious what the problem might have been

cgaybba avatar Apr 18 '19 19:04 cgaybba