Skip to content

Commit d88fe1f

Browse files
committed
Merge branch 'develop' into chore/migrate-select-helper
2 parents 2a15677 + 8c164d1 commit d88fe1f

35 files changed

+426
-329
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,6 +3298,15 @@
32983298
"contributions": [
32993299
"code"
33003300
]
3301+
},
3302+
{
3303+
"login": "Fiala06",
3304+
"name": "Fiala06",
3305+
"avatar_url": "https://avatars.githubusercontent.com/u/5183146?v=4",
3306+
"profile": "https://github.com/Fiala06",
3307+
"contributions": [
3308+
"code"
3309+
]
33013310
}
33023311
]
33033312
}

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
5353
| [<img src="https://avatars.githubusercontent.com/u/55590532?v=4" width="110px;"/><br /><sub>squintfox</sub>](https://github.com/squintfox)<br />[💻](https://github.com/snipe/snipe-it/commits?author=squintfox "Code") | [<img src="https://avatars.githubusercontent.com/u/1380084?v=4" width="110px;"/><br /><sub>Jeff Clay</sub>](https://github.com/jeffclay)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jeffclay "Code") | [<img src="https://avatars.githubusercontent.com/u/52716446?v=4" width="110px;"/><br /><sub>Phil J R</sub>](https://github.com/PP-JN-RL)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PP-JN-RL "Code") | [<img src="https://avatars.githubusercontent.com/u/1496725?v=4" width="110px;"/><br /><sub>i_virus</sub>](https://www.corelight.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chandanchowdhury "Code") | [<img src="https://avatars.githubusercontent.com/u/1020541?v=4" width="110px;"/><br /><sub>Paul Grime</sub>](https://github.com/gitgrimbo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gitgrimbo "Code") | [<img src="https://avatars.githubusercontent.com/u/922815?v=4" width="110px;"/><br /><sub>Lee Porte</sub>](https://leeporte.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=LeePorte "Code") | [<img src="https://avatars.githubusercontent.com/u/23613427?v=4" width="110px;"/><br /><sub>BRYAN </sub>](https://github.com/bryanlopezinc)<br />[💻](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Code") [⚠️](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Tests") |
5454
| [<img src="https://avatars.githubusercontent.com/u/64061710?v=4" width="110px;"/><br /><sub>U-H-T</sub>](https://github.com/U-H-T)<br />[💻](https://github.com/snipe/snipe-it/commits?author=U-H-T "Code") | [<img src="https://avatars.githubusercontent.com/u/5395363?v=4" width="110px;"/><br /><sub>Matt Tyree</sub>](https://github.com/Tyree)<br />[📖](https://github.com/snipe/snipe-it/commits?author=Tyree "Documentation") | [<img src="https://avatars.githubusercontent.com/u/292081?v=4" width="110px;"/><br /><sub>Florent Bervas</sub>](http://spoontux.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FlorentDotMe "Code") | [<img src="https://avatars.githubusercontent.com/u/4498077?v=4" width="110px;"/><br /><sub>Daniel Albertsen</sub>](https://ditscheri.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dbakan "Code") | [<img src="https://avatars.githubusercontent.com/u/100710244?v=4" width="110px;"/><br /><sub>r-xyz</sub>](https://github.com/r-xyz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=r-xyz "Code") | [<img src="https://avatars.githubusercontent.com/u/47491036?v=4" width="110px;"/><br /><sub>Steven Mainor</sub>](https://github.com/DrekiDegga)<br />[💻](https://github.com/snipe/snipe-it/commits?author=DrekiDegga "Code") | [<img src="https://avatars.githubusercontent.com/u/65785975?v=4" width="110px;"/><br /><sub>arne-kroeger</sub>](https://github.com/arne-kroeger)<br />[💻](https://github.com/snipe/snipe-it/commits?author=arne-kroeger "Code") |
5555
| [<img src="https://avatars.githubusercontent.com/u/167117705?v=4" width="110px;"/><br /><sub>Glukose1</sub>](https://github.com/Glukose1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Glukose1 "Code") | [<img src="https://avatars.githubusercontent.com/u/1197791?v=4" width="110px;"/><br /><sub>Scarzy</sub>](https://github.com/Scarzy)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Scarzy "Code") | [<img src="https://avatars.githubusercontent.com/u/37372069?v=4" width="110px;"/><br /><sub>setpill</sub>](https://github.com/setpill)<br />[💻](https://github.com/snipe/snipe-it/commits?author=setpill "Code") | [<img src="https://avatars.githubusercontent.com/u/3755203?v=4" width="110px;"/><br /><sub>swift2512</sub>](https://github.com/swift2512)<br />[🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aswift2512 "Bug reports") | [<img src="https://avatars.githubusercontent.com/u/6136439?v=4" width="110px;"/><br /><sub>Darren Rainey</sub>](https://darrenraineys.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=DarrenRainey "Code") | [<img src="https://avatars.githubusercontent.com/u/133033121?v=4" width="110px;"/><br /><sub>maciej-poleszczyk</sub>](https://github.com/maciej-poleszczyk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=maciej-poleszczyk "Code") | [<img src="https://avatars.githubusercontent.com/u/143394709?v=4" width="110px;"/><br /><sub>Sebastian Groß</sub>](https://github.com/sgross-emlix)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sgross-emlix "Code") |
56-
| [<img src="https://avatars.githubusercontent.com/u/41107778?v=4" width="110px;"/><br /><sub>Anouar Touati</sub>](https://github.com/AnouarTouati)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AnouarTouati "Code") | [<img src="https://avatars.githubusercontent.com/u/25596663?v=4" width="110px;"/><br /><sub>aHVzY2g</sub>](https://github.com/aHVzY2g)<br />[💻](https://github.com/snipe/snipe-it/commits?author=aHVzY2g "Code") | [<img src="https://avatars.githubusercontent.com/u/13408130?v=4" width="110px;"/><br /><sub>林博仁 Buo-ren Lin</sub>](https://brlin.me)<br />[💻](https://github.com/snipe/snipe-it/commits?author=brlin-tw "Code") | [<img src="https://avatars.githubusercontent.com/u/18550946?v=4" width="110px;"/><br /><sub>Adugna Gizaw</sub>](https://orbalia.pythonanywhere.com/)<br />[🌍](#translation-addex12 "Translation") | [<img src="https://avatars.githubusercontent.com/u/760989?v=4" width="110px;"/><br /><sub>Jesse Ostrander</sub>](https://github.com/jostrander)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jostrander "Code") | [<img src="https://avatars.githubusercontent.com/u/31522486?v=4" width="110px;"/><br /><sub>James M</sub>](https://github.com/azmcnutt)<br />[💻](https://github.com/snipe/snipe-it/commits?author=azmcnutt "Code") |
56+
| [<img src="https://avatars.githubusercontent.com/u/41107778?v=4" width="110px;"/><br /><sub>Anouar Touati</sub>](https://github.com/AnouarTouati)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AnouarTouati "Code") | [<img src="https://avatars.githubusercontent.com/u/25596663?v=4" width="110px;"/><br /><sub>aHVzY2g</sub>](https://github.com/aHVzY2g)<br />[💻](https://github.com/snipe/snipe-it/commits?author=aHVzY2g "Code") | [<img src="https://avatars.githubusercontent.com/u/13408130?v=4" width="110px;"/><br /><sub>林博仁 Buo-ren Lin</sub>](https://brlin.me)<br />[💻](https://github.com/snipe/snipe-it/commits?author=brlin-tw "Code") | [<img src="https://avatars.githubusercontent.com/u/18550946?v=4" width="110px;"/><br /><sub>Adugna Gizaw</sub>](https://orbalia.pythonanywhere.com/)<br />[🌍](#translation-addex12 "Translation") | [<img src="https://avatars.githubusercontent.com/u/760989?v=4" width="110px;"/><br /><sub>Jesse Ostrander</sub>](https://github.com/jostrander)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jostrander "Code") | [<img src="https://avatars.githubusercontent.com/u/31522486?v=4" width="110px;"/><br /><sub>James M</sub>](https://github.com/azmcnutt)<br />[💻](https://github.com/snipe/snipe-it/commits?author=azmcnutt "Code") | [<img src="https://avatars.githubusercontent.com/u/5183146?v=4" width="110px;"/><br /><sub>Fiala06</sub>](https://github.com/Fiala06)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Fiala06 "Code") |
5757
<!-- ALL-CONTRIBUTORS-LIST:END -->
5858

5959
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

app/Console/Commands/SendExpirationAlerts.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct()
4242
public function handle()
4343
{
4444
$settings = Setting::getSettings();
45-
$threshold = $settings->alert_interval;
45+
$alert_interval = $settings->alert_interval;
4646

4747
if (($settings->alert_email != '') && ($settings->alerts_enabled == 1)) {
4848

@@ -51,18 +51,18 @@ public function handle()
5151
->map(fn($item) => trim($item)) // Trim each email
5252
->all();
5353
// Expiring Assets
54-
$assets = Asset::getExpiringWarrantee($threshold);
54+
$assets = Asset::getExpiringWarrantee($alert_interval);
5555

5656
if ($assets->count() > 0) {
57-
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $threshold]));
58-
Mail::to($recipients)->send(new ExpiringAssetsMail($assets, $threshold));
57+
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $alert_interval]));
58+
Mail::to($recipients)->send(new ExpiringAssetsMail($assets, $alert_interval));
5959
}
6060

6161
// Expiring licenses
62-
$licenses = License::getExpiringLicenses($threshold);
62+
$licenses = License::getExpiringLicenses($alert_interval);
6363
if ($licenses->count() > 0) {
64-
$this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $threshold]));
65-
Mail::to($recipients)->send(new ExpiringLicenseMail($licenses, $threshold));
64+
$this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $alert_interval]));
65+
Mail::to($recipients)->send(new ExpiringLicenseMail($licenses, $alert_interval));
6666
}
6767
} else {
6868
if ($settings->alert_email == '') {

app/Exceptions/Handler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ public function render($request, Throwable $e)
125125
// This is traaaaash but it handles models that are not found while using route model binding :(
126126
// The only alternative is to set that at *each* route, which is crazypants
127127
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
128-
$model_name = last(explode('\\', $e->getModel()));
128+
129+
// This gets the MVC model name from the exception and formats in a way that's less fugly
130+
$model_name = strtolower(implode(" ", preg_split('/(?=[A-Z])/', last(explode('\\', $e->getModel())))));
129131
$route = str_plural(strtolower(last(explode('\\', $e->getModel())))).'.index';
130132

131133
// Sigh.

app/Http/Controllers/SettingsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,8 @@ public function postLdapSettings(StoreLdapSettings $request) : RedirectResponse
850850
$setting->ldap_fname_field = $request->input('ldap_fname_field');
851851
$setting->ldap_auth_filter_query = $request->input('ldap_auth_filter_query');
852852
$setting->ldap_version = $request->input('ldap_version', 3);
853-
$setting->ldap_active_flag = $request->input('ldap_active_flag');
854-
$setting->ldap_invert_active_flag = $request->input('ldap_invert_active_flag');
853+
$setting->ldap_active_flag = $request->input('ldap_active_flag', 0);
854+
$setting->ldap_invert_active_flag = $request->input('ldap_invert_active_flag', 0);
855855
$setting->ldap_emp_num = $request->input('ldap_emp_num');
856856
$setting->ldap_email = $request->input('ldap_email');
857857
$setting->ldap_manager = $request->input('ldap_manager');

app/Http/Requests/SaveUserRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public function response(array $errors)
3333
public function rules()
3434
{
3535
$rules = [
36-
'department_id' => 'nullable|exists:departments,id',
36+
'department_id' => 'nullable|integer|exists:departments,id',
3737
'manager_id' => 'nullable|exists:users,id',
38-
'company_id' => ['nullable','exists:companies,id']
38+
'company_id' => ['nullable', 'integer', 'exists:companies,id']
3939
];
4040

4141
switch ($this->method()) {

app/Models/Asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public static function getExpiringWarrantee($days = 30)
785785
->whereNotNull('warranty_months')
786786
->whereNotNull('purchase_date')
787787
->whereNull('deleted_at')
788-
->whereRaw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) <= DATE(NOW() + INTERVAL '
788+
->whereRaw('DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) <= DATE_ADD(NOW(), INTERVAL '
789789
. $days
790790
. ' DAY) AND DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) > NOW()')
791791
->orderByRaw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH)')

app/Models/Loggable.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use App\Notifications\AuditNotification;
77
use Illuminate\Support\Facades\Auth;
88
use Illuminate\Support\Facades\Log;
9+
use Illuminate\Support\Str;
10+
use Osama\LaravelTeamsNotification\TeamsNotification;
911

1012
trait Loggable
1113
{
@@ -242,7 +244,14 @@ public function logAudit($note, $location_id, $filename = null)
242244
'location' => ($location) ? $location->name : '',
243245
'note' => $note,
244246
];
245-
Setting::getSettings()->notify(new AuditNotification($params));
247+
if(Setting::getSettings()->webhook_selected === 'microsoft' && Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')){
248+
$message = AuditNotification::toMicrosoftTeams($params);
249+
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
250+
$notification->success()->sendMessage($message[0], $message[1]);
251+
}
252+
else {
253+
Setting::getSettings()->notify(new AuditNotification($params));
254+
}
246255

247256
return $log;
248257
}

app/Models/ReportTemplate.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -44,44 +44,6 @@ protected static function booted()
4444
$builder->where('created_by', auth()->id());
4545
}
4646
});
47-
48-
static::created(function (ReportTemplate $reportTemplate) {
49-
$logAction = new Actionlog([
50-
'item_type' => ReportTemplate::class,
51-
'item_id' => $reportTemplate->id,
52-
'created_by' => auth()->id(),
53-
]);
54-
55-
$logAction->logaction('create');
56-
});
57-
58-
static::updated(function (ReportTemplate $reportTemplate) {
59-
$changed = [];
60-
61-
foreach ($reportTemplate->getDirty() as $key => $value) {
62-
$changed[$key] = [
63-
'old' => $reportTemplate->getOriginal($key),
64-
'new' => $reportTemplate->getAttribute($key),
65-
];
66-
}
67-
68-
$logAction = new Actionlog();
69-
$logAction->item_type = ReportTemplate::class;
70-
$logAction->item_id = $reportTemplate->id;
71-
$logAction->created_by = auth()->id();
72-
$logAction->log_meta = json_encode($changed);
73-
$logAction->logaction('update');
74-
});
75-
76-
static::deleted(function (ReportTemplate $reportTemplate) {
77-
$logAction = new Actionlog([
78-
'item_type' => ReportTemplate::class,
79-
'item_id' => $reportTemplate->id,
80-
'created_by' => auth()->id(),
81-
]);
82-
83-
$logAction->logaction('delete');
84-
});
8547
}
8648

8749
/**

app/Models/Setting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public static function fileSizeConvert($bytes): string
247247
*
248248
* @return string
249249
*/
250-
public function routeNotificationForSlack(): string
250+
public function routeNotificationForSlack(): ?string
251251
{
252252
// At this point the endpoint is the same for everything.
253253
// In the future this may want to be adapted for individual notifications.
@@ -259,7 +259,7 @@ public function routeNotificationForSlack(): string
259259
*
260260
* @return string
261261
*/
262-
public function routeNotificationForMail(): string
262+
public function routeNotificationForMail(): ?string
263263
{
264264
// At this point the endpoint is the same for everything.
265265
// In the future this may want to be adapted for individual notifications.

0 commit comments

Comments
 (0)