Skip to content

Commit

Permalink
Jamf2Pureservice: Bruker lastEnrollment som memberSince hvis den ikke…
Browse files Browse the repository at this point in the history
… eksisterer
  • Loading branch information
EirikWulff committed Jun 19, 2024
1 parent 1e40793 commit a80ade1
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions app/Console/Commands/Jamf2Pureservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,15 @@ public function getJamfAssetsAsPsAssets() {
if ($dev['general']['osVersion'] != null):
$psAsset[$fn['OsVersion']] = $dev['general']['osVersion'];
endif;
if (isset($dev['general']['initialEntryTimestamp']) && $dev['general']['initialEntryTimestamp'] != ''):
$memberSinceData = $dev['general']['initialEntryTimestamp'];
else:
$memberSinceData = $dev['general']['lastEnrolledDate'];
endif;
$memberSince = Carbon::create($memberSinceData)->timezone(config('app.timezone'));

$psAsset[$fn['memberSince']] = Carbon::create($dev['general']['initialEntryTimestamp'])
->timezone(config('app.timezone'))
->toJSON();
$psAsset[$fn['EOL']] = Carbon::create($dev['general']['initialEntryTimestamp'])
->timezone(config('app.timezone'))
$psAsset[$fn['memberSince']] = $memberSince->copy()->toJSON();
$psAsset[$fn['EOL']] = $memberSince->copy()
->addYears(config('pureservice.mobile.lifespan', 3))
->toJSON();
if ($dev['general']['lastInventoryUpdateDate'] != null):
Expand Down Expand Up @@ -326,11 +329,15 @@ public function getJamfAssetsAsPsAssets() {
$psAsset[$fn['OsVersion']] = $mac['operatingSystem']['version'];
endif;

$psAsset[$fn['memberSince']] = Carbon::create($mac['general']['initialEntryDate'])
->timezone(config('app.timezone'))
->toJSON();
$psAsset[$fn['EOL']] = Carbon::create($mac['general']['initialEntryDate'])
->timezone(config('app.timezone'))
if (isset($mac['general']['initialEntryDate']) && $mac['general']['initialEntryDate'] != ''):
$memberSinceData = $dev['general']['initialEntryDate'];
else:
$memberSinceData = $dev['general']['lastEnrolledDate'];
endif;
$memberSince = Carbon::create($memberSinceData)->timezone(config('app.timezone'));

$psAsset[$fn['memberSince']] = $memberSince->copy()->toJSON();
$psAsset[$fn['EOL']] = $memberSince->copy()
->addYears(config('pureservice.computer.lifespan', 4))
->toJSON();
if ($mac['general']['lastContactTime'] != null):
Expand Down

0 comments on commit a80ade1

Please sign in to comment.