snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11k stars 3.17k forks source link

Requested Tab in Asset menu leads to 500 Error #14475

Open jsorOpenDrives opened 7 months ago

jsorOpenDrives commented 7 months ago

Debug mode

Describe the bug

Trying to get into the Requested Tab on the Asset sidebar but, it shows a 500 Error. However the tabs Requestable can be accessed. We are currently running the newest version of Snipe-IT.

Reproduction steps

  1. Clicking on the sidebar menu
  2. Selecting Requested underneath the Asset side bar.
  3. ...

Expected behavior

I should be able to see the Requested Menu.

Screenshots

snipe-error.txt

*@***:/var/www/snipeit/storage/framework/views$ cat 822b3839010aea03467abd64cad44040785d8789.php <?php $__env->startSection('title0'); ?> <?php echo e(trans('admin/hardware/general.requested')); ?>

<?php echo e(trans('general.assets')); ?>

<?php $__env->stopSection(); ?>

<?php $env->startSection('title'); ?> <?php echo $env->yieldContent('title0'); ?> <?php echo \Illuminate\View\Factory::parentPlaceholder('title'); ?> <?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-body">
                <div class="row">
                    <div class="col-md-12">

    <?php if($requestedItems->count() > 0): ?>
    <div class="table-responsive">
        <table
                name="requestedAssets"
                data-toolbar="#toolbar"
                class="table table-striped snipe-table"
                id="requestedAssets"
                data-advanced-search="true"
                data-search="true"
                data-show-columns="true"
                data-show-export="true"
                data-pagination="true"
                data-id-table="requestedAssets"
                data-cookie-id-table="requestedAssets"
                data-export-options='{
                "fileName": "export-assetrequests-<?php echo e(date('Y-m-d')); ?>",
                "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
                }'>
            <thead>
                <tr role="row">
                    <th class="col-md-1">Image</th>
                    <th class="col-md-2">Item Name</th>
                    <th class="col-md-2" data-sortable="true"><?php echo e(trans('admin/hardware/table.location')); ?></th>
                    <th class="col-md-2" data-sortable="true"><?php echo e(trans('admin/hardware/form.expected_checkin')); ?></th>
                    <th class="col-md-3" data-sortable="true"><?php echo e(trans('admin/hardware/table.requesting_user')); ?></th>
                    <th class="col-md-2"><?php echo e(trans('admin/hardware/table.requested_date')); ?></th>
                    <th class="col-md-1"><?php echo e(trans('button.actions')); ?></th>
                    <th class="col-md-1"><?php echo e(trans('general.checkout')); ?></th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $requestedItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $request): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                    <?php if($request->requestable): ?>
                <tr>
                        <?php echo e(csrf_field()); ?>

                        <td>
                            <?php if(($request->itemType() == "asset") && ($request->requestable)): ?>
                                <a href="<?php echo e($request->requestable->getImageUrl()); ?>" data-toggle="lightbox" data-type="image"><img src="<?php echo e($request->requestable->getImageUrl()); ?>" style="max-height: <?php echo e($snipeSettings->thumbnail_max_h); ?>px; width: auto;" class="img-responsive" alt="<?php echo e($request->requestable->name); ?>"></a>
                            <?php elseif(($request->itemType() == "asset_model") && ($request->requestable)): ?>
                                    <a href="<?php echo e(config('app.url')); ?>/uploads/models/<?php echo e($request->requestable->image); ?>" data-toggle="lightbox" data-type="image"><img src="<?php echo e(config('app.url')); ?>/uploads/models/<?php echo e($request->requestable->image); ?>" style="max-height: <?php echo e($snipeSettings->thumbnail_max_h); ?>px; width: auto;" class="img-responsive" alt="<?php echo e($request->requestable->name); ?>"></a>
                            <?php endif; ?>

                        </td>
                        <td>

                        <?php if($request->itemType() == "asset"): ?>
                        <a href="<?php echo e(config('app.url')); ?>/hardware/<?php echo e($request->requestable->id); ?>">
                            <?php echo e($request->name()); ?>

                        </a>
                        <?php elseif($request->itemType() == "asset_model"): ?>
                            <a href="<?php echo e(config('app.url')); ?>/models/<?php echo e($request->requestable->id); ?>">
                                <?php echo e($request->name()); ?>

                            </a>
                         <?php endif; ?>

                        </td>
                        <?php if($request->location()): ?>
                        <td><?php echo e($request->location()->name); ?></td>
                        <?php else: ?>
                        <td></td>
                        <?php endif; ?>

                        <td>
                        <?php if($request->itemType() == "asset"): ?>
                            <?php echo e(App\Helpers\Helper::getFormattedDateObject($request->requestable->expected_checkin, 'datetime', false)); ?>

                        <?php endif; ?>
                        </td>
                        <td>
                            <?php if($request->requestingUser() && !$request->requestingUser()->trashed()): ?>
                            <a href="<?php echo e(config('app.url')); ?>/users/<?php echo e($request->requestingUser()->id); ?>">
                                <?php echo e($request->requestingUser()->present()->fullName()); ?>

                            </a>
                           <?php else: ?>
                                (deleted user)
                            <?php endif; ?>
                        </td>
                        <td><?php echo e(App\Helpers\Helper::getFormattedDateObject($request->created_at, 'datetime', false)); ?></td>
                        <td>
                            <?php echo e(Form::open([
                                'method' => 'POST',
                                'route' => ['account/request-item', $request->itemType(), $request->requestable->id, true, $request->requestingUser()->id],
                                ])); ?>

                                <button class="btn btn-warning btn-sm" data-tooltip="true" title="<?php echo e(trans('general.cancel_request')); ?>"><?php echo e(trans('button.cancel')); ?></button>
                            <?php echo e(Form::close()); ?>

                        </td>
                        <td>
                            <?php if($request->itemType() == "asset"): ?>
                                <?php if($request->requestable->assigned_to==''): ?>
                                    <a href="<?php echo e(config('app.url')); ?>/hardware/<?php echo e($request->requestable->id); ?>/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="<?php echo e(trans('general.checkout_user_tooltip')); ?>"><?php echo e(trans('general.checkout')); ?></a>
                                    <?php else: ?>
                                    <a href="<?php echo e(config('app.url')); ?>/hardware/<?php echo e($request->requestable->id); ?>/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="<?php echo e(trans('general.checkin_toolip')); ?>"><?php echo e(trans('general.checkin')); ?></a>
                                <?php endif; ?>

                            <?php endif; ?>
                        </td>

                </tr>
                <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>

    <?php else: ?>
    <div class="col-md-12">
        <div class="alert alert-info alert-block">
            <i class="fas fa-info-circle"></i>
            <?php echo e(trans('general.no_results')); ?>

        </div>
    </div>
    <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div> <!-- .col-md-12> -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('moar_scripts'); ?> <?php echo $env->make('partials.bootstrap-table', [ 'exportFile' => 'requested-export', 'search' => true, 'clientSearch' => true, ], \Illuminate\Support\Arr::except(get_defined_vars(), ['data', '__path']))->render(); ?>

<?php $__env->stopSection(); ?>

<?php echo $env->make('layouts/default', \Illuminate\Support\Arr::except(get_defined_vars(), ['data', '__path']))->render(); ?><?php /PATH /var/www/snipeit/resources/views/hardware/requested.blade.php ENDPATH/ ?>**@**:/var/www/snipeit/storage/framework/views$

Snipe-IT Version

6.3.3

Operating System

Ubuntu

Web Server

Apache

PHP Version

7.4.33

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

welcome[bot] commented 7 months ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 6 months ago

What's the actual error in your app logs? I'm unable to reproduce this on the demo. https://demo.snipeitapp.com/hardware/requested

Snipe-IT Asset Management Demo
snipe commented 6 months ago

Never mind, I see you attached it as a file. (Please don't do that moving forward.)

Is it possible something that was requested was deleted?

snipe commented 6 months ago

(Also, what is line 110 of that file you cat'ed?)