Compare commits

..

133 Commits

Author SHA1 Message Date
snipe
9e23117f9c Merge remote-tracking branch 'origin/develop' 2025-11-26 00:35:26 +00:00
snipe
b3996f1970 In the sea, @uberbrady! (fixed missing semicolon) 2025-11-26 00:35:16 +00:00
snipe
a3bfcc962d Merge remote-tracking branch 'origin/develop' 2025-11-25 18:50:23 +00:00
snipe
ca4ed605a8 Merge pull request #18246 from Godmartinz/resize-label-fields-conditionally-L6009_A
Fixes [FD-52064] Avery `L6009_A` & `L4736_A` label field overflow with scaling
2025-11-25 18:37:06 +00:00
Godfrey M
d3e6d7442f typo bonanza 2025-11-25 10:30:56 -08:00
Godfrey M
b558bc5334 change variable" 2025-11-25 10:30:06 -08:00
Godfrey M
204d7b5be6 added scaling to L4736_A 2025-11-25 10:23:08 -08:00
Godfrey M
7dccfec332 adds notes 2025-11-25 10:12:27 -08:00
snipe
0b694bfd0b Merge remote-tracking branch 'origin/develop' 2025-11-25 18:02:23 +00:00
snipe
dfb59d8a55 Added link to rudder2snipe repo 2025-11-25 18:01:29 +00:00
snipe
56a44ad421 Merge remote-tracking branch 'origin/develop' 2025-11-25 13:38:54 +00:00
snipe
a12ee3c0da Merge pull request #18245 from uberbrady/redirect_upgrader
Add new 'git remote' management to change Snipe-IT URLs
2025-11-25 13:38:31 +00:00
Brady Wetherington
a657c479be Add new 'git remote' management to change Snipe-IT URL's 2025-11-25 13:17:56 +00:00
Godfrey M
ab82c5fd88 resizes label field box to size if needed 2025-11-24 11:04:23 -08:00
snipe
78cfb19f69 Merge remote-tracking branch 'origin/develop' 2025-11-24 17:40:26 +00:00
snipe
f2334082ee Added tag color to location query 2025-11-24 17:40:13 +00:00
snipe
58a47cb52b Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2025-11-24 12:32:17 +00:00
snipe
c7cb4674f5 Bumped version 2025-11-24 12:31:50 +00:00
snipe
523df21d83 Merge remote-tracking branch 'origin/develop' 2025-11-24 12:30:22 +00:00
snipe
82314076a9 Updated translations 2025-11-24 12:30:07 +00:00
snipe
d04bf2e8f2 Merge remote-tracking branch 'origin/develop' 2025-11-24 11:37:44 +00:00
snipe
a1c67b5154 Fixed user details toggle 2025-11-24 11:37:14 +00:00
snipe
3e343fe8b7 Merge pull request #18236 from grokability/dependabot/github_actions/develop/actions/checkout-6
Bump actions/checkout from 5 to 6
2025-11-24 08:33:46 +00:00
dependabot[bot]
e288c942ee Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 08:04:19 +00:00
snipe
7a1ccb0d53 Nicer query 2025-11-23 14:09:55 +00:00
snipe
89656c7e65 Merge remote-tracking branch 'origin/develop' 2025-11-23 14:05:39 +00:00
snipe
7f76198139 Fixed RB-20501 - correctly return error response when license+seat don’t match
TypeError: App\Http\Transformers\LicenseSeatsTransformer::transformLicenseSeat(): Argument #1 ($seat) must be of type App\Models\LicenseSeat, bool given, called in /snipe-it/app/Http/Controllers/Api/LicenseSeatsController.php on line 92
2025-11-23 14:05:24 +00:00
snipe
5ff813f9b7 Merge pull request #18233 from grokability/develop
Merging from dev
2025-11-22 14:24:36 +00:00
snipe
69994e0c11 Merge pull request #18232 from grokability/check-for-valid-json-on-filter
Added filter form request to validate JSON
2025-11-22 14:22:33 +00:00
snipe
aa959fbe92 Added filter form request to validate JSON 2025-11-22 14:03:58 +00:00
snipe
948b7cda15 Merge remote-tracking branch 'origin/develop' 2025-11-22 12:04:28 +00:00
snipe
644ef040d0 Merge pull request #18226 from Godmartinz/audit-notification-rb-19608
Fixes RB-19608 adds safe guards, adds Audit notification for google workspace, adds tests
2025-11-22 11:41:57 +00:00
snipe
33839d7244 Re-added the horizontal class 2025-11-22 11:14:59 +00:00
Godfrey M
48270cb9b4 url trim 2025-11-21 10:11:28 -08:00
Godfrey M
cd42760b68 notes 2025-11-20 14:25:13 -08:00
Godfrey M
1116da389e add google chat to audit notification test 2025-11-20 14:24:03 -08:00
Godfrey M
24d7ae4a2f added google chat to audit notifications" 2025-11-20 14:22:08 -08:00
Godfrey M
e598ef6e05 adds tests, webhook enable settings 2025-11-20 13:51:14 -08:00
snipe
6601e73069 Merge remote-tracking branch 'origin/develop' 2025-11-20 20:15:44 +00:00
snipe
7f2a80552b Fixed form layout for SAML 2025-11-20 20:15:34 +00:00
Godfrey M
eceeb4aa3b return if there is no item for the audit notification 2025-11-20 10:56:43 -08:00
snipe
b5c7f374f3 Merge remote-tracking branch 'origin/develop' 2025-11-20 13:44:19 +00:00
snipe
9d08e2d297 Clearer language 2025-11-20 13:44:09 +00:00
snipe
f2303ae2dc Merge remote-tracking branch 'origin/develop' 2025-11-20 13:28:00 +00:00
snipe
4d44fd47c3 Merge pull request #18217 from Godmartinz/unaccepted-row-null-fix
Fixes FD-52005 Adds null safe operators to unacceptable items report
2025-11-20 13:27:24 +00:00
snipe
88635cb6c3 Merge pull request #18223 from grokability/#18114-fixed-declined-notification-added-x-header
Fixed #18114 - include declined item name, added app headers
2025-11-20 13:27:01 +00:00
snipe
1687fcc035 Small subject tweaks 2025-11-20 13:23:17 +00:00
snipe
39e7937458 Fixed #18114 - include declined item name, added app headers 2025-11-20 12:58:53 +00:00
Godfrey M
60ff2970f0 safeguard null rows by filtering rows in query 2025-11-19 11:35:24 -08:00
Godfrey M
212cd026a3 add null safe operators to company and csv plain values 2025-11-18 12:36:07 -08:00
snipe
cf47f8fea9 Merge pull request #18216 from Godmartinz/fix-license-patch-to-allow-update-of-other-fields
Fixed #18024 License Seat update/patch method
2025-11-18 20:29:18 +00:00
Godfrey M
4b45ffd841 updating fields of checkout now works 2025-11-18 11:35:26 -08:00
snipe
69a57b77c9 Merge remote-tracking branch 'origin/develop' 2025-11-18 13:13:48 +00:00
snipe
5daba6034d Merge pull request #18213 from grokability/#18202-copy-to-clipboard-spaces
Fixed #18202 - copy to clipboard adding spaces in FF
2025-11-18 13:13:29 +00:00
snipe
4e5c19e932 Fixed #18202 - copy to clipboard adding spaces in FF 2025-11-18 13:11:40 +00:00
snipe
5eb73baf5e Removed duplicate formatter 2025-11-18 12:54:21 +00:00
snipe
d819f31bdd Merge remote-tracking branch 'origin/develop' 2025-11-18 12:01:01 +00:00
snipe
a97c453706 Small fixes for user profiles 2025-11-18 11:59:54 +00:00
snipe
5ee955a713 Merge remote-tracking branch 'origin/develop' 2025-11-18 11:40:23 +00:00
snipe
57224f7304 Fixed #18209 - translate asset filters 2025-11-18 11:40:15 +00:00
snipe
270d145466 Merge remote-tracking branch 'origin/develop' 2025-11-18 11:15:31 +00:00
snipe
c564ee6093 Fixed #18211 - limit regex field to 191 characters 2025-11-18 11:15:15 +00:00
snipe
caaa9ab23e Merge pull request #18122 from chruoss/master
Renamed L6009 -> L4736 and added correct L6009
2025-11-17 21:40:08 +00:00
snipe
b6d2c6d28c Merge pull request #18208 from marcusmoore/fixes/null-array-filter
Fixed potential exception while filtering in users index endpoint
2025-11-17 21:39:08 +00:00
Marcus Moore
c36c8968d3 Avoid passing null to array_filter in user controller 2025-11-17 10:26:29 -08:00
snipe
b019af1851 Merge remote-tracking branch 'origin/develop' 2025-11-17 17:50:30 +00:00
snipe
bcd32da2bc Remove loading user count since we don’t use it for depts 2025-11-17 17:34:43 +00:00
snipe
6f97a40372 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	public/css/build/app.css
#	public/css/build/app.css.map
#	public/css/build/overrides.css
#	public/css/build/overrides.css.map
#	public/css/dist/all.css
#	public/js/dist/all.js
#	public/js/dist/all.js.map
#	public/mix-manifest.json
2025-11-17 13:37:16 +00:00
snipe
c56c7ddd03 Merge pull request #18201 from grokability/#18185-added-tag-color-to-companies
Added #18185 added tag color to companies
2025-11-17 13:33:17 +00:00
snipe
9a0dd604c9 Small layout tweaks 2025-11-17 13:21:01 +00:00
snipe
a1dec176a1 Added mobile 2025-11-17 13:09:13 +00:00
snipe
67032d068d Removed space 2025-11-17 13:09:08 +00:00
snipe
401c83945d Updated gate check on presenters 2025-11-17 13:07:28 +00:00
snipe
ed6d020edb Fixed permission name for locations 2025-11-17 12:31:18 +00:00
snipe
8eb5600b1e Fixed manufacturer link 2025-11-17 12:19:27 +00:00
snipe
9c4cd69106 Updated checkout blades 2025-11-17 12:15:38 +00:00
snipe
64cbe0c960 Use dept presenter 2025-11-17 12:15:25 +00:00
snipe
be70b217d9 Updated presenters 2025-11-17 12:11:38 +00:00
snipe
b4f5260dda Updated controllers to use tag_color 2025-11-17 11:36:11 +00:00
snipe
83e446f99c Updated formatters to use tag_color if given 2025-11-17 11:18:38 +00:00
snipe
767139cf0b Updated select2 to use tag_color if available 2025-11-17 11:18:21 +00:00
snipe
e3ac60111f Added tag_color to factories 2025-11-17 11:18:02 +00:00
snipe
c694c11724 Added presenter reference 2025-11-15 14:58:02 +00:00
snipe
b50765a151 Added more to the views 2025-11-15 14:50:51 +00:00
snipe
590f77bdb4 Updated controllers and presenters 2025-11-14 17:58:27 +00:00
snipe
09575e5312 Added tag color to transformer 2025-11-14 15:58:07 +00:00
snipe
1693825dd0 Added translations 2025-11-14 15:57:57 +00:00
snipe
5a89056112 Added migration 2025-11-14 15:57:47 +00:00
snipe
2ee51bb282 Added tag color to transformer 2025-11-14 15:57:39 +00:00
snipe
ea7cffc1a3 Made tag_color fillable 2025-11-14 15:57:27 +00:00
snipe
c20d1b82ae Added tag color to controllers 2025-11-14 15:57:18 +00:00
snipe
607781382f Merge remote-tracking branch 'origin/develop' 2025-11-14 14:10:05 +00:00
snipe
4e8c1e853b Fixed markdown in upcoming audits email 2025-11-14 14:09:53 +00:00
snipe
2c6869501e Merge remote-tracking branch 'origin/develop' 2025-11-13 16:46:32 +00:00
snipe
4509e1d1dc Merge pull request #18195 from grokability/#18189-day-of-week
Fixed #18189 - added option to pick the day the week starts on
2025-11-13 16:46:15 +00:00
snipe
6b9d4941be Language tweaks 2025-11-13 16:35:40 +00:00
snipe
308cd6b91d Fixed #18189 - added option to pick the day the week starts on 2025-11-13 16:33:08 +00:00
snipe
23b54de8bd Merge remote-tracking branch 'origin/develop' 2025-11-13 15:37:42 +00:00
snipe
bd742aec9c Merge pull request #18192 from Godmartinz/fix-requestable-asset-model-query
Fixes FD51910 requestable asset model available quantity count
2025-11-13 15:37:24 +00:00
snipe
d2ab3071a6 Merge pull request #18193 from ubc-cpsc/bugfix/CVE-2025-64500
Fixes CVE-2025-64500: Incorrect parsing of PATH_INFO can lead to limited authorization
2025-11-13 09:52:50 +00:00
Joël Pittet
1dd4c161f0 Fixes CVE-2025-64500 2025-11-12 18:09:37 -08:00
Godfrey M
5e48dd45b2 remove unnecessary code 2025-11-12 16:27:04 -08:00
Godfrey M
601d6e7377 fixes requestable models query 2025-11-12 16:25:08 -08:00
snipe
3934b40282 Merge remote-tracking branch 'origin/develop' 2025-11-12 20:59:15 +00:00
snipe
d43be271e6 Small tweaks to user group listings 2025-11-12 20:59:06 +00:00
snipe
d3c9963051 Merge remote-tracking branch 'origin/develop' 2025-11-12 20:25:00 +00:00
snipe
92a3bdf4e9 Merge pull request #18191 from grokability/limit-adding-users-to-group-if-over-limit
Set a limit on number of users for group user loading
2025-11-12 20:24:24 +00:00
snipe
fa2aafe41f Set a limit on number of users for group user loading 2025-11-12 20:19:52 +00:00
snipe
bc5da2532c Merge remote-tracking branch 'origin/develop' 2025-11-12 16:02:01 +00:00
snipe
a7be1acbd8 Merge pull request #18190 from grokability/improved-checkin-reminders
Improved overdue checkin alert
2025-11-12 16:01:32 +00:00
snipe
fbe2ae03ff Use due_checkin_days setting instead of audit warning days 2025-11-12 15:52:16 +00:00
snipe
d1a492f953 Improved overdue checkin alert 2025-11-12 15:38:47 +00:00
snipe
ac6ea8bdcc Merge remote-tracking branch 'origin/develop' 2025-11-11 18:43:54 +00:00
snipe
352807c2d7 Fixed RB-20498 - Check that logo file exists on acceptance 2025-11-11 18:43:39 +00:00
snipe
dc4cf8496a Merge remote-tracking branch 'origin/develop' 2025-11-11 14:01:54 +00:00
snipe
ed79d21e1b Merge remote-tracking branch 'origin/develop' 2025-11-11 13:53:55 +00:00
snipe
743d340bca Merge remote-tracking branch 'origin/develop' 2025-11-11 13:18:18 +00:00
snipe
3d1398ab97 Merge remote-tracking branch 'origin/develop' 2025-11-11 12:29:44 +00:00
snipe
7a680ce4ff Merge remote-tracking branch 'origin/develop' 2025-11-10 21:31:28 +00:00
snipe
2ac4456f4e Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2025-11-10 20:58:15 +00:00
snipe
391aa30da2 Bumped version 2025-11-10 13:49:26 +00:00
snipe
f92f76b48a Merge remote-tracking branch 'origin/develop' 2025-11-07 13:42:04 +00:00
snipe
61b6d4dc47 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	public/css/dist/skins/_all-skins.css
#	public/css/dist/skins/_all-skins.css.map
#	public/css/dist/skins/_all-skins.min.css
#	public/css/dist/skins/skin-black-dark.css
#	public/css/dist/skins/skin-black-dark.css.map
#	public/css/dist/skins/skin-black-dark.min.css
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.css.map
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.css.map
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.css.map
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.css.map
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.css.map
#	public/css/dist/skins/skin-red-dark.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.css.map
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/js/dist/all.js.map
#	public/mix-manifest.json
2025-11-07 13:26:23 +00:00
snipe
aa041e39eb Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	public/js/dist/all.js
#	public/js/dist/all.js.map
#	public/mix-manifest.json
2025-11-06 21:12:42 +00:00
snipe
723abca34a Merge remote-tracking branch 'origin/develop' 2025-11-05 15:28:40 +00:00
snipe
32b28327e9 Merge remote-tracking branch 'origin/develop' 2025-11-04 21:42:05 +00:00
snipe
c30131275f Merge remote-tracking branch 'origin/develop' 2025-11-04 21:23:14 +00:00
snipe
56218dfcb2 Merge remote-tracking branch 'origin/develop' 2025-11-04 19:39:52 +00:00
snipe
0d2a75db0a Merge remote-tracking branch 'origin/develop' 2025-11-04 19:04:25 +00:00
snipe
eb9d066844 Merge remote-tracking branch 'origin/develop' 2025-11-04 18:56:15 +00:00
snipe
029f3030a7 Merge remote-tracking branch 'origin/develop' 2025-11-04 16:06:35 +00:00
snipe
8c59a8d405 Merged clipboard PR and generated prod assets 2025-11-03 17:39:41 +00:00
chruoss
6904ad02a2 Renamed L6009.php -> L4736.php
Renamed L6009_A.php -> L4736_A.php
Added correct L6009.php
Added correct L6009_A.php
2025-10-29 15:13:12 +01:00
714 changed files with 5463 additions and 151039 deletions

View File

@@ -197,7 +197,7 @@ REPORT_TIME_LIMIT=12000
API_THROTTLE_PER_MINUTE=120
CSV_ESCAPE_FORMULAS=true
LIVEWIRE_URL_PREFIX=null
MAX_UNPAGINATED=5000
# --------------------------------------------
# OPTIONAL: SAML SETTINGS

View File

@@ -26,7 +26,7 @@ jobs:
language: [ 'javascript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -32,7 +32,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v6
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Crowdin push
uses: crowdin/github-action@v2

View File

@@ -42,7 +42,7 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v5
uses: actions/checkout@v6
# https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx

View File

@@ -42,7 +42,7 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v5
uses: actions/checkout@v6
# https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx

View File

@@ -11,7 +11,7 @@ jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Docker Hub Description
uses: grokability/dockerhub-description@7ea9d275c7cdbe2b676a093a0308c50665e3b8b4

View File

@@ -37,7 +37,7 @@ jobs:
php-version: "${{ matrix.php-version }}"
coverage: none
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Get Composer Cache Directory
id: composer-cache

View File

@@ -34,7 +34,7 @@ jobs:
php-version: "${{ matrix.php-version }}"
coverage: none
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Get Composer Cache Directory
id: composer-cache

View File

@@ -25,7 +25,7 @@ jobs:
php-version: "${{ matrix.php-version }}"
coverage: none
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Get Composer Cache Directory
id: composer-cache

View File

@@ -83,6 +83,7 @@ Since the release of the JSON REST API, several third-party developers have been
- [jamf2snipe](https://github.com/grokability/jamf2snipe) - Python script to sync assets between a JAMFPro instance and a Snipe-IT instance
- [jamf-snipe-rename](https://macblog.org/jamf-snipe-rename/) - Python script to rename computers in Jamf from Snipe-IT
- [Snipe-IT plugin for Jira Service Desk](https://marketplace.atlassian.com/apps/1220964/snipe-it-for-jira)
- [Rudder2Snipe](https://github.com/norbertoaquino/rudder2snipe) by [@norbertoaquino](https://github.com/norbertoaquino) - Rudder.io integration for Snipe-IT
- [Python 3 CSV importer](https://github.com/gastamper/snipeit-csvimporter) - allows importing assets into Snipe-IT based on Item Name rather than Asset Tag.
- [Snipe-IT Kubernetes Helm Chart](https://github.com/t3n/helm-charts/tree/master/snipeit) - For more information, [click here](https://hub.helm.sh/charts/t3n/snipeit).
- [Snipe-IT Bulk Edit](https://github.com/bricelabelle/snipe-it-bulkedit) - Google Script files to use Google Sheets as a bulk checkout/checkin/edit tool for Snipe-IT.

View File

@@ -9,6 +9,8 @@ use App\Notifications\ExpectedCheckinAdminNotification;
use App\Notifications\ExpectedCheckinNotification;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Notification;
use App\Helpers\Helper;
class SendExpectedCheckinAlerts extends Command
{
@@ -17,7 +19,7 @@ class SendExpectedCheckinAlerts extends Command
*
* @var string
*/
protected $name = 'snipeit:expected-checkin';
protected $signature = 'snipeit:expected-checkin {--with-output : Display the results in a table in your console in addition to sending the email}';
/**
* The console command description.
@@ -42,19 +44,47 @@ class SendExpectedCheckinAlerts extends Command
public function handle()
{
$settings = Setting::getSettings();
$interval = $settings->audit_warning_days ?? 0;
$interval = $settings->due_checkin_days ?? 0;
$today = Carbon::now();
$interval_date = $today->copy()->addDays($interval);
$count = 0;
if (!$this->option('with-output')) {
$this->info('Run this command with the --with-output option to see the full list in the console.');
}
$assets = Asset::whereNull('deleted_at')->DueOrOverdueForCheckin($settings)->orderBy('assets.expected_checkin', 'desc')->get();
$this->info($assets->count().' assets must be checked in on or before '.$interval_date.' is deadline');
$this->info($assets->count().' assets must be checked on or before '.Helper::getFormattedDateObject($interval_date, 'date', false));
foreach ($assets as $asset) {
if ($asset->assignedTo && (isset($asset->assignedTo->email)) && ($asset->assignedTo->email!='') && $asset->checkedOutToUser()) {
$this->info('Sending User ExpectedCheckinNotification to: '.$asset->assignedTo->email);
$asset->assignedTo->notify((new ExpectedCheckinNotification($asset)));
$count++;
}
}
if ($this->option('with-output')) {
if (($assets) && ($assets->count() > 0) && ($settings->alert_email != '')) {
$this->table(
[
trans('general.id'),
trans('admin/hardware/form.tag'),
trans('admin/hardware/form.model'),
trans('general.model_no'),
trans('general.purchase_date'),
trans('admin/hardware/form.expected_checkin'),
],
$assets->map(fn($assets) => [
trans('general.id') => $assets->id,
trans('admin/hardware/form.tag') => $assets->asset_tag,
trans('admin/hardware/form.model') => $assets->model->name,
trans('general.model_no') => $assets->model->model_number,
trans('general.purchase_date') => $assets->purchase_date_formatted,
trans('admin/hardware/form.eol_date') => $assets->expected_checkin_formattedDate ? $assets->expected_checkin_formattedDate . ' (' . $assets->expected_checkin_diff_for_humans . ')' : '',
])
);
}
}
@@ -63,10 +93,11 @@ class SendExpectedCheckinAlerts extends Command
$recipients = collect(explode(',', $settings->alert_email))->map(function ($item) {
return new AlertRecipient($item);
});
$this->info('Sending Admin ExpectedCheckinNotification to: '.$settings->alert_email);
\Notification::send($recipients, new ExpectedCheckinAdminNotification($assets));
Notification::send($recipients, new ExpectedCheckinAdminNotification($assets));
}
$this->info('Sent checkin reminders to to '.$count.' users.');
}
}

View File

@@ -201,8 +201,6 @@ class IconHelper
return 'fa-solid fa-lightbulb';
case 'highlight':
return 'fa-solid fa-highlighter';
case 'inherit':
return 'fa-solid fa-layer-group';
}
}
}

View File

@@ -13,9 +13,9 @@ use App\Models\Company;
use App\Models\Contracts\Acceptable;
use App\Models\Setting;
use App\Models\User;
use App\Notifications\AcceptanceAssetAcceptedNotification;
use App\Notifications\AcceptanceAssetAcceptedToUserNotification;
use App\Notifications\AcceptanceAssetDeclinedNotification;
use App\Notifications\AcceptanceItemAcceptedNotification;
use App\Notifications\AcceptanceItemAcceptedToUserNotification;
use App\Notifications\AcceptanceItemDeclinedNotification;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
@@ -138,14 +138,14 @@ class AcceptanceController extends Controller
// Convert PDF logo to base64 for TCPDF
// This is needed for TCPDF to properly embed the image if it's a png and the cache isn't writable
$encoded_logo = null;
if ($settings->acceptance_pdf_logo) {
if (($settings->acceptance_pdf_logo) && (Storage::disk('public')->exists($settings->acceptance_pdf_logo))) {
$encoded_logo = base64_encode(file_get_contents(public_path() . '/uploads/' . $settings->acceptance_pdf_logo));
}
// Get the data array ready for the notifications and PDF generation
$data = [
'item_tag' => $item->asset_tag,
'item_name' => $item->name, // this handles licenses seats, which don't have a 'name' field
'item_name' => $item->display_name, // this handles licenses seats, which don't have a 'name' field
'item_model' => $item->model?->name,
'item_serial' => $item->serial,
'item_status' => $item->assetstatus?->name,
@@ -183,13 +183,13 @@ class AcceptanceController extends Controller
// Add the attachment for the signing user into the $data array
$data['file'] = $pdf_filename;
try {
$assigned_user->notify((new AcceptanceAssetAcceptedToUserNotification($data))->locale($assigned_user->locale));
$assigned_user->notify((new AcceptanceItemAcceptedToUserNotification($data))->locale($assigned_user->locale));
} catch (\Exception $e) {
Log::warning($e);
}
}
try {
$acceptance->notify((new AcceptanceAssetAcceptedNotification($data))->locale(Setting::getSettings()->locale));
$acceptance->notify((new AcceptanceItemAcceptedNotification($data))->locale(Setting::getSettings()->locale));
} catch (\Exception $e) {
Log::warning($e);
}
@@ -204,7 +204,7 @@ class AcceptanceController extends Controller
$acceptance->decline($sig_filename, $request->input('note'));
}
$acceptance->notify(new AcceptanceAssetDeclinedNotification($data));
$acceptance->notify(new AcceptanceItemDeclinedNotification($data));
Log::debug('New event acceptance.');
event(new CheckoutDeclined($acceptance));
$return_msg = trans('admin/users/message.declined');

View File

@@ -3,37 +3,38 @@
namespace App\Http\Controllers\Api;
use App\Events\CheckoutableCheckedIn;
use App\Http\Requests\StoreAssetRequest;
use App\Http\Requests\UpdateAssetRequest;
use App\Http\Traits\MigratesLegacyAssetLocations;
use App\Http\Transformers\ComponentsTransformer;
use App\Models\AccessoryCheckout;
use App\Models\CheckoutAcceptance;
use App\Models\LicenseSeat;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Gate;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Requests\AssetCheckoutRequest;
use App\Http\Requests\FilterRequest;
use App\Http\Requests\StoreAssetRequest;
use App\Http\Requests\UpdateAssetRequest;
use App\Http\Traits\MigratesLegacyAssetLocations;
use App\Http\Transformers\AssetsTransformer;
use App\Http\Transformers\ComponentsTransformer;
use App\Http\Transformers\LicensesTransformer;
use App\Http\Transformers\SelectlistTransformer;
use App\Models\AccessoryCheckout;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\CheckoutAcceptance;
use App\Models\Company;
use App\Models\CustomField;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\Location;
use App\Models\Setting;
use App\Models\User;
use App\View\Label;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;
use App\View\Label;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
@@ -56,7 +57,7 @@ class AssetsController extends Controller
* @param int $assetId
* @since [v4.0]
*/
public function index(Request $request, $action = null, $upcoming_status = null) : JsonResponse | array
public function index(FilterRequest $request, $action = null, $upcoming_status = null) : JsonResponse | array
{

View File

@@ -43,6 +43,7 @@ class CategoriesController extends Controller
'created_at',
'updated_at',
'image',
'tag_color',
'notes',
];
@@ -57,6 +58,7 @@ class CategoriesController extends Controller
'require_acceptance',
'checkin_email',
'image',
'tag_color',
'notes',
])
->with('adminuser')

View File

@@ -38,6 +38,7 @@ class CompaniesController extends Controller
'accessories_count',
'consumables_count',
'components_count',
'tag_color',
'notes',
];
@@ -64,6 +65,11 @@ class CompaniesController extends Controller
$companies->where('created_by', '=', $request->input('created_by'));
}
if ($request->filled('tag_color')) {
$companies->where('tag_color', '=', $request->input('tag_color'));
}
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $companies->count()) ? $companies->count() : app('api_offset_value');
@@ -191,6 +197,7 @@ class CompaniesController extends Controller
'companies.name',
'companies.email',
'companies.image',
'companies.tag_color',
]);

View File

@@ -24,7 +24,7 @@ class DepartmentsController extends Controller
public function index(Request $request) : JsonResponse | array
{
$this->authorize('view', Department::class);
$allowed_columns = ['id', 'name', 'image', 'users_count', 'notes'];
$allowed_columns = ['id', 'name', 'image', 'users_count', 'notes', 'tag_color'];
$departments = Department::select(
[
@@ -38,8 +38,9 @@ class DepartmentsController extends Controller
'departments.created_at',
'departments.updated_at',
'departments.image',
'departments.tag_color',
'departments.notes'
])->with('users')->with('location')->with('manager')->with('company')->withCount('users as users_count');
])->with('location')->with('manager')->with('company')->withCount('users as users_count');
if ($request->filled('search')) {
$departments = $departments->TextSearch($request->input('search'));
@@ -61,6 +62,10 @@ class DepartmentsController extends Controller
$departments->where('location_id', '=', $request->input('location_id'));
}
if ($request->filled('tag_color')) {
$departments->where('tag_color', '=', $request->input('departments.tag_color'));
}
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $departments->count()) ? $departments->count() : app('api_offset_value');
$limit = app('api_limit_value');
@@ -186,6 +191,7 @@ class DepartmentsController extends Controller
'id',
'name',
'image',
'tag_color',
]);
if ($request->filled('search')) {

View File

@@ -79,17 +79,14 @@ class LicenseSeatsController extends Controller
{
$this->authorize('view', License::class);
// sanity checks:
// 1. does the license seat exist?
if (! $licenseSeat = LicenseSeat::find($seatId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat not found'));
}
// 2. does the seat belong to the specified license?
if (! $licenseSeat = $licenseSeat->license()->first() || $licenseSeat->id != intval($licenseId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat does not belong to the specified license'));
if ($licenseSeat = LicenseSeat::where('license_id', $licenseId)->find($seatId)) {
return (new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat);
}
return (new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat);
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat ID or license not found or the seat does not belong to this license'));
}
/**
@@ -122,17 +119,22 @@ class LicenseSeatsController extends Controller
// check if this update is a checkin operation
// 1. are relevant fields touched at all?
$touched = $licenseSeat->isDirty('assigned_to') || $licenseSeat->isDirty('asset_id');
// 2. are they cleared? if yes then this is a checkin operation
$is_checkin = ($touched && $licenseSeat->assigned_to === null && $licenseSeat->asset_id === null);
$assignmentTouched = $licenseSeat->isDirty('assigned_to') || $licenseSeat->isDirty('asset_id');
$anythingTouched = $licenseSeat->isDirty();
if (! $touched) {
// nothing to update
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
if (! $anythingTouched) {
return response()->json(
Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success'))
);
}
if( $touched && $licenseSeat->unreassignable_seat) {
if( $assignmentTouched && $licenseSeat->unreassignable_seat) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/licenses/message.checkout.unavailable')));
}
// 2. are they cleared? if yes then this is a checkin operation
$is_checkin = ($assignmentTouched && $licenseSeat->assigned_to === null && $licenseSeat->asset_id === null);
$target = null;
// the logging functions expect only one "target". if both asset and user are present in the request,
// we simply let assets take precedence over users...
if ($licenseSeat->isDirty('assigned_to')) {
@@ -142,25 +144,23 @@ class LicenseSeatsController extends Controller
$target = $is_checkin ? $oldAsset : Asset::find($licenseSeat->asset_id);
}
if (is_null($target)){
if ($assignmentTouched && is_null($target)){
return response()->json(Helper::formatStandardApiResponse('error', null, 'Target not found'));
}
if ($licenseSeat->save()) {
if ($is_checkin) {
if(!$licenseSeat->license->reassignable){
$licenseSeat->unreassignable_seat = true;
$licenseSeat->save();
if($assignmentTouched) {
if ($is_checkin) {
if (!$licenseSeat->license->reassignable) {
$licenseSeat->unreassignable_seat = true;
$licenseSeat->save();
}
$licenseSeat->logCheckin($target, $licenseSeat->notes);
} else {
// in this case, relevant fields are touched but it's not a checkin operation. so it must be a checkout operation.
$licenseSeat->logCheckout($request->input('notes'), $target);
}
$licenseSeat->logCheckin($target, $licenseSeat->notes);
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
}
// in this case, relevant fields are touched but it's not a checkin operation. so it must be a checkout operation.
$licenseSeat->logCheckout($request->input('notes'), $target);
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
}

View File

@@ -59,6 +59,7 @@ class LocationsController extends Controller
'state',
'updated_at',
'zip',
'tag_color',
'notes',
];
@@ -81,6 +82,8 @@ class LocationsController extends Controller
'locations.ldap_ou',
'locations.currency',
'locations.company_id',
'locations.tag_color',
'locations.tag_color',
'locations.notes',
'locations.created_by',
'locations.deleted_at',
@@ -145,6 +148,10 @@ class LocationsController extends Controller
$locations->onlyTrashed();
}
if ($request->filled('tag_color')) {
$locations->where('tag_color', '=', $request->input('locations.tag_color'));
}
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $locations->count()) ? $locations->count() : app('api_offset_value');
$limit = app('api_limit_value');
@@ -235,6 +242,7 @@ class LocationsController extends Controller
'locations.currency',
'locations.company_id',
'locations.notes',
'locations.tag_color',
])
->withCount('assignedAssets as assigned_assets_count')
->withCount('assets as assets_count')
@@ -402,6 +410,7 @@ class LocationsController extends Controller
'locations.name',
'locations.parent_id',
'locations.image',
'locations.tag_color',
]);
// Only scope locations if the setting is enabled

View File

@@ -47,6 +47,7 @@ class ManufacturersController extends Controller
'consumables_count',
'components_count',
'licenses_count',
'tag_color',
'notes',
];
@@ -63,6 +64,7 @@ class ManufacturersController extends Controller
'updated_at',
'image',
'deleted_at',
'tag_color',
'notes',
])
->with('adminuser')
@@ -104,6 +106,10 @@ class ManufacturersController extends Controller
$manufacturers->where('support_email', '=', $request->input('support_email'));
}
if ($request->filled('tag_color')) {
$manufacturers->where('tag_color', '=', $request->input('manufacturers.tag_color'));
}
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $manufacturers->count()) ? $manufacturers->count() : app('api_offset_value');
$limit = app('api_limit_value');
@@ -258,6 +264,7 @@ class ManufacturersController extends Controller
'id',
'name',
'image',
'tag_color',
]);
if ($request->filled('search')) {

View File

@@ -50,12 +50,13 @@ class SuppliersController extends Controller
'accessories_count',
'components_count',
'consumables_count',
'tag_color',
'url',
'notes',
];
$suppliers = Supplier::select(
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip'])
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip', 'tag_color'])
->withCount('assets as assets_count')
->withCount('licenses as licenses_count')
->withCount('accessories as accessories_count')
@@ -251,6 +252,7 @@ class SuppliersController extends Controller
'id',
'name',
'image',
'tag_color',
]);
if ($request->filled('search')) {

View File

@@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Log;
use App\Http\Requests\DeleteUserRequest;
use Illuminate\Http\JsonResponse;
use App\Http\Requests\FilterRequest;
class UsersController extends Controller
{
@@ -42,7 +43,7 @@ class UsersController extends Controller
*
* @return array
*/
public function index(Request $request) : array
public function index(FilterRequest $request) : array
{
$this->authorize('view', User::class);
@@ -162,6 +163,11 @@ class UsersController extends Controller
if ($request->filled('filter')) {
$filter = json_decode($request->input('filter'), true);
if (is_null($filter)) {
$filter = [];
}
$filter = array_filter($filter, function ($key) use ($allowed_columns) {
return in_array($key, $allowed_columns);
}, ARRAY_FILTER_USE_KEY);

View File

@@ -78,6 +78,7 @@ class CategoriesController extends Controller
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->alert_on_response = $request->input('alert_on_response', '0');
$category->checkin_email = $request->input('checkin_email', '0');
$category->tag_color = $request->input('tag_color');
$category->notes = $request->input('notes');
$category->created_by = auth()->id();
@@ -132,6 +133,7 @@ class CategoriesController extends Controller
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->alert_on_response = $request->input('alert_on_response', '0');
$category->checkin_email = $request->input('checkin_email', '0');
$category->tag_color = $request->input('tag_color');
$category->notes = $request->input('notes');
$category = $request->handleImages($category);

View File

@@ -60,6 +60,7 @@ final class CompaniesController extends Controller
$company->phone = $request->input('phone');
$company->fax = $request->input('fax');
$company->email = $request->input('email');
$company->tag_color = $request->input('tag_color');
$company->notes = $request->input('notes');
$company->created_by = auth()->id();
@@ -102,6 +103,7 @@ final class CompaniesController extends Controller
$company->phone = $request->input('phone');
$company->fax = $request->input('fax');
$company->email = $request->input('email');
$company->tag_color = $request->input('tag_color');
$company->notes = $request->input('notes');
$company = $request->handleImages($company);

View File

@@ -55,6 +55,7 @@ class DepartmentsController extends Controller
$department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null);
$department->location_id = ($request->filled('location_id') ? $request->input('location_id') : null);
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
$department->tag_color = $request->input('tag_color');
$department->notes = $request->input('notes');
$department = $request->handleImages($department);
@@ -157,6 +158,7 @@ class DepartmentsController extends Controller
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
$department->phone = $request->input('phone');
$department->fax = $request->input('fax');
$department->tag_color = $request->input('tag_color');
$department->notes = $request->input('notes');
$department = $request->handleImages($department);

View File

@@ -7,6 +7,7 @@ use App\Models\Group;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
use \Illuminate\Contracts\View\View;
use \App\Models\User;
/**
* This controller handles all actions related to User Groups for
@@ -43,12 +44,20 @@ class GroupsController extends Controller
$permissions = config('permissions');
$groupPermissions = Helper::selectedPermissionsArray($permissions, $permissions);
$selectedPermissions = $request->old('permissions', $groupPermissions);
$users = \App\Models\User::orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
$users_query = User::where('show_in_list', 1)->whereNull('deleted_at');
$users_count = $users_query->count();
$users = collect();
if ($users_count <= config('app.max_unpaginated_records')) {
$users = $users_query->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
}
// Show the page
return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))
->with('group', $group)
->with('associated_users', [])
->with('unselected_users', $users);
->with('unselected_users', $users)
->with('all_users_count', $users_count);
}
/**
@@ -102,13 +111,26 @@ class GroupsController extends Controller
if ((!is_array($groupPermissions)) || (!$groupPermissions)) {
$groupPermissions = [];
}
$selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
$associated_users = $group->users()->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
// Get the unselected users
$unselected_users = \App\Models\User::whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))->with('associated_users', $associated_users)->with('unselected_users', $unselected_users);
$users_query = User::where('show_in_list', 1)->whereNull('deleted_at');
$users_count = $users_query->count();
$associated_users = collect();
$unselected_users = collect();
if ($users_count <= config('app.max_unpaginated_records')) {
$associated_users = $group->users()->where('show_in_list', 1)->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
// Get the unselected users
$unselected_users = User::where('show_in_list', 1)->whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
}
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))
->with('associated_users', $associated_users)
->with('unselected_users', $unselected_users)
->with('all_users_count', $users_count);
}
/**
@@ -135,7 +157,7 @@ class GroupsController extends Controller
if (! config('app.lock_passwords')) {
if ($group->save()) {
if ($request->filled('users_to_sync')) {
if ($request->has('users_to_sync')) {
$associated_users = explode(',',$request->input('users_to_sync'));
$group->users()->sync($associated_users);
}

View File

@@ -82,6 +82,7 @@ class LocationsController extends Controller
$location->created_by = auth()->id();
$location->phone = request('phone');
$location->fax = request('fax');
$location->tag_color = $request->input('tag_color');
$location->notes = $request->input('notes');
$location->company_id = Company::getIdForCurrentUser($request->input('company_id'));
@@ -156,6 +157,7 @@ class LocationsController extends Controller
$location->fax = request('fax');
$location->ldap_ou = $request->input('ldap_ou');
$location->manager_id = $request->input('manager_id');
$location->tag_color = $request->input('tag_color');
$location->notes = $request->input('notes');
// Only scope the location if the setting is enabled

View File

@@ -101,6 +101,7 @@ class ManufacturersController extends Controller
$manufacturer->support_email = $request->input('support_email');
$manufacturer->notes = $request->input('notes');
$manufacturer = $request->handleImages($manufacturer);
$manufacturer->tag_color = $request->input('tag_color');
if ($manufacturer->save()) {
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.create.success'));
@@ -142,6 +143,7 @@ class ManufacturersController extends Controller
$manufacturer->warranty_lookup_url = $request->input('warranty_lookup_url');
$manufacturer->support_phone = $request->input('support_phone');
$manufacturer->support_email = $request->input('support_email');
$manufacturer->tag_color = $request->input('tag_color');
$manufacturer->notes = $request->input('notes');
// Set the model's image property to null if the image is being deleted

View File

@@ -1148,7 +1148,9 @@ class ReportsController extends Controller
$query->withTrashed();
}
$itemsForReport = $query->get()->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
$itemsForReport = $query->get()
->filter(fn ($unaccepted) => $unaccepted->checkoutable)
->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
return view('reports/unaccepted_assets', compact('itemsForReport','showDeleted' ));
}
@@ -1288,7 +1290,9 @@ class ReportsController extends Controller
$acceptances->withTrashed();
}
$itemsForReport = $acceptances->get()->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
$itemsForReport = $acceptances->get()
->filter(fn ($unaccepted) => $unaccepted->checkoutable)
->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
$rows = [];

View File

@@ -589,6 +589,7 @@ class SettingsController extends Controller
$setting->time_display_format = $request->input('time_display_format');
$setting->digit_separator = $request->input('digit_separator');
$setting->name_display_format = $request->input('name_display_format');
$setting->week_start = $request->input('week_start', 0);
if ($setting->save()) {
return redirect()->route('settings.index')

View File

@@ -67,6 +67,7 @@ class SuppliersController extends Controller
$supplier->phone = request('phone');
$supplier->fax = request('fax');
$supplier->email = request('email');
$supplier->tag_color = $request->input('tag_color');
$supplier->notes = request('notes');
$supplier->url = $supplier->addhttp(request('url'));
$supplier->created_by = auth()->id();
@@ -111,6 +112,7 @@ class SuppliersController extends Controller
$supplier->fax = request('fax');
$supplier->email = request('email');
$supplier->url = $supplier->addhttp(request('url'));
$supplier->tag_color = $request->input('tag_color');
$supplier->notes = request('notes');
$supplier = $request->handleImages($supplier);

View File

@@ -308,13 +308,6 @@ class UsersController extends Controller
$permissions_array['superuser'] = $orig_superuser;
}
// Unset any of the inherited user permissions (0), since that behavior is the default anyway
foreach ($permissions_array as $permission => $value) {
if ($value == '0') {
unset($permissions_array[$permission]);
}
}
$user->permissions = json_encode($permissions_array);
// Only save groups if the user is a superuser

View File

@@ -156,7 +156,19 @@ class ViewAssetsController extends Controller
public function getRequestableIndex() : View
{
$assets = Asset::with('model', 'defaultLoc', 'location', 'assignedTo', 'requests')->Hardware()->RequestableAssets();
$models = AssetModel::with('category', 'requests', 'assets')->RequestableModels()->get();
$models = AssetModel::with([
'category',
'requests',
'assets' => function ($q) {
$q->where('requestable', 1)
->whereHas('assetstatus', fn ($s) =>
$s->where('archived', 0)
->where(fn ($s) =>
$s->where('deployable', 1)->orWhere('pending', 1)
)
);
},
])->RequestableModels()->get();
return view('account/requestable-assets', compact('assets', 'models'));
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests;
use App\Rules\ValidJson;
use Illuminate\Foundation\Http\FormRequest;
class FilterRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'filter' => ['nullable', new ValidJson()],
];
}
}

View File

@@ -26,12 +26,32 @@ class AccessoriesTransformer
'id' => $accessory->id,
'name' => e($accessory->name),
'image' => ($accessory->image) ? Storage::disk('public')->url('accessories/'.e($accessory->image)) : null,
'company' => ($accessory->company) ? ['id' => $accessory->company->id, 'name'=> e($accessory->company->name)] : null,
'manufacturer' => ($accessory->manufacturer) ? ['id' => $accessory->manufacturer->id, 'name'=> e($accessory->manufacturer->name)] : null,
'supplier' => ($accessory->supplier) ? ['id' => $accessory->supplier->id, 'name'=> e($accessory->supplier->name)] : null,
'company' => ($accessory->company) ? [
'id' => $accessory->company->id,
'name'=> e($accessory->company->name),
'tag_color'=> ($accessory->company->tag_color) ? e($accessory->company->tag_color) : null,
] : null,
'manufacturer' => ($accessory->manufacturer) ? [
'id' => $accessory->manufacturer->id,
'name'=> e($accessory->manufacturer->name),
'tag_color'=> ($accessory->manufacturer->tag_color) ? e($accessory->manufacturer->tag_color) : null,
] : null,
'supplier' => ($accessory->supplier) ? [
'id' => $accessory->supplier->id,
'name'=> e($accessory->supplier->name),
'tag_color'=> ($accessory->supplier->tag_color) ? e($accessory->supplier->tag_color) : null,
] : null,
'model_number' => ($accessory->model_number) ? e($accessory->model_number) : null,
'category' => ($accessory->category) ? ['id' => $accessory->category->id, 'name'=> e($accessory->category->name)] : null,
'location' => ($accessory->location) ? ['id' => $accessory->location->id, 'name'=> e($accessory->location->name)] : null,
'category' => ($accessory->category) ? [
'id' => $accessory->category->id,
'name'=> e($accessory->category->name),
'tag_color'=> ($accessory->category->tag_color) ? e($accessory->category->tag_color) : null,
] : null,
'location' => ($accessory->location) ? [
'id' => $accessory->location->id,
'name'=> e($accessory->location->name),
'tag_color'=> ($accessory->location->tag_color) ? e($accessory->location->tag_color) : null,
] : null,
'notes' => ($accessory->notes) ? Helper::parseEscapedMarkedownInline($accessory->notes) : null,
'qty' => ($accessory->qty) ? (int) $accessory->qty : null,
'purchase_date' => ($accessory->purchase_date) ? Helper::getFormattedDateObject($accessory->purchase_date, 'date') : null,

View File

@@ -161,6 +161,7 @@ class ActionlogsTransformer
'location' => ($actionlog->location) ? [
'id' => (int) $actionlog->location->id,
'name' => e($actionlog->location->name),
'tag_color'=> ($actionlog->location->tag_color) ? e($actionlog->location->tag_color) : null,
] : null,
'created_at' => Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($actionlog->updated_at, 'datetime'),

View File

@@ -44,6 +44,7 @@ class AssetModelsTransformer
'manufacturer' => ($assetmodel->manufacturer) ? [
'id' => (int) $assetmodel->manufacturer->id,
'name'=> e($assetmodel->manufacturer->name),
'tag_color'=> ($assetmodel->manufacturer->tag_color) ? e($assetmodel->manufacturer->tag_color) : null,
] : null,
'image' => ($assetmodel->image != '') ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null,
'model_number' => ($assetmodel->model_number ? e($assetmodel->model_number): null),
@@ -60,6 +61,7 @@ class AssetModelsTransformer
'category' => ($assetmodel->category) ? [
'id' => (int) $assetmodel->category->id,
'name'=> e($assetmodel->category->name),
'tag_color'=> ($assetmodel->category->tag_color) ? e($assetmodel->category->tag_color) : null,
] : null,
'fieldset' => ($assetmodel->fieldset) ? [
'id' => (int) $assetmodel->fieldset->id,

View File

@@ -40,7 +40,6 @@ class AssetsTransformer
] : null,
'byod' => ($asset->byod ? true : false),
'requestable' => ($asset->requestable ? true : false),
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
'eol' => (($asset->asset_eol_date != '') && ($asset->purchase_date != '')) ? (int) Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date, true) . ' months' : null,
'asset_eol_date' => ($asset->asset_eol_date != '') ? Helper::getFormattedDateObject($asset->asset_eol_date, 'date') : null,
@@ -53,10 +52,12 @@ class AssetsTransformer
'category' => (($asset->model) && ($asset->model->category)) ? [
'id' => (int) $asset->model->category->id,
'name'=> e($asset->model->category->name),
'tag_color'=> ($asset->model->category->tag_color) ? e($asset->model->category->tag_color) : null,
] : null,
'manufacturer' => (($asset->model) && ($asset->model->manufacturer)) ? [
'id' => (int) $asset->model->manufacturer->id,
'name'=> e($asset->model->manufacturer->name),
'tag_color'=> ($asset->model->manufacturer->tag_color) ? e($asset->model->manufacturer->tag_color) : null,
] : null,
'depreciation' => (($asset->model) && ($asset->model->depreciation)) ? [
'id' => (int) $asset->model->depreciation->id,
@@ -68,20 +69,24 @@ class AssetsTransformer
'supplier' => ($asset->supplier) ? [
'id' => (int) $asset->supplier->id,
'name'=> e($asset->supplier->name),
'tag_color'=> ($asset->supplier->tag_color) ? e($asset->supplier->tag_color) : null,
] : null,
'notes' => ($asset->notes) ? Helper::parseEscapedMarkedownInline($asset->notes) : null,
'order_number' => ($asset->order_number) ? e($asset->order_number) : null,
'company' => ($asset->company) ? [
'id' => (int) $asset->company->id,
'name'=> e($asset->company->name),
'tag_color'=> ($asset->company->tag_color) ? e($asset->company->tag_color) : null,
] : null,
'location' => ($asset->location) ? [
'id' => (int) $asset->location->id,
'name'=> e($asset->location->name),
'tag_color'=> ($asset->location->tag_color) ? e($asset->location->tag_color) : null,
] : null,
'rtd_location' => ($asset->defaultLoc) ? [
'id' => (int) $asset->defaultLoc->id,
'name'=> e($asset->defaultLoc->name),
'tag_color'=> ($asset->defaultLoc->tag_color) ? e($asset->defaultLoc->tag_color) : null,
] : null,
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
'qr' => ($setting->qr_code=='1') ? config('app.url').'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png' : null,

View File

@@ -66,6 +66,7 @@ class CategoriesTransformer
'id' => (int) $category->adminuser->id,
'name'=> e($category->adminuser->display_name),
] : null,
'tag_color' => $category->tag_color ? e($category->tag_color) : null,
'notes' => Helper::parseEscapedMarkedownInline($category->notes),
'created_at' => Helper::getFormattedDateObject($category->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($category->updated_at, 'datetime'),

View File

@@ -40,6 +40,7 @@ class CompaniesTransformer
'id' => (int) $company->adminuser->id,
'name'=> e($company->adminuser->display_name),
] : null,
'tag_color' => ($company->tag_color!='') ? e($company->tag_color): null,
'notes' => Helper::parseEscapedMarkedownInline($company->notes),
'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($company->updated_at, 'datetime'),

View File

@@ -30,15 +30,25 @@ class ComponentsTransformer
'location' => ($component->location) ? [
'id' => (int) $component->location->id,
'name' => e($component->location->name),
'tag_color' => $component->location->tag_color ? e($component->location->tag_color) : null,
] : null,
'qty' => ($component->qty != '') ? (int) $component->qty : null,
'min_amt' => ($component->min_amt != '') ? (int) $component->min_amt : null,
'category' => ($component->category) ? [
'id' => (int) $component->category->id,
'name' => e($component->category->name),
'tag_color' => $component->category->tag_color ? e($component->category->tag_color) : null,
] : null,
'supplier' => ($component->supplier) ? [
'id' => $component->supplier->id,
'name'=> e($component->supplier->name),
'tag_color' => $component->supplier->tag_color ? e($component->supplier->tag_color) : null,
] : null,
'manufacturer' => ($component->manufacturer) ? [
'id' => $component->manufacturer->id,
'name'=> e($component->manufacturer->name),
'tag_color' => $component->manufacturer->tag_color ? e($component->manufacturer->tag_color) : null,
] : null,
'supplier' => ($component->supplier) ? ['id' => $component->supplier->id, 'name'=> e($component->supplier->name)] : null,
'manufacturer' => ($component->manufacturer) ? ['id' => $component->manufacturer->id, 'name'=> e($component->manufacturer->name)] : null,
'model_number' => ($component->model_number) ? e($component->model_number) : null,
'order_number' => e($component->order_number),
'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'),
@@ -48,6 +58,7 @@ class ComponentsTransformer
'company' => ($component->company) ? [
'id' => (int) $component->company->id,
'name' => e($component->company->name),
'tag_color' => $component->company->tag_color ? e($component->company->tag_color) : null,
] : null,
'notes' => ($component->notes) ? Helper::parseEscapedMarkedownInline($component->notes) : null,
'created_by' => ($component->adminuser) ? [

View File

@@ -26,12 +26,32 @@ class ConsumablesTransformer
'id' => (int) $consumable->id,
'name' => e($consumable->name),
'image' => ($consumable->getImageUrl()) ? ($consumable->getImageUrl()) : null,
'category' => ($consumable->category) ? ['id' => $consumable->category->id, 'name' => e($consumable->category->name)] : null,
'company' => ($consumable->company) ? ['id' => (int) $consumable->company->id, 'name' => e($consumable->company->name)] : null,
'category' => ($consumable->category) ? [
'id' => $consumable->category->id,
'name' => e($consumable->category->name),
'tag_color' => $consumable->category->tag_color ? e($consumable->category->tag_color) : null,
] : null,
'company' => ($consumable->company) ? [
'id' => (int) $consumable->company->id,
'name' => e($consumable->company->name),
'tag_color' => $consumable->company->tag_color ? e($consumable->company->tag_color) : null,
] : null,
'item_no' => e($consumable->item_no),
'location' => ($consumable->location) ? ['id' => (int) $consumable->location->id, 'name' => e($consumable->location->name)] : null,
'manufacturer' => ($consumable->manufacturer) ? ['id' => (int) $consumable->manufacturer->id, 'name' => e($consumable->manufacturer->name)] : null,
'supplier' => ($consumable->supplier) ? ['id' => $consumable->supplier->id, 'name'=> e($consumable->supplier->name)] : null,
'location' => ($consumable->location) ? [
'id' => (int) $consumable->location->id,
'name' => e($consumable->location->name),
'tag_color' => $consumable->location->tag_color ? e($consumable->location->tag_color) : null,
] : null,
'manufacturer' => ($consumable->manufacturer) ? [
'id' => (int) $consumable->manufacturer->id,
'name' => e($consumable->manufacturer->name),
'tag_color' => $consumable->manufacturer->tag_color ? e($consumable->manufacturer->tag_color) : null,
] : null,
'supplier' => ($consumable->supplier) ? [
'id' => $consumable->supplier->id,
'name'=> e($consumable->supplier->name),
'tag_color' => $consumable->supplier->tag_color ? e($consumable->supplier->tag_color) : null,
] : null,
'min_amt' => (int) $consumable->min_amt,
'model_number' => ($consumable->model_number != '') ? e($consumable->model_number) : null,
'remaining' => $consumable->numRemaining(),

View File

@@ -32,6 +32,7 @@ class DepartmentsTransformer
'company' => ($department->company) ? [
'id' => (int) $department->company->id,
'name'=> e($department->company->name),
'tag_color' => $department->company->tag_color ? e($department->company->tag_color) : null,
] : null,
'manager' => ($department->manager) ? [
'id' => (int) $department->manager->id,
@@ -42,8 +43,10 @@ class DepartmentsTransformer
'location' => ($department->location) ? [
'id' => (int) $department->location->id,
'name' => e($department->location->name),
'tag_color' => $department->location->tag_color ? e($department->location->tag_color) : null,
] : null,
'users_count' => (int) ($department->users_count),
'tag_color' => $department->tag_color ? e($department->tag_color) : null,
'notes' => Helper::parseEscapedMarkedownInline($department->notes),
'created_at' => Helper::getFormattedDateObject($department->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($department->updated_at, 'datetime'),

View File

@@ -34,12 +34,14 @@ class LicenseSeatsTransformer
[
'id' => (int) $seat->user->department->id,
'name' => e($seat->user->department->name),
'tag_color' => $seat->user->department->tag_color ? e($seat->user->department->tag_color) : null,
] : null,
'company'=> ($seat->user->company) ?
[
'id' => (int) $seat->user->company->id,
'name' => e($seat->user->company->name),
'tag_color' => $seat->user->company->tag_color ? e($seat->user->company->tag_color) : null,
] : null,
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
@@ -52,6 +54,7 @@ class LicenseSeatsTransformer
'location' => ($seat->location()) ? [
'id' => (int) $seat->location()->id,
'name'=> e($seat->location()->name),
'tag_color' => $seat->location()->tag_color ? e($seat->location()->tag_color) : null,
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
] : null,
'reassignable' => (bool) $seat->license->reassignable,

View File

@@ -25,7 +25,11 @@ class LicensesTransformer
'id' => (int) $license->id,
'name' => e($license->name),
'company' => ($license->company) ? ['id' => (int) $license->company->id, 'name'=> e($license->company->name)] : null,
'manufacturer' => ($license->manufacturer) ? ['id' => (int) $license->manufacturer->id, 'name'=> e($license->manufacturer->name)] : null,
'manufacturer' => ($license->manufacturer) ? [
'id' => (int) $license->manufacturer->id,
'name'=> e($license->manufacturer->name),
'tag_color'=> ($license->manufacturer->tag_color) ? e($license->manufacturer->tag_color) : null,
] : null,
'product_key' => (Gate::allows('viewKeys', License::class)) ? e($license->serial) : '------------',
'order_number' => ($license->order_number) ? e($license->order_number) : null,
'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : null,
@@ -44,8 +48,16 @@ class LicensesTransformer
'license_email' => ($license->license_email) ? e($license->license_email) : null,
'reassignable' => ($license->reassignable == 1) ? true : false,
'maintained' => ($license->maintained == 1) ? true : false,
'supplier' => ($license->supplier) ? ['id' => (int) $license->supplier->id, 'name'=> e($license->supplier->name)] : null,
'category' => ($license->category) ? ['id' => (int) $license->category->id, 'name'=> e($license->category->name)] : null,
'supplier' => ($license->supplier) ? [
'id' => (int) $license->supplier->id,
'name'=> e($license->supplier->name),
'tag_color'=> ($license->supplier->tag_color) ? e($license->supplier->tag_color) : null,
] : null,
'category' => ($license->category) ? [
'id' => (int) $license->category->id,
'name'=> e($license->category->name),
'tag_color'=> ($license->category->tag_color) ? e($license->category->tag_color) : null,
] : null,
'created_by' => ($license->adminuser) ? [
'id' => (int) $license->adminuser->id,
'name'=> e($license->adminuser->display_name),

View File

@@ -58,6 +58,7 @@ class LocationsTransformer
'children_count' => (int) $location->children_count,
'currency' => ($location->currency) ? e($location->currency) : null,
'ldap_ou' => ($location->ldap_ou) ? e($location->ldap_ou) : null,
'tag_color' => $location->tag_color ? e($location->tag_color) : null,
'notes' => Helper::parseEscapedMarkedownInline($location->notes),
'created_at' => Helper::getFormattedDateObject($location->created_at, 'datetime'),
'created_by' => $location->adminuser ? [
@@ -68,11 +69,13 @@ class LocationsTransformer
'parent' => ($location->parent) ? [
'id' => (int) $location->parent->id,
'name'=> e($location->parent->name),
'tag_color' => $location->parent->tag_color ? e($location->parent->tag_color) : null,
] : null,
'manager' => ($location->manager) ? (new UsersTransformer)->transformUser($location->manager) : null,
'company' => ($location->company) ? [
'id' => (int) $location->company->id,
'name'=> e($location->company->name)
'name'=> e($location->company->name),
'tag_color' => $location->company->tag_color ? e($location->company->tag_color) : null,
] : null,
'children' => $children_arr,

View File

@@ -37,6 +37,7 @@ class ManufacturersTransformer
'consumables_count' => (int) $manufacturer->consumables_count,
'accessories_count' => (int) $manufacturer->accessories_count,
'components_count' => (int) $manufacturer->components_count,
'tag_color' => $manufacturer->tag_color ? e($manufacturer->tag_color) : null,
'notes' => Helper::parseEscapedMarkedownInline($manufacturer->notes),
'created_by' => ($manufacturer->adminuser) ? [
'id' => (int) $manufacturer->adminuser->id,

View File

@@ -26,6 +26,7 @@ class SelectlistTransformer
'id' => (int) $select_item->id,
'text' => ($select_item->use_text) ? $select_item->use_text : $select_item->name,
'image' => ($select_item->use_image) ? $select_item->use_image : null,
'tag_color' => ($select_item->tag_color) ? $select_item->tag_color : null,
];
}

View File

@@ -43,6 +43,7 @@ class SuppliersTransformer
'licenses_count' => (int) $supplier->licenses_count,
'consumables_count' => (int) $supplier->consumables_count,
'components_count' => (int) $supplier->components_count,
'tag_color' => $supplier->tag_color ? e($supplier->tag_color) : null,
'notes' => ($supplier->notes) ? Helper::parseEscapedMarkedownInline($supplier->notes) : null,
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
'created_by' => $supplier->adminuser ? [

View File

@@ -57,6 +57,7 @@ class UsersTransformer
'department' => ($user->department) ? [
'id' => (int) $user->department->id,
'name'=> e($user->department->name),
'tag_color' => ($user->department->tag_color) ? e($user->department->tag_color) : null,
] : null,
'department_manager' => ($user->department?->manager) ? [
'id' => (int) $user->department->manager->id,
@@ -65,11 +66,11 @@ class UsersTransformer
'location' => ($user->userloc) ? [
'id' => (int) $user->userloc->id,
'name'=> e($user->userloc->name),
'tag_color'=> ($user->userloc->tag_color) ? e($user->userloc->tag_color) : null,
] : null,
'notes'=> Helper::parseEscapedMarkedownInline($user->notes),
'role' => $role,
'user_permissions' => $user->decodePermissions(),
'effective_permissions' => $user->getEffectivePermissions('true'),
'permissions' => $user->decodePermissions(),
'activated' => ($user->activated == '1') ? true : false,
'autoassign_licenses' => ($user->autoassign_licenses == '1') ? true : false,
'ldap_import' => ($user->ldap_import == '1') ? true : false,
@@ -81,7 +82,11 @@ class UsersTransformer
'consumables_count' => (int) $user->consumables_count,
'manages_users_count' => (int) $user->manages_users_count,
'manages_locations_count' => (int) $user->manages_locations_count,
'company' => ($user->company) ? ['id' => (int) $user->company->id, 'name'=> e($user->company->name)] : null,
'company' => ($user->company) ? [
'id' => (int) $user->company->id,
'name'=> e($user->company->name),
'tag_color'=> ($user->company->tag_color) ? e($user->company->tag_color) : null,
] : null,
'created_by' => ($user->createdBy) ? [
'id' => (int) $user->createdBy->id,
'name'=> e($user->createdBy->display_name),

18
app/Mail/BaseMailable.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
namespace App\Mail;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Headers;
class BaseMailable extends Mailable
{
public function headers(): Headers
{
return new Headers(
text: [
'X-Auto-Response-Suppress' => 'OOF, DR, RN, NRN, AutoReply',
'X-System-Sender' => 'Snipe-IT',
]
);
}
}

View File

@@ -6,14 +6,12 @@ use App\Models\Accessory;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckinAccessoryMail extends Mailable
class CheckinAccessoryMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -7,15 +7,13 @@ use App\Models\Asset;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Queue\SerializesModels;
class CheckinAssetMail extends Mailable
class CheckinAssetMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -7,14 +7,12 @@ use App\Models\Component;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckinComponentMail extends Mailable
class CheckinComponentMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -6,14 +6,12 @@ use App\Models\LicenseSeat;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckinLicenseMail extends Mailable
class CheckinLicenseMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -5,13 +5,11 @@ namespace App\Mail;
use App\Models\CheckoutAcceptance;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckoutAcceptanceResponseMail extends Mailable
class CheckoutAcceptanceResponseMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -8,15 +8,13 @@ use App\Models\Location;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class CheckoutAccessoryMail extends Mailable
class CheckoutAccessoryMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -8,8 +8,6 @@ use App\Models\Location;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
@@ -17,7 +15,7 @@ use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Queue\SerializesModels;
class CheckoutAssetMail extends Mailable
class CheckoutAssetMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -6,13 +6,12 @@ use App\Models\Component;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckoutComponentMail extends Mailable
class CheckoutComponentMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -6,15 +6,12 @@ use App\Models\Consumable;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class CheckoutConsumableMail extends Mailable
class CheckoutConsumableMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -7,14 +7,12 @@ use App\Models\LicenseSeat;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckoutLicenseMail extends Mailable
class CheckoutLicenseMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -3,14 +3,12 @@
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class ExpiringAssetsMail extends Mailable
class ExpiringAssetsMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -3,14 +3,12 @@
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class ExpiringLicenseMail extends Mailable
class ExpiringLicenseMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -3,14 +3,12 @@
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class SendUpcomingAuditMail extends Mailable
class SendUpcomingAuditMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -3,14 +3,12 @@
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class UnacceptedAssetReminderMail extends Mailable
class UnacceptedAssetReminderMail extends BaseMailable
{
use Queueable, SerializesModels;

View File

@@ -408,6 +408,13 @@ class Asset extends Depreciable
);
}
protected function expectedCheckinDiffForHumans(): Attribute
{
return Attribute:: make(
get: fn(mixed $value, array $attributes) => array_key_exists('expected_checkin', $attributes) ? Carbon::parse($this->expected_checkin)->diffForHumans() : null,
);
}
/**
* Establishes the asset -> company relationship
*

View File

@@ -73,6 +73,7 @@ class Category extends SnipeModel
'alert_on_response',
'use_default_eula',
'created_by',
'tag_color',
'notes',
];

View File

@@ -26,7 +26,7 @@ class Checkoutable
$acceptance = $unaccepted;
$assignee = $acceptance->assignedTo;
$company = $unaccepted_row->company ? optional($unaccepted_row->company)->present()->nameUrl() : '';
$company = $unaccepted_row?->company?->present()?->nameUrl() ?? '';
$category = $model = $name = $tag = '';
$type = $acceptance->checkoutable_item_type ?? '';
@@ -70,10 +70,10 @@ class Checkoutable
acceptance: $acceptance,
assignee: $assignee,
//plain text for CSVs
plain_text_category: ($unaccepted_row->model?->category?->name ?? $unaccepted_row->license->category?->name ?? $unaccepted_row->category?->name ?? ''),
plain_text_model: ($unaccepted_row->model?->name ?? $unaccepted_row->model_number ?? ''),
plain_text_name: ($unaccepted_row->name ?? $unaccepted_row->license?->name ?? ''),
plain_text_company: ($unaccepted_row->company)->name ?? $unaccepted_row->license->company?->name ?? '',
plain_text_category: $unaccepted_row?->model?->category?->name ?? $unaccepted_row?->license?->category?->name ?? $unaccepted_row?->category?->name ?? '',
plain_text_model: $unaccepted_row?->model?->name ?? $unaccepted_row?->model_number ?? '',
plain_text_name: $unaccepted_row?->name ?? $unaccepted_row?->license?->name ?? '',
plain_text_company: $unaccepted_row?->company->name ?? $unaccepted_row?->license?->company?->name ?? '',
);
}
}

View File

@@ -72,6 +72,7 @@ final class Company extends SnipeModel
'fax',
'email',
'created_by',
'tag_color',
'notes',
];

View File

@@ -5,6 +5,7 @@ namespace App\Models;
use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Traits\CompanyableTrait;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Watson\Validating\ValidatingTrait;
@@ -22,7 +23,10 @@ class Department extends SnipeModel
*/
protected $injectUniqueIdentifier = true;
use ValidatingTrait, UniqueUndeletedTrait;
protected $presenter = \App\Presenters\DepartmentPresenter::class;
use ValidatingTrait, UniqueUndeletedTrait, Presentable;
protected $casts = [
'manager_id' => 'integer',
@@ -53,6 +57,7 @@ class Department extends SnipeModel
'location_id',
'company_id',
'manager_id',
'tag_color',
'notes',
];

View File

@@ -93,9 +93,6 @@ class Group extends SnipeModel
if (!is_integer($permission)) {
$permissions[$permission] = (int) $value;
if ($permission == 'superuser') {
break;
}
} else {
\Log::info('Weird data here - skipping it');
unset($permissions[$permission]);

View File

@@ -0,0 +1,110 @@
<?php
namespace App\Models\Labels\Sheets\Avery;
use App\Helpers\Helper;
use App\Models\Labels\RectangleSheet;
abstract class L4736 extends RectangleSheet
{
private const PAPER_FORMAT = 'A4';
private const PAPER_ORIENTATION = 'P';
/* Data in pt from Word Template */
private const COLUMN1_X = 31.70;
private const COLUMN2_X = 167.92;
private const ROW1_Y = 53.00;
private const ROW2_Y = 112.8;
private const LABEL_W = 122.24;
private const LABEL_H = 66.5;
private float $pageWidth;
private float $pageHeight;
private float $pageMarginLeft;
private float $pageMarginTop;
private float $columnSpacing;
private float $rowSpacing;
private float $labelWidth;
private float $labelHeight;
public function __construct()
{
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
$this->pageWidth = $paperSize->width;
$this->pageHeight = $paperSize->height;
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
}
public function getPageWidth()
{
return $this->pageWidth;
}
public function getPageHeight()
{
return $this->pageHeight;
}
public function getPageMarginTop()
{
return $this->pageMarginTop;
}
public function getPageMarginBottom()
{
return $this->pageMarginTop;
}
public function getPageMarginLeft()
{
return $this->pageMarginLeft;
}
public function getPageMarginRight()
{
return $this->pageMarginLeft;
}
public function getColumns()
{
return 4;
}
public function getRows()
{
return 12;
}
public function getLabelColumnSpacing()
{
return $this->columnSpacing;
}
public function getLabelRowSpacing()
{
return $this->rowSpacing;
}
public function getLabelWidth()
{
return $this->labelWidth;
}
public function getLabelHeight()
{
return $this->labelHeight;
}
public function getLabelBorder()
{
return 0;
}
}
?>

View File

@@ -0,0 +1,137 @@
<?php
namespace App\Models\Labels\Sheets\Avery;
class L4736_A extends L4736
{
private const BARCODE_MARGIN = 1.80;
private const TAG_SIZE = 4.80;
private const TITLE_SIZE = 3.00;
private const TITLE_MARGIN = 1.80;
private const LABEL_SIZE = 2.8;
private const LABEL_MARGIN = - 0.45;
private const FIELD_SIZE = 3.80;
private const FIELD_MARGIN = 0.20;
public function getUnit()
{
return 'mm';
}
public function getLabelMarginTop()
{
return 0.06;
}
public function getLabelMarginBottom()
{
return 0.06;
}
public function getLabelMarginLeft()
{
return 0.06;
}
public function getLabelMarginRight()
{
return 0.06;
}
public function getSupportAssetTag()
{
return true;
}
public function getSupport1DBarcode()
{
return false;
}
public function getSupport2DBarcode()
{
return true;
}
public function getSupportFields()
{
return 4;
}
public function getSupportLogo()
{
return false;
}
public function getSupportTitle()
{
return true;
}
public function preparePDF($pdf)
{
}
public function write($pdf, $record)
{
$pa = $this->getLabelPrintableArea();
$currentX = $pa->x1;
$currentY = $pa->y1;
$usableWidth = $pa->w;
$usableHeight = $pa->h;
if ($record->has('title')) {
static::writeText(
$pdf, $record->get('title'),
$pa->x1, $pa->y1,
'freesans', '', self::TITLE_SIZE, 'C',
$pa->w, self::TITLE_SIZE, true, 0
);
}
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
$barcodeSize = $usableHeight;
if ($record->has('barcode2d')) {
static::write2DBarcode(
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
$currentX, $currentY,
$barcodeSize, $barcodeSize
);
$currentX += $barcodeSize + self::BARCODE_MARGIN;
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
}
$fields = $record->get('fields');
$fieldCount = count($fields);
$perFieldHeight = (self::LABEL_SIZE + self::LABEL_MARGIN)
+ (self::FIELD_SIZE + self::FIELD_MARGIN);
$baseHeight = $fieldCount * $perFieldHeight;
$scale = 1.0;
if ($baseHeight > $usableHeight && $baseHeight > 0) {
$scale = $usableHeight / $baseHeight;
}
$labelSize = self::LABEL_SIZE * $scale;
$labelMargin = self::LABEL_MARGIN * $scale;
$fieldSize = self::FIELD_SIZE * $scale;
$fieldMargin = self::FIELD_MARGIN * $scale;
foreach ($fields as $field) {
static::writeText(
$pdf, $field['label'],
$currentX, $currentY,
'freesans', '', $labelSize, 'L',
$usableWidth, $labelSize, true, 0
);
$currentY += $labelSize + $labelMargin;
static::writeText(
$pdf, $field['value'],
$currentX, $currentY,
'freemono', 'B', $fieldSize, 'L',
$usableWidth, $fieldSize, true, 0, 0.01
);
$currentY += $fieldSize + $fieldMargin;
}
}
}
?>

View File

@@ -1,110 +1,66 @@
<?php
namespace App\Models\Labels\Sheets\Avery;
use App\Helpers\Helper;
use App\Models\Labels\RectangleSheet;
abstract class L6009 extends RectangleSheet
{
private const PAPER_FORMAT = 'A4';
private const PAPER_ORIENTATION = 'P';
/* Data in pt from Word Template */
private const COLUMN1_X = 31.70;
private const COLUMN2_X = 167.92;
private const ROW1_Y = 53.00;
private const ROW2_Y = 112.8;
private const LABEL_W = 122.24;
private const LABEL_H = 66.5;
private float $pageWidth;
private float $pageHeight;
private float $pageMarginLeft;
private float $pageMarginTop;
private float $columnSpacing;
private float $rowSpacing;
private float $labelWidth;
private float $labelHeight;
public function __construct()
{
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
$this->pageWidth = $paperSize->width;
$this->pageHeight = $paperSize->height;
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
}
public function getPageWidth()
{
return $this->pageWidth;
}
public function getPageHeight()
{
return $this->pageHeight;
}
public function getPageMarginTop()
{
return $this->pageMarginTop;
}
public function getPageMarginBottom()
{
return $this->pageMarginTop;
}
public function getPageMarginLeft()
{
return $this->pageMarginLeft;
}
public function getPageMarginRight()
{
return $this->pageMarginLeft;
}
public function getColumns()
{
return 4;
}
public function getRows()
{
return 12;
}
public function getLabelColumnSpacing()
{
return $this->columnSpacing;
}
public function getLabelRowSpacing()
{
return $this->rowSpacing;
}
public function getLabelWidth()
{
return $this->labelWidth;
}
public function getLabelHeight()
{
return $this->labelHeight;
}
public function getLabelBorder()
{
return 0;
}
}
?>
<?php
namespace App\Models\Labels\Sheets\Avery;
use App\Helpers\Helper;
use App\Models\Labels\RectangleSheet;
abstract class L6009 extends RectangleSheet
{
private const PAPER_FORMAT = 'A4';
private const PAPER_ORIENTATION = 'P';
// Convert mm to pt (1 mm = 2.83465 pt)
private const LABEL_W = 129.54;
private const LABEL_H = 60.09;
private const COLUMN1_X = 22.67;
private const ROW1_Y = 37.41;
private const COLUMN_SPACING = 14.17;
private const ROW_SPACING = 2.26;
private float $pageWidth;
private float $pageHeight;
private float $pageMarginLeft;
private float $pageMarginTop;
private float $columnSpacing;
private float $rowSpacing;
private float $labelWidth;
private float $labelHeight;
public function __construct()
{
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
$this->pageWidth = $paperSize->width;
$this->pageHeight = $paperSize->height;
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
$this->columnSpacing = Helper::convertUnit(self::COLUMN_SPACING, 'pt', $this->getUnit());
$this->rowSpacing = Helper::convertUnit(self::ROW_SPACING, 'pt', $this->getUnit());
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
}
public function getPageWidth() { return $this->pageWidth; }
public function getPageHeight() { return $this->pageHeight; }
public function getPageMarginTop() { return $this->pageMarginTop; }
public function getPageMarginBottom() { return $this->pageMarginTop; }
public function getPageMarginLeft() { return $this->pageMarginLeft; }
public function getPageMarginRight() { return $this->pageMarginLeft; }
public function getColumns() { return 4; }
public function getRows() { return 12; }
public function getLabelColumnSpacing(){ return $this->columnSpacing; }
public function getLabelRowSpacing() { return $this->rowSpacing; }
public function getLabelWidth() { return $this->labelWidth; }
public function getLabelHeight() { return $this->labelHeight; }
public function getLabelBorder() { return 0; }
}
?>

View File

@@ -1,121 +1,104 @@
<?php
namespace App\Models\Labels\Sheets\Avery;
class L6009_A extends L6009
{
private const BARCODE_MARGIN = 1.80;
private const TAG_SIZE = 4.80;
private const TITLE_SIZE = 3.00;
private const TITLE_MARGIN = 1.80;
private const LABEL_SIZE = 2.8;
private const LABEL_MARGIN = - 0.45;
private const FIELD_SIZE = 3.80;
private const FIELD_MARGIN = 0.20;
public function getUnit()
{
return 'mm';
}
public function getLabelMarginTop()
{
return 0.06;
}
public function getLabelMarginBottom()
{
return 0.06;
}
public function getLabelMarginLeft()
{
return 0.06;
}
public function getLabelMarginRight()
{
return 0.06;
}
public function getSupportAssetTag()
{
return true;
}
public function getSupport1DBarcode()
{
return false;
}
public function getSupport2DBarcode()
{
return true;
}
public function getSupportFields()
{
return 4;
}
public function getSupportLogo()
{
return false;
}
public function getSupportTitle()
{
return true;
}
public function preparePDF($pdf)
{
}
public function write($pdf, $record)
{
$pa = $this->getLabelPrintableArea();
$currentX = $pa->x1;
$currentY = $pa->y1;
$usableWidth = $pa->w;
$usableHeight = $pa->h;
if ($record->has('title')) {
static::writeText(
$pdf, $record->get('title'),
$pa->x1, $pa->y1,
'freesans', '', self::TITLE_SIZE, 'C',
$pa->w, self::TITLE_SIZE, true, 0
);
}
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
$barcodeSize = $usableHeight;
if ($record->has('barcode2d')) {
static::write2DBarcode(
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
$currentX, $currentY,
$barcodeSize, $barcodeSize
);
$currentX += $barcodeSize + self::BARCODE_MARGIN;
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
}
foreach ($record->get('fields') as $field) {
static::writeText(
$pdf, $field['label'],
$currentX, $currentY,
'freesans', '', self::LABEL_SIZE, 'L',
$usableWidth, self::LABEL_SIZE, true, 0
);
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
static::writeText(
$pdf, $field['value'],
$currentX, $currentY,
'freemono', 'B', self::FIELD_SIZE, 'L',
$usableWidth, self::FIELD_SIZE, true, 0, 0.01
);
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
}
}
}
?>
<?php
namespace App\Models\Labels\Sheets\Avery;
class L6009_A extends L6009
{
private const BARCODE_MARGIN = 1.80;
private const TAG_SIZE = 4.80;
private const TITLE_SIZE = 3.00;
private const TITLE_MARGIN = 1.80;
private const LABEL_SIZE = 2.8;
private const LABEL_MARGIN = -0.45;
private const FIELD_SIZE = 3.80;
private const FIELD_MARGIN = 0.20;
public function getUnit() { return 'mm'; }
public function getLabelMarginTop() { return 0.06; }
public function getLabelMarginBottom() { return 0.06; }
public function getLabelMarginLeft() { return 0.06; }
public function getLabelMarginRight() { return 0.06; }
public function getSupportAssetTag() { return true; }
public function getSupport1DBarcode() { return false; }
public function getSupport2DBarcode() { return true; }
public function getSupportFields() { return 4; }
public function getSupportLogo() { return false; }
public function getSupportTitle() { return false; }
public function preparePDF($pdf) {}
public function write($pdf, $record)
{
$pa = $this->getLabelPrintableArea();
$currentX = $pa->x1;
$currentY = $pa->y1;
$usableWidth = $pa->w;
$usableHeight = $pa->h;
if ($record->has('title')) {
static::writeText(
$pdf, $record->get('title'),
$pa->x1, $pa->y1,
'freesans', '', self::TITLE_SIZE, 'C',
$pa->w, self::TITLE_SIZE, true, 0
);
}
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
$barcodeSize = $usableHeight;
if ($record->has('barcode2d')) {
static::write2DBarcode(
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
$currentX, $currentY,
$barcodeSize, $barcodeSize
);
$currentX += $barcodeSize + self::BARCODE_MARGIN;
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
}
$fields = $record->get('fields');
// Below rescales the size of the field box to fit, it feels like it could/should be abstracted one class above
// to be usable on other labels but im unsure of how to implement that, since it uses a lot of private
// constants.
// Figure out how tall the label fields wants to be
$fieldCount = count($fields);
$perFieldHeight = (self::LABEL_SIZE + self::LABEL_MARGIN)
+ (self::FIELD_SIZE + self::FIELD_MARGIN);
$baseHeight = $fieldCount * $perFieldHeight;
// If it doesn't fit in the available height, scale everything down
$scale = 1.0;
if ($baseHeight > $usableHeight && $baseHeight > 0) {
$scale = $usableHeight / $baseHeight;
}
$labelSize = self::LABEL_SIZE * $scale;
$labelMargin = self::LABEL_MARGIN * $scale;
$fieldSize = self::FIELD_SIZE * $scale;
$fieldMargin = self::FIELD_MARGIN * $scale;
foreach ($fields as $field) {
static::writeText(
$pdf, $field['label'],
$currentX, $currentY,
'freesans', '', $labelSize, 'L',
$usableWidth, $labelSize, true, 0
);
$currentY += $labelSize + $labelMargin;
static::writeText(
$pdf, $field['value'],
$currentX, $currentY,
'freemono', 'B', $fieldSize, 'L',
$usableWidth, $fieldSize, true, 0, 0.01
);
$currentY += $fieldSize + $fieldMargin;
}
}
}
?>

View File

@@ -77,6 +77,7 @@ class Location extends SnipeModel
'manager_id',
'image',
'company_id',
'tag_color',
'notes',
];
protected $hidden = ['user_id'];

View File

@@ -53,6 +53,7 @@ class Manufacturer extends SnipeModel
'support_url',
'url',
'warranty_lookup_url',
'tag_color',
'notes',
];

View File

@@ -4,17 +4,21 @@ namespace App\Models;
use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Loggable;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;
use \Illuminate\Database\Eloquent\Relations\Relation;
use App\Models\Traits\Loggable;
class Supplier extends SnipeModel
{
use HasFactory;
use SoftDeletes;
use HasUploads;
use Presentable;
protected $presenter = \App\Presenters\SupplierPresenter::class;
protected $table = 'suppliers';
@@ -66,7 +70,7 @@ class Supplier extends SnipeModel
*
* @var array
*/
protected $fillable = ['name', 'address', 'address2', 'city', 'state', 'country', 'zip', 'phone', 'fax', 'email', 'contact', 'url', 'notes'];
protected $fillable = ['name', 'address', 'address2', 'city', 'state', 'country', 'zip', 'phone', 'fax', 'email', 'contact', 'url', 'tag_color', 'notes'];
/**
* Eager load counts

View File

@@ -253,13 +253,10 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*
* @return bool
*/
protected function checkPermissionSection($section, $return_explicit = false)
protected function checkPermissionSection($section)
{
$user_groups = $this->groups;
// The user has no permissions and is not in any groups
if ((($this->permissions == '') || ($this->permissions == 'null')) && (count($user_groups) == 0)) {
if (($this->permissions == '') && (count($user_groups) == 0)) {
return false;
}
@@ -274,14 +271,11 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
}
$is_user_section_permissions_set = array_key_exists($section, $user_permissions);
// If the user is explicitly granted, return true
$is_user_section_permissions_set = ($user_permissions != '') && array_key_exists($section, $user_permissions);
//If the user is explicitly granted, return true
if ($is_user_section_permissions_set && ($user_permissions[$section] == '1')) {
return true;
}
// If the user is explicitly denied, return false
if ($is_user_section_permissions_set && ($user_permissions[$section] == '-1')) {
return false;
@@ -291,7 +285,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
foreach ($user_groups as $user_group) {
$group_permissions = (array) json_decode($user_group->permissions, true);
if (((array_key_exists($section, $group_permissions)) && ($group_permissions[$section] == '1'))) {
\Log::debug('user '.$this->id.' is granted '.$section.' permission via group membership');
return true;
}
}
@@ -299,64 +292,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
return false;
}
// This gets the permissions including group associations
public function getEffectivePermissions($return_explicit = false) : array{
// The user has no permissions and is not in any groups
if (($this->permissions == '') || ($this->permissions == 'null')) {
return [];
}
$user_permissions = $this->permissions;
if (is_object($this->permissions)) {
$user_permissions = json_decode(json_encode($this->permissions), true);
}
if (is_string($this->permissions)) {
$user_permissions = json_decode($this->permissions, true);
}
$effective_permissions_array = [];
foreach (config('permissions') as $section => $section_permissions) {
for ($x = 0; $x < count($section_permissions); $x++) {
$permission_from_config = $section_permissions[$x]['permission'];
\Log::debug(print_r($user_permissions, true));
if ($user_permissions && array_key_exists($permission_from_config, $user_permissions)) {
// If the user has an explicit permission set, use that
if ($return_explicit) {
\Log::debug('using explicit');
if ($user_permissions[$permission_from_config] == '1') {
$effective_permissions_array[$permission_from_config] = 'grant';
} elseif ($user_permissions[$permission_from_config] == '-1') {
$effective_permissions_array[$permission_from_config] = 'deny';
} else {
$effective_permissions_array[$permission_from_config] = $this->hasAccess($permission_from_config) ? 'inherit-grant' : 'inherit-deny';
// $effective_permissions_array[$permission_from_config] = 'inherit';
}
} else {
$effective_permissions_array[$permission_from_config] = $this->hasAccess($permission_from_config) ? 'grant' : 'deny';
}
} else {
\Log::debug('fallthrough');
//$effective_permissions_array[$permission_from_config] = 'not in user perms';
$effective_permissions_array[$permission_from_config] = $this->hasAccess($permission_from_config) ? 'inherit-grant' : 'inherit-deny';
}
// $effective_permissions_array[$permission_from_config] = $this->hasAccess($permission_from_config) ? 1 : 0;
}
}
return $effective_permissions_array;
}
/**
* Check user permissions
*
@@ -367,17 +302,13 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
* @since [v1.0]
* @return bool
*/
public function hasAccess($section, $return_explicit = false)
public function hasAccess($section)
{
if ($this->isSuperUser()) {
return true;
}
if (($section!='superuser') && ($this->isAdmin())) {
return true;
}
return $this->checkPermissionSection($section, $return_explicit);
return $this->checkPermissionSection($section);
}
/**

View File

@@ -3,15 +3,14 @@
namespace App\Notifications;
use AllowDynamicProperties;
use App\Helpers\Helper;
use App\Models\Setting;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties] class AcceptanceAssetAcceptedNotification extends Notification
#[AllowDynamicProperties]
class AcceptanceItemAcceptedNotification extends Notification
{
use Queueable;
@@ -77,9 +76,14 @@ use Illuminate\Notifications\Notification;
'assigned_to' => $this->assigned_to,
'company_name' => $this->company_name,
'qty' => $this->qty,
'intro_text' => trans('mail.acceptance_asset_accepted'),
'intro_text' => trans('mail.acceptance_accepted_greeting', ['user' => $this->assigned_to, 'item' => $this->item_name]),
])
->subject(trans('mail.acceptance_asset_accepted'));
->subject('✅ '.trans('mail.acceptance_accepted', ['user' => $this->assigned_to, 'item' => $this->item_name]))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -8,8 +8,10 @@ use App\Models\Setting;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties] class AcceptanceAssetAcceptedToUserNotification extends Notification
#[AllowDynamicProperties]
class AcceptanceItemAcceptedToUserNotification extends Notification
{
use Queueable;
@@ -73,7 +75,12 @@ use Illuminate\Notifications\Notification;
'intro_text' => trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]),
])
->attach($pdf_path)
->subject(trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]));
->subject('✅ '. trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -2,15 +2,14 @@
namespace App\Notifications;
use App\Helpers\Helper;
use App\Models\Setting;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
class AcceptanceAssetDeclinedNotification extends Notification
#[AllowDynamicProperties]
class AcceptanceItemDeclinedNotification extends Notification
{
use Queueable;
@@ -21,6 +20,7 @@ class AcceptanceAssetDeclinedNotification extends Notification
*/
public function __construct($params)
{
$this->item_name = $params['item_name'];
$this->item_tag = $params['item_tag'];
$this->item_model = $params['item_model'];
$this->item_serial = $params['item_serial'];
@@ -64,6 +64,7 @@ class AcceptanceAssetDeclinedNotification extends Notification
$message = (new MailMessage)->markdown('notifications.markdown.asset-acceptance',
[
'item_tag' => $this->item_tag,
'item_name' => $this->item_name,
'item_model' => $this->item_model,
'item_serial' => $this->item_serial,
'item_status' => $this->item_status,
@@ -73,9 +74,14 @@ class AcceptanceAssetDeclinedNotification extends Notification
'company_name' => $this->company_name,
'qty' => $this->qty,
'admin' => $this->admin,
'intro_text' => trans('mail.acceptance_asset_declined'),
'intro_text' => trans('mail.acceptance_declined_greeting'),
])
->subject(trans('mail.acceptance_asset_declined'));
->subject('⚠️ '.trans('mail.acceptance_declined', ['user' => $this->assigned_to, 'item' => $this->item_name]))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -10,10 +10,17 @@ use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use NotificationChannels\GoogleChat\Card;
use NotificationChannels\GoogleChat\GoogleChatChannel;
use NotificationChannels\GoogleChat\GoogleChatMessage;
use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties] class AuditNotification extends Notification
#[AllowDynamicProperties]
class AuditNotification extends Notification
{
use Queueable;
/**
@@ -31,6 +38,10 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
//
$this->settings = Setting::getSettings();
$this->params = $params;
$item = $params['item'];
if (!$item || !is_object($item)) {
throw new \InvalidArgumentException('Notification requires a valid item.');
}
}
/**
@@ -49,6 +60,10 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
$notifyBy[] = MicrosoftTeamsChannel::class;
}
if (Setting::getSettings()->webhook_selected == 'google' && Setting::getSettings()->webhook_endpoint) {
Log::debug('using google webhook');
$notifyBy[] = GoogleChatChannel::class;
}
return $notifyBy;
}
@@ -82,16 +97,21 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
$location = $params['location'] ?? '';
$setting = Setting::getSettings();
//if somehow a notification triggers without an item, bail out.
if(!$item || !is_object($item)){
return null;
}
if(!Str::contains($setting->webhook_endpoint, 'workflows')) {
return MicrosoftTeamsMessage::create()
->to($setting->webhook_endpoint)
->type('success')
->title(class_basename(get_class($params['item'])) .' '.trans('general.audited'))
->title(class_basename($item).' '.trans('general.audited'))
->addStartGroupToSection('activityText')
->fact(trans('mail.asset'), $item)
->fact(trans('general.administrator'), $admin_user->present()->viewUrl() . '|' . $admin_user->display_name);
}
$message = class_basename(get_class($params['item'])) . ' Audited By '.$admin_user->display_name;
$message = class_basename(get_class($params['item'])) . trans('general.audited_by').' '.$admin_user->display_name;
$details = [
trans('mail.asset') => htmlspecialchars_decode($item->display_name),
trans('mail.notes') => $note ?: '',
@@ -99,4 +119,35 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
];
return [$message, $details];
}
public function toGoogleChat()
{
$item = $this->params['item'] ?? null;
$admin_user = $this->params['admin'] ?? null;
$note = $this->params['note'] ?? '';
$setting = $this->settings ?? Setting::getSettings();
$title = '<strong>' . class_basename($item) . ' ' . trans('general.audited') . '</strong>';
$subtitle = htmlspecialchars_decode($item->display_name ?? '');
\Log::debug('Google Chat audit payload', [
'title' => $title,
'subtitle' => $subtitle,
'admin' => $admin_user->display_name,
'note' => $note,
]);
return GoogleChatMessage::create()
->to($setting->webhook_endpoint)
->card(
Card::create()
->header($title, $subtitle)
->section(
Section::create(
KeyValue::create(
trans('general.audited_by'),
$admin_user?->display_name ?? '',
$note ?? ''
)->onClick(route('hardware.show', $item->id))
)
)
);
}
}

View File

@@ -18,8 +18,8 @@ use NotificationChannels\GoogleChat\Section;
use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
#[AllowDynamicProperties]
class CheckinAccessoryNotification extends Notification
{
use Queueable;

View File

@@ -20,6 +20,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
#[AllowDynamicProperties]
class CheckinAssetNotification extends Notification
{
use Queueable;

View File

@@ -18,6 +18,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
#[AllowDynamicProperties]
class CheckinComponentNotification extends Notification
{
use Queueable;

View File

@@ -19,6 +19,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
#[AllowDynamicProperties]
class CheckinLicenseSeatNotification extends Notification
{
use Queueable;

View File

@@ -18,7 +18,9 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class CheckoutAccessoryNotification extends Notification
{
use Queueable;
@@ -210,6 +212,11 @@ class CheckoutAccessoryNotification extends Notification
'accept_url' => $accept_url,
'checkout_qty' => $this->checkout_qty,
])
->subject(trans('mail.Confirm_accessory_delivery'));
->subject(trans('mail.Confirm_accessory_delivery'))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
}
}

View File

@@ -25,6 +25,7 @@ use Illuminate\Support\Facades\Log;
use Osama\LaravelTeamsNotification\Logging\TeamsLoggingChannel;
use Osama\LaravelTeamsNotification\TeamsNotification;
#[AllowDynamicProperties]
class CheckoutAssetNotification extends Notification
{
use Queueable;

View File

@@ -20,6 +20,7 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
#[AllowDynamicProperties]
class CheckoutComponentNotification extends Notification
{
use Queueable;

View File

@@ -20,6 +20,7 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
use Illuminate\Support\Facades\Log;
#[AllowDynamicProperties]
class CheckoutConsumableNotification extends Notification
{
use Queueable;

View File

@@ -19,6 +19,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
#[AllowDynamicProperties]
class CheckoutLicenseSeatNotification extends Notification
{
use Queueable;

View File

@@ -5,7 +5,9 @@ namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class CurrentInventory extends Notification
{
use Queueable;
@@ -45,7 +47,12 @@ class CurrentInventory extends Notification
'licenses' => $this->user->licenses,
'consumables' => $this->user->consumables,
])
->subject(trans('mail.inventory_report'));
->subject(trans('mail.inventory_report'))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -5,7 +5,9 @@ namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class ExpectedCheckinAdminNotification extends Notification
{
use Queueable;
@@ -48,7 +50,12 @@ class ExpectedCheckinAdminNotification extends Notification
[
'assets' => $this->assets,
])
->subject(trans('mail.Expected_Checkin_Report'));
->subject('⏰'.trans('mail.Expected_Checkin_Report'))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -3,10 +3,13 @@
namespace App\Notifications;
use App\Helpers\Helper;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class ExpectedCheckinNotification extends Notification
{
use Queueable;
@@ -47,14 +50,22 @@ class ExpectedCheckinNotification extends Notification
*/
public function toMail()
{
$today = Carbon::now();
$message = (new MailMessage)->markdown('notifications.markdown.expected-checkin',
[
'expected_checkin_date' => $this->params->expected_checkin,
'date' => Helper::getFormattedDateObject($this->params->expected_checkin, 'date', false),
'asset' => $this->params->display_name,
'serial' => $this->params->serial,
'asset_tag' => $this->params->asset_tag,
])
->subject(trans('mail.Expected_Checkin_Notification', ['name' => $this->params->display_name]));
->subject('⏰'. ($today > $this->params->expected_checkin) ? trans('mail.Expected_Checkin_Notification_Pastdue', ['name' => $this->params->display_name]) : trans('mail.Expected_Checkin_Notification', ['name' => $this->params->display_name]))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -5,7 +5,9 @@ namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class ExpiringAssetsNotification extends Notification
{
use Queueable;
@@ -51,7 +53,12 @@ class ExpiringAssetsNotification extends Notification
'assets' => $this->assets,
'threshold' => $this->threshold,
])
->subject(trans('mail.Expiring_Assets_Report'));
->subject('⏰'.trans('mail.Expiring_Assets_Report'))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -5,7 +5,9 @@ namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class ExpiringLicenseNotification extends Notification
{
use Queueable;
@@ -52,7 +54,12 @@ class ExpiringLicenseNotification extends Notification
'licenses' => $this->licenses,
'threshold' => $this->threshold,
])
->subject(trans('mail.Expiring_Licenses_Report'));
->subject('⏰'.trans('mail.Expiring_Licenses_Report'))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

View File

@@ -5,7 +5,9 @@ namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class FirstAdminNotification extends Notification
{
use Queueable;
@@ -45,7 +47,12 @@ class FirstAdminNotification extends Notification
public function toMail()
{
return (new MailMessage)
->subject(trans('mail.welcome', ['name' => $this->_data['first_name'].' '.$this->_data['last_name']]))
->markdown('notifications.FirstAdmin', $this->_data);
->subject('👋 '.trans('mail.welcome', ['name' => $this->_data['first_name'].' '.$this->_data['last_name']]))
->markdown('notifications.FirstAdmin', $this->_data)
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
}
}

View File

@@ -6,6 +6,7 @@ use AllowDynamicProperties;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
#[AllowDynamicProperties]
class InventoryAlert extends Notification
@@ -52,7 +53,12 @@ class InventoryAlert extends Notification
'threshold' => $this->threshold,
]
)
->subject(trans('mail.Low_Inventory_Report'));
->subject('⚠️ '.trans('mail.Low_Inventory_Report'))
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->addTextHeader(
'X-System-Sender', 'Snipe-IT'
);
});
return $message;
}

Some files were not shown because too many files have changed in this diff Show More