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

Adds ability to mass email all assigned list to #11821

Conversation

Godmartinz
Copy link
Collaborator

Description

Adds the ability to send all users a list of their devices.
image
There are a lot of buttons in the picture above. Open to placing the button in another suggested place.

Fixes # sc-19519 fd-30564

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [ X] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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

  • Test A
  • Test B

Test Configuration:

  • PHP version:
  • MySQL version
  • Webserver version
  • OS version

Checklist:

@snipe
Copy link
Owner

snipe commented Sep 14, 2022

Is this email I just got from your testing?

Screen Shot 2022-09-14 at 10 18 37 AM

@Godmartinz
Copy link
Collaborator Author

Ah yes it is, I re-seeded my db so your email is back in there. I will remove that now. (also you have no assets assigned to you on my local 😄 )

@snipe
Copy link
Owner

snipe commented Sep 14, 2022

All good :) Just that if nothing is assigned to a user, they probably shouldn't get an email, right?

Copy link
Owner

@snipe snipe left a comment

Choose a reason for hiding this comment

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

We should probably not send emails to users who do not have anything assigned to them.

app/Http/Controllers/Users/UsersController.php Outdated Show resolved Hide resolved
@Godmartinz Godmartinz force-pushed the feature/sc-19519/ability-to-mass-email-all-assigned-list-to branch from 260b4dc to 87a1af9 Compare October 4, 2022 17:22
@Godmartinz Godmartinz requested a review from snipe October 18, 2022 18:03
snipe and others added 2 commits November 8, 2022 16:01
Signed-off-by: snipe <snipe@snipe.net>

(cherry picked from commit 7c21158)
@Godmartinz
Copy link
Collaborator Author

Emailing users only if they have assets has been implemented. we just have a crappy Ux placement for right now 🙁

@okkhalid
Copy link

Hi, is this script will be added to the new version? also can we select specific people to send the assets?

@MajorBlackbird
Copy link

Hey,

firstly thanks for your guys work you put into this. :)
Couldnt you, at least for now, add it as a point in the dropdown menu on the "People" page?

grafik

@snipe
Copy link
Owner

snipe commented Feb 4, 2023

That would only imply it only affects the visible users on that page (since everything else in that menu does that), which isn't what that functionality does.

@@ -254,7 +254,7 @@ public function getImageUrl()
*/
public function users()
{
return $this->belongsToMany(\App\Models\User::class, 'accessories_users', 'accessory_id', 'assigned_to')->withPivot('id', 'created_at', 'note')->withTrashed();
return $this->belongsToMany(\App\Models\User::class, 'accessories_users', 'accessory_id', 'assigned_to')->withPivot('id', 'created_at' , 'note')->withTrashed();
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure why this extra space was put in here?

@@ -249,4 +251,38 @@ protected function logItemCheckinAndDelete($items, $itemType)
$logAction->logaction('checkin from');
}
}
protected function findAssetOwners()
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think this method is needed here. We have existing methods on the model that we can likely use instead of duplicating code here, esp since this method is only used once.

@@ -249,4 +251,38 @@ protected function logItemCheckinAndDelete($items, $itemType)
$logAction->logaction('checkin from');
}
}
protected function findAssetOwners()
{
$asset_owners= Asset::all()->where('assigned_to', '!=', null)->pluck('assigned_to')->toArray();
Copy link
Owner

Choose a reason for hiding this comment

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

This call as it is now would erroneously include the ids of users when it shouldn't, for example if an asset is checked out to a location.

@snipe
Copy link
Owner

snipe commented Feb 4, 2023

@MajorBlackbird until this gets added into the GUI, you can use this cli command to accomplish what this PR does: https://snipe-it.readme.io/docs/user-inventory

Snipe-IT Documentation
Snipe-IT offers an optional command line utility for sending out emails to your users that have items checked out to them, to remind them of what has been issued to them. This can be useful if your auditing process is a little more information, and you ask your users to self-report whether or not al...

@MajorBlackbird
Copy link

MajorBlackbird commented Feb 6, 2023

@MajorBlackbird until this gets added into the GUI, you can use this cli command to accomplish what this PR does: https://snipe-it.readme.io/docs/user-inventory

Snipe-IT Documentation**User Inventory**Snipe-IT offers an optional command line utility for sending out emails to your users that have items checked out to them, to remind them of what has been issued to them. This can be useful if your auditing process is a little more information, and you ask your users to self-report whether or not al...

Wow thank you very much and sorry for missing that in the documentation!

Snipe-IT Documentation
Snipe-IT offers an optional command line utility for sending out emails to your users that have items checked out to them, to remind them of what has been issued to them. This can be useful if your auditing process is a little more information, and you ask your users to self-report whether or not al...

@snipe snipe closed this May 10, 2023
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #19519: Ability to mass email "All Assigned" list to each user.

@snipe
Copy link
Owner

snipe commented May 10, 2023

Closing this for housekeeping for now - we can discuss and possibly re-open later

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.

4 participants