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

Added #10454: Bulk Checkin #10462

Closed
wants to merge 14 commits into from

Conversation

adagioajanes
Copy link
Contributor

@adagioajanes adagioajanes commented Dec 24, 2021

Description

This will add an additional menu option and page for 'Bulk Checkin'. This page will allow you to bulk checkin assets in a similar way to bulk checkout.

image

image

Adds #10454 #9551

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Check in multiple assets utilizing bulk checkin
  • Attempt and fail to check in an asset that is not currently checked out (Test passed because I can't select a checked in asset. I did not test just forcing the post data to have an asset that is not checked out.)
  • Ensure all (within reason) existing functionality is not affected

Test Configuration:

  • PHP version: 8.0.14
  • MySQL version: 5.7.36
  • Webserver version: PHPStorm Built in Web Server
  • OS version: Windows 10 WSL

Checklist:

@@ -280,6 +281,7 @@ public function availableForCheckout()
* @param Carbon $expected_checkin
* @param string $note
* @param null $name
* @param null $location
Copy link
Contributor Author

@adagioajanes adagioajanes Dec 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that this was not in the notes at this line. So I added it.

@@ -7,6 +7,7 @@
'does_not_exist' => 'Asset does not exist.',
'does_not_exist_or_not_requestable' => 'Nice try. That asset does not exist or is not requestable.',
'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ',
'no_assets_selected' => 'You must select at least one asset from the list',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring this made the most sense to me. But let me know if there is a different way.

* @author [A. Janes] [<[email protected]>]
* @param Carbon $checkin_at
* @param string $note
* @param null $name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included the $name variable to keep it consistent with checkOut(). It isn't going to be used by this PR. But, it seemed like it made sense to keep if this method is reused.

</a>
</li>
@endcan

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting the menu item above bulk checkout made the most sense to me. But again, feel free to offer a different suggestion.

@adagioajanes
Copy link
Contributor Author

Unit testing successful. Ready for review.

@adagioajanes adagioajanes marked this pull request as ready for review December 28, 2021 23:08
@Sxderp
Copy link
Contributor

Sxderp commented Jan 7, 2022

Your checkin function on the asset doesn't do all the same checks and debugging as the asset checkin controller.

--

As an aside, I'd request a followup PR that updates the asset checkin controller to use the new function on the model.

@adagioajanes
Copy link
Contributor Author

adagioajanes commented Jan 7, 2022

Your checkin function on the asset doesn't do all the same checks and debugging as the asset checkin controller.

I am trying to find those checks you are referring to. Perhaps you could give me an example or two?
EDIT: @Sxderp AH NEVERMIND! I found it. I was looking at the wrong controller...

As an aside, I'd request a followup PR that updates the asset checkin controller to use the new function on the model.

That would be nice. This PR isn't going to do that since it serves a different purpose. But I like the idea. :)

@adagioajanes
Copy link
Contributor Author

adagioajanes commented Jan 11, 2022

Your checkin function on the asset doesn't do all the same checks and debugging as the asset checkin controller.

@Sxderp Alright, I've been doing some thinking and reviewing on this. Take all of this with a grain of salt, as I could be wrong about design standards...

checkIn() on the model shouldn't be responsible for these checks, right? When designing an eloquent model, the functions on it should rely on the controller to perform the checks for authorization and existence, not the model itself. It is assumed that once you can instantiate a model, it exists. If we couldn't instantiate it, then we wouldn't be able to get as far as checking it in.

That being said, the checks you are referring to are performed at different parts of the application, outside of the model. First, the view itself won't let you select an asset that doesn't exist, or isn't eligible for check in. Next, the BulkAssetsController storeCheckin() function is performing a check to ensure we are even calling assets, and whether we are authorized to work with them. I will put code reviews for you on those sections.

Thoughts?

EDIT: Oh, also, this was designed to work very nearly exactly how the bulk checkout function currently operates. I assume if bulk checkout is written this way, then this is how @snipe wanted bulk checkin written? (Please don't let me put words in your mouth @snipe. I am referring to #10455 (comment))

Copy link
Contributor Author

@adagioajanes adagioajanes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sxderp Added comments to the lines of code that perform these checks. Please let me know your thoughts at your convenience. :)

app/Models/Asset.php Show resolved Hide resolved
@Sxderp
Copy link
Contributor

Sxderp commented Jan 12, 2022

I was mostly talking about this bit:

if ($asset->rtd_location_id == '0') {
\Log::debug('Manually override the RTD location IDs');
\Log::debug('Original RTD Location ID: '.$asset->rtd_location_id);
$asset->rtd_location_id = '';
\Log::debug('New RTD Location ID: '.$asset->rtd_location_id);
}
if ($asset->location_id == '0') {
\Log::debug('Manually override the location IDs');
\Log::debug('Original Location ID: '.$asset->location_id);
$asset->location_id = '';
\Log::debug('New RTD Location ID: '.$asset->location_id);
}
$asset->location_id = $asset->rtd_location_id;
\Log::debug('After Location ID: '.$asset->location_id);
\Log::debug('After RTD Location ID: '.$asset->rtd_location_id);
if ($request->filled('location_id')) {
\Log::debug('NEW Location ID: '.$request->get('location_id'));
$asset->location_id = e($request->get('location_id'));
}

It's backwards compatibility code that likely needs to remain even for bulk checkin.

@adagioajanes
Copy link
Contributor Author

adagioajanes commented Jan 12, 2022

It's backwards compatibility code that likely needs to remain even for bulk checkin.

@Sxderp Got ya. I will work on implementing that. Thank you so much for clarifying. :)

You are correct. Implementing it into the model itself would be ideal, especially because it's to correct a backwards compatibility issue that affects the model itself.

@adagioajanes
Copy link
Contributor Author

Alright, I pushed that update, but I haven't had the chance to test it. I will try to get testing in today.

…nnot_be_null

Fixes: Column activated cannot be null [sc-18528]
@adagioajanes
Copy link
Contributor Author

adagioajanes commented Feb 2, 2022

Because #10455 was merged, there is the potential that this PR may be un-needed entirely now.

However, continuing to operate under the assumption that this COULD be potentially merged in the future, what would make the most sense in terms of menu arrangement for this? Would it make sense to rename "Quick Scan Checkin" to "Bulk Checkin" and offer the option of which experience the user wants?

Just spit balling UI/UX ideas here.

@adagioajanes
Copy link
Contributor Author

Because #10455 was merged, this PR may be unnecessary now. Unless there is some additional demand for this in the near future, or a desire from @snipe to implement this, I won't be putting any additional work into it.

@snipe snipe closed this May 29, 2024
@jose-duarte
Copy link

Apologies for reopening this but in my opinion there's still space for bulk checkin since it still differs from the "Quick Scan Checkin" menu.

The biggest point is for people not using a barcode scanner, when you do a bulk checkout, you can easily use your numpad to write down the X digits of your asset tag and press enter (it will search on the background for the best match).
For the "Quick Scan Checkin" you don't have that option which pushes you to write down the whole asset tag, including prefix. This, as you can imagine, consumes a lot of time.

Hopefully you consider moving forward with this feature which could still co-live with the quick scan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants