mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Merge pull request #295 from PetriAsi/fix/jorips1
Rebased Fix/jorips1 orginal PR New/Set licenses Removed Validate Length from New-SnipeitLicense -license_email, bringing it in line with Set. This was causing the parameter to fail as it cannot validate the mailaddress object. Added code to convert -license_email to string, as required by the SnipeitAPI. Added -purchase_order functionality. New Supplier Fixed typo in API which was causing the command to fail.
This commit is contained in:
commit
29c23e92ea
3 changed files with 18 additions and 2 deletions
|
|
@ -47,6 +47,9 @@
|
|||
.PARAMETER purchase_date
|
||||
Date of license purchase
|
||||
|
||||
.PARAMETER purchase_order
|
||||
Purchase order number of license purchase
|
||||
|
||||
.PARAMETER reassignable
|
||||
Is license reassignable?
|
||||
|
||||
|
|
@ -89,7 +92,6 @@ function New-SnipeitLicense() {
|
|||
|
||||
[datetime]$expiration_date,
|
||||
|
||||
[ValidateLength(1, 120)]
|
||||
[mailaddress]$license_email,
|
||||
|
||||
[ValidateLength(1, 100)]
|
||||
|
|
@ -108,6 +110,8 @@ function New-SnipeitLicense() {
|
|||
|
||||
[datetime]$purchase_date,
|
||||
|
||||
[string]$purchase_order,
|
||||
|
||||
[bool]$reassignable,
|
||||
|
||||
[string]$serial,
|
||||
|
|
@ -140,6 +144,10 @@ function New-SnipeitLicense() {
|
|||
$Values['termination_date'] = $Values['termination_date'].ToString("yyyy-MM-dd")
|
||||
}
|
||||
|
||||
if ($Values['license_email']) {
|
||||
$Values['license_email'] = $Values['license_email'].address
|
||||
}
|
||||
|
||||
$Parameters = @{
|
||||
Api = "/api/v1/licenses"
|
||||
Method = 'POST'
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ function New-SnipeitSupplier() {
|
|||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||
|
||||
$Parameters = @{
|
||||
Api = "/api/v1/suppilers"
|
||||
Api = "/api/v1/suppliers"
|
||||
Method = 'POST'
|
||||
Body = $Values
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@
|
|||
.PARAMETER purchase_date
|
||||
Date of license purchase
|
||||
|
||||
.PARAMETER purchase_order
|
||||
Purchase order number of license purchase
|
||||
|
||||
.PARAMETER reassignable
|
||||
Is license reassignable?
|
||||
|
||||
|
|
@ -116,6 +119,8 @@ function Set-SnipeitLicense() {
|
|||
|
||||
[datetime]$purchase_date,
|
||||
|
||||
[string]$purchase_order,
|
||||
|
||||
[bool]$reassignable,
|
||||
|
||||
[string]$serial,
|
||||
|
|
@ -151,6 +156,9 @@ function Set-SnipeitLicense() {
|
|||
$Values['termination_date'] = $Values['termination_date'].ToString("yyyy-MM-dd")
|
||||
}
|
||||
|
||||
if ($Values['license_email']) {
|
||||
$Values['license_email'] = $Values['license_email'].address
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue