Skip to content

Commit

Permalink
fix parameters for Update-VaultItem
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobBertagnolli committed Dec 1, 2022
1 parent 8fe6f7c commit 0880531
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions Files/DataStandard/Vault.Custom/addinVault/powerGateMain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,7 @@ function SetEntityProperties($erpMaterial, $vaultEntity) {
#TODO: Update Entity UDPs with values from ERP
if ($vaultEntity._EntityTypeID -eq "ITEM") {
try {
Update-VaultItemWithErrorHandling -Number $vaultEntity._Number -Properties @{
#the item description cannot be updated, since "Description (Item,CO)" is a system property!
"_Description(Item,CO)" = $erpMaterial.Description
"_Number" = $erpMaterial.Number
Update-VaultItemWithErrorHandling -Number $vaultEntity._Number -ErpMaterial $erpMaterial -Properties @{
}
}catch {
ShowMessageBox -Message $_.Exception.Message -Title "powerGate ERP - Link ERP Item" -Button "OK" -Icon "Error"
Expand Down
3 changes: 2 additions & 1 deletion Files/powerGate/Modules/MaterialFunctions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ function Update-VaultFileWithErrorHandling {
function Update-VaultItemWithErrorHandling {
param (
$Number,
$erpMaterial,
[Hashtable]$Properties
)
$fehler = $false
$updateditem = Update-VaultItem -Number $Number -Properties $Properties
$updateditem = Update-VaultItem -Number $Number -Description $erpMaterial.Description -NewNumber $erpMaterial.Number -Properties $Properties
foreach($prop in $Properties.GetEnumerator()){
if($updateditem.($prop.Key) -ne ($prop.Value)){
$fehler = $true
Expand Down

0 comments on commit 0880531

Please sign in to comment.