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

Unable to accept assigned asset (Eula)

Open Allenvh opened this issue 10 years ago • 15 comments

Expected Behavior (or desired behavior if a feature request)

Click on emailed link (EULA) and be able to accept assigned asset


Actual Behavior

After clicking the emailed link on EULA, Use logs in, dashboard shows message "Error: The asset you are trying to accept was not assigned to you"


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


Please provide answers to these questions before posting your bug report:

  • Version of Snipe-IT you're running v3.5.1-2-gd7222ae
  • What OS and web server you're running Snipe-IT on Win server 2012 r2, WAMP
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) Manual
  • If you're getting an error in your browser, include that error No error observed
  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error Dashboard
  • If a stacktrace is provided in the error, include that too. No error observed
  • Any errors that appear in your browser's error console. No error observed
  • Confirm whether the error is reproduceable on the demo. Not observed in demo
  • Include any additional information you can find in app/storage/logs and your webserver's logs. Reviewing logs
  • Include what you've done so far in the installation, and if you got any error messages along the way. Resinchronized LDAP users, Assigned to non LDAP users, Reinstalled composer and run php composer.phar install --no-dev --prefer-source php composer.phar dump-autoload php artisan migrate php artisan config:clear Assigned asset to a newly created user
  • Indicate whether or not you've manually edited any data directly in the database No

Allenvh avatar Oct 28 '16 14:10 Allenvh

We'd need to see data for us to make any sense of that. AFAIK, asset acceptance is working for others. The code there seems pretty straightforward:

$user = Auth::user();

        if ($user->id != $findlog->checkedout_to) {
            return redirect()->to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
        }

snipe avatar Oct 29 '16 15:10 snipe

What data do you need ?

Allenvh avatar Oct 31 '16 12:10 Allenvh

Where is that log that the function $findlog is looking at? The asset is correctly checked out to the user and the Activity report has the right information.

Allenvh avatar Oct 31 '16 12:10 Allenvh

I am also getting this, from the unaccepted assets report, I think it might be related.

image

Allenvh avatar Oct 31 '16 13:10 Allenvh

Checking the DB I found that the asset is being assigned to the right user, The accepted field is set to "pending" User_id is 1

I hope this helps

I am eager to fix this go test the signature drawing

Allenvh avatar Nov 01 '16 16:11 Allenvh

The picture with the error above was resolved, I found two orphan records in the DB, corrected it an the error went away. For some reason viewassetscontroller.php line 300 is still finding $user->Id != $findlog->checkedout_to

Allenvh avatar Nov 01 '16 17:11 Allenvh

The action_log shows the following: Id: 2 User_id: 30 (my user Id) Acction_type: checkout Target_id : 30 Target_type: app\models\users Item_id : 301 (right asset, shows pending in the assets.accepted table)

Help! I don't know what else to try.

Allenvh avatar Nov 01 '16 17:11 Allenvh

Same problem and error i got but version of snipe-it is v3.5.2-11-g5a835a5

Every time user tries to accept it error appers. In 'all assets' section i see assets assigned properly, but in report section in 'unaccepted assets' every asset i checkedout is there.

epic990 avatar Nov 02 '16 08:11 epic990

What code from debuger do you need to understand error we got in return :) I am not very good with it but i will try my best to do it.

epic990 avatar Nov 02 '16 14:11 epic990

I upgrade it to v3.5.1-2-gd7222ae with hope of fixin the issue, no joy so far

Allenvh avatar Nov 02 '16 16:11 Allenvh

The user _id and target _id being the same looks wrong... I'll take a look

mnemonicly avatar Nov 02 '16 23:11 mnemonicly

The conditional code that @snipe pointed out is different in develop... is anyone with this issue using develop? Or all on master/released versions?

mnemonicly avatar Nov 03 '16 13:11 mnemonicly

I am only using the stable versions

Allenvh avatar Nov 03 '16 13:11 Allenvh

same here using stable version.

epic990 avatar Nov 04 '16 08:11 epic990

I believe this is fixed on develop.

snipe avatar Nov 08 '16 18:11 snipe