# Site 6.0.x updates
function Execute6.0SiteUpdates 
{
	SiteUpdate_6.0_01 6011
	SetTemplateVersion "6.0.1.1" -IgnoreWhenHigherVersion
	SiteUpdate_6.0_02 6020
	SiteUpdate_6.0_03 6020
	SetTemplateVersion "6.0.2.0" -IgnoreWhenHigherVersion
	SiteUpdate_6.0_04 6030
	SetTemplateVersion "6.0.3.0" -IgnoreWhenHigherVersion
	SiteUpdate_6.0_05 6043
	SiteUpdate_6.0_06 6040
	SetTemplateVersion "6.0.4.3" -IgnoreWhenHigherVersion
	# Updates from 6.0.4.3 baseline
	SiteUpdate_6.0_07 6051
	SiteUpdate_6.0_08 6050
	SiteUpdate_6.0_09 6050
	SiteUpdate_6.0_10 6050
	#SiteUpdate_6.0_11 6050 Skip because of SiteUpdate_6.0_19
	SiteUpdate_6.0_12 6050
	SiteUpdate_6.0_13 6051
	SiteUpdate_6.0_14 6050
	SiteUpdate_6.0_15 6050
	SiteUpdate_6.0_16 6050
	SiteUpdate_6.0_17 6050
	SiteUpdate_6.0_18 6060
	SiteUpdate_6.0_19 6060
	SiteUpdate_6.0_20 6060
	SiteUpdate_6.0_21 6060
	SiteUpdate_6.0_22 6060
	SiteUpdate_6.0_23 6060
	SetTemplateVersion "6.0.6.0" -IgnoreWhenHigherVersion
}
# List: IVRQuestions, CT: IVRHolidayQuestionItem, Field: Title
# Change DisplayName to "HolidayQuestion"
function SiteUpdate_6.0_01($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	try
	{
		SetContentTypeFieldDisplayName "IVRQuestions" "IVRHolidayQuestionItem" "Title" "HolidayQuestion"
	}
	catch
	{
		if ($SPversion -eq "online") 
		{
			throw
		}
	}
}
# List: PluginSettings, CT: PluginSetting, Field: wsp_ucc_ps_prompt
# Change Required to false
function SiteUpdate_6.0_02($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	SetContentTypeFieldRequired "PluginSettings" "PluginSetting" "wsp_ucc_ps_prompt" $false
}
# List: TimerJobs, CT: TimerJob
# Remove 'wsp_ucc_tj_lastExecutionTime' field from CT
# Remove 'wsp_ucc_tj_status' field from CT
# Remove 'wsp_ucc_tj_error' field from CT
function SiteUpdate_6.0_03($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	RemoveFieldsFromContentType "TimerJob" @("wsp_ucc_tj_lastExecutionTime", "wsp_ucc_tj_status", "wsp_ucc_tj_error") "TimerJobs"
}
# (ivrgfx.aspx removed)
# Update portal.aspx
function SiteUpdate_6.0_04($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	UpdatePages $languageInfo[0] $updateSite @("portal.aspx")
}
# Update portal.aspx
function SiteUpdate_6.0_05($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	UpdatePages $languageInfo[0] $updateSite @("portal.aspx")
}
# List: settingsList 
# IVR graphics functionality removed - function kept for version compatibility
function SiteUpdate_6.0_06($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	# IVR graphics removed - no action needed
}
##################################################
# List: RetentionPolicy, Field: wsp_ucc_rp_list
# Add 'InboundScreenRecordings' choice
# Add 'OutboundScreenRecordings' choice
# Enable FillInChoice
function SiteUpdate_6.0_07($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$field1 = GetPnPField "wsp_ucc_rp_list"
	$field2 = GetPnPField "wsp_ucc_rp_list" "RetentionPolicy"
	$updateChoices = @("Recordings", "CallSummary", "Voicemails", "OutboundDialerCalls", "InboundScreenRecordings", "OutboundScreenRecordings")
	AddChoiceFieldItems @($field1, $field2) $updateChoices $true
}
# List: SettingValues
# Update sorting in default view
# Remove items (if any)
# Import new data
function SiteUpdate_6.0_08($patchVersion)
{
    if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$listTitle = "SettingValues"
	AddPnPView $listTitle "AllItems" "AllItems" 100 '<OrderBy><FieldRef Name="Title" /></OrderBy>' @("LinkTitle", "wsp_ucc_sv_type", "wsp_ucc_sv_value", "wsp_ucc_sv_default", "wsp_ucc_sv_description", "wsp_ucc_sv_scope", "wsp_ucc_sv_settinggroup", "wsp_ucc_sv_readonly", "wsp_ucc_sv_active") -Default -RemoveIfExists
	return # Skip because of SiteUpdate_6.0_23
	if ($newSite -eq $null)
	{
		UpdateSettingValues
	}
}
# List: Settings
# Find 'HuntingMethod' setting in import data
# Update 'HuntingMethod' setting with import data
function SiteUpdate_6.0_09($patchVersion)
{
	if ($patchCheck -ge $patchVersion -or $newSite -eq $true) 
	{
		return
	}
	$listTitle = "Settings"
	$language = $languageInfo[2]
	$importFile = "$RootPath\AnywhereNow\CSV\$language\Settings.csv"
    $data = Import-Csv $importFile -Delimiter ";"
    foreach ($row in $data) 
	{
       if ($row.wsp_ucc_Key -eq "HuntingMethod")
	   {
			$updateItem = Get-PnPListItem -List $listTitle -Query '<View><Query><Where><Eq><FieldRef Name="wsp_ucc_Key" /><Value Type="Text">HuntingMethod</Value></Eq></Where></Query></View>'
			if ($updateItem -ne $null) 
			{
				SetPnPListItem $listTitle $updateItem @{"wsp_ucc_Description" = $row.wsp_ucc_Description}
			}
			break
	   }
    }
}
# List: AudioFiles, CT: Document, Field: Title
# Change Required to false
# Add field to default view
function SiteUpdate_6.0_10($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$ctName = GetDocumentCTLocale $languageInfo[0]
	SetContentTypeFieldRequired "AudioFiles" $ctName "Title" $true
	AddPnPView "AudioFiles" "AllItems" "All Documents" 30 '<OrderBy><FieldRef Name="FileLeafRef" /></OrderBy>' @("DocIcon", "LinkFilename", "Title", "Modified", "Editor") -Default -RemoveIfExists
}
# Update portal.aspx
function SiteUpdate_6.0_11($patchVersion)
{
	if ($patchCheck -ge $patchVersion -or $newSite -eq $true) 
	{
		return
	}
	UpdatePages $languageInfo[0] $updateSite @("portal.aspx")
}
# List: RetentionPolicy, CT: RetentionPolicyItem
# Remove 'wsp_ucc_rp_lastExecutionTime' field from CT
# Remove 'wsp_ucc_rp_status' field from CT
# Remove 'wsp_ucc_rp_error' field from CT
function SiteUpdate_6.0_12($patchVersion) 
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	RemoveFieldsFromContentType "RetentionPolicyItem" @("wsp_ucc_rp_lastExecutionTime", "wsp_ucc_rp_status", "wsp_ucc_rp_error") "RetentionPolicy"
}
# List: PluginFlowSettings, Field: wsp_ucc_pfs_action
# List: IVRQuestions, Field: wsp_ucc_ivr_action
# List: Routing, Field: wsp_ucc_routing_action
# Add 'QueuedCallback' choice
function SiteUpdate_6.0_13($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$updateLists = @("PluginFlowSettings", "IVRQuestions", "Routing")
	$updateFields = @("wsp_ucc_pfs_action", "wsp_ucc_ivr_action", "wsp_ucc_routing_action")
	$updateChoices0 =  @("Callback", "Disconnect", "Forward", "Message", "PreferredHunt", "Prompt", "Question", "QueuedCallback", "Skill", "Voicemail")
	$updateChoices1 =  @("", "Callback", "Disconnect", "Previous", "Prompt", "QueuedCallback", "Skill", "Voicemail")
	$updateChoices2 =  @("Callback", "Disconnect", "Forward", "Prompt", "Question", "QueuedCallback", "Skill", "Voicemail")
	$i = 0
	foreach ($updateField in $updateFields)
	{
		$field1 = GetPnPField $updateField
		$field2 = GetPnPField $updateField $updateLists[$i]
		$updateChoices = Get-Variable -Name "updateChoices$i" -ValueOnly
		AddChoiceFieldItems @($field1, $field2) $updateChoices
		$i++
	}
}
# List: Agents, CT: Agent
# Add 'SubscriptionState' field
# Remove field from content type
# Add field to default view
function SiteUpdate_6.0_14($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	 AddPnPFieldFromXml '<Field ID="{56479636-3436-4d3b-bec0-8b080b1b2d77}" Type="Text" Name="SubscriptionState" DisplayName="SubscriptionState" Required="FALSE" Group="AnywhereNow" />' $null "SubscriptionState" "Agents"
	 RemoveFieldsFromContentType "Agent" @("SubscriptionState") "Agents"
	 AddPnPView "Agents" "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" Ascending="True"/></OrderBy>' @("wsp_ucc_Agent", "Edit", "wsp_ucc_Order", "wsp_ucc_Formal", "CustomHours", "wsp_ucc_agent_aci", "SubscriptionState") -Default -RemoveIfExists
}
# Update view lists: Businesshours, CallSummary, PluginAttributes, PluginSettings, PromptsConfig, QualityMonitorConfig, SkillsPerAgent, Supervisors, TrainerTrainee
function SiteUpdate_6.0_15($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	# Businesshours
	AddPnPView "Businesshours" "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" Ascending="True"/></OrderBy>' @("wsp_ucc_day", "Edit", "wsp_ucc_Start", "wsp_ucc_End", "wsp_ucc_AllDay") -Default -RemoveIfExists
	# CallSummary
	AddPnPView "CallSummary" "MissedCallsToDay" "MissedCallsToday" 30 '<Where><And><Eq><FieldRef Name="wsp_ucc_Accepted" /><Value Type="Boolean">0</Value></Eq><Eq><FieldRef Name="wsp_ucc_StartTime" /><Value Type="DateTime"><Today /></Value></Eq></And></Where><OrderBy><FieldRef Name="ID" Ascending="True"/></OrderBy>' @("LinkTitle", "wsp_ucc_StartTime", "wsp_ucc_Customer", "wsp_ucc_SkillChosen") -RemoveIfExists
	# PluginAttributes
	AddPnPView "PluginAttributes" "AllItems" "AllItems" 30 '<GroupBy Collapse="$false" GroupLimit="100"><FieldRef Name="wsp_ucc_pa_category" Ascending="True"/></GroupBy><OrderBy><FieldRef Name="wsp_ucc_pa_order" Ascending="$true" /></OrderBy>' @("LinkTitle", "wsp_ucc_pa_systemname", "wsp_ucc_pa_show", "wsp_ucc_pa_show_toast", "wsp_ucc_pa_order", "wsp_ucc_pa_fieldtype", "wsp_ucc_pa_hyperlink", "wsp_ucc_pa_open", "wsp_ucc_pa_category") -Default -RemoveIfExists
	# PluginSettings
	AddPnPView "PluginSettings" "AllItems" "AllItems" 30 '<GroupBy Collapse="$false" GroupLimit="100"><FieldRef Name="wsp_ucc_ps_scope" Ascending="True"/></GroupBy><OrderBy><FieldRef Name="Title" Ascending="$true" /></OrderBy>' @("LinkTitle", "wsp_ucc_ps_value", "wsp_ucc_ps_scope", "wsp_ucc_ps_prompt") -Default -RemoveIfExists
	# PromptsConfig
	AddPnPView "PromptsConfig" "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" /><FieldRef Name="ID" /></OrderBy>' @("PromptId", "Edit", "Welcome", "wsp_ucc_pc_audiofile", "Happy", "Sad", "SuccesAction") -Default -RemoveIfExists
	# QualityMonitorConfig
	AddPnPView "QualityMonitorConfig" "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" /></OrderBy>' @("Welcome", "Edit", "ValueStart", "ValueEnd", "GoodBye", "WelcomeAudio", "GoodByeAudio", "wsp_ucc_qmc_modality", "wsp_ucc_qmc_order") -Default -RemoveIfExists
	# SkillsPerAgent
	AddPnPView "SkillsPerAgent" "AllItems" "AllItems" 500 "<OrderBy><FieldRef Name=""ID"" /></OrderBy>" @("wsp_ucc_spa_skill", "Edit", "wsp_ucc_Score", "wsp_ucc_spa_Agent") -Default -RemoveIfExists
	AddPnPView "SkillsPerAgent" "GroupBySip" "GroupBySip" 500 "<GroupBy><FieldRef Name=""wsp_ucc_spa_Agent"" /></GroupBy><OrderBy><FieldRef Name=""wsp_ucc_Score"" /></OrderBy>" @("wsp_ucc_spa_skill", "Edit", "wsp_ucc_Score", "wsp_ucc_spa_Agent") -RemoveIfExists
	AddPnPView "SkillsPerAgent" "GroupBySkill" "GroupBySkill" 500 "<GroupBy><FieldRef Name=""wsp_ucc_spa_skill"" /></GroupBy><OrderBy><FieldRef Name=""wsp_ucc_spa_skill"" /></OrderBy>" @("wsp_ucc_spa_skill", "Edit", "wsp_ucc_Score", "wsp_ucc_spa_Agent") -RemoveIfExists
	# Supervisors
	AddPnPView "Supervisors" "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" /></OrderBy>' @("wsp_ucc_Supervisor", "Edit") -Default -RemoveIfExists
	# TrainerTrainee - REMOVED in MC1117115 modernization (list no longer exists)
	# AddPnPView "TrainerTrainee" "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" /></OrderBy>' @("wsp_ucc_tt_trainer", "Edit", "wsp_ucc_tt_trainee") -Default -RemoveIfExists
}
# Enable cascading delete relationship behaviour on lookup fields
# Enable restrict delete relationship behaviour on lookup fields
function SiteUpdate_6.0_16($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$field1 = GetPnPFieldWithListTitle "wsp_ucc_spa_skill" "SkillsPerAgent"
	$field2 = GetPnPFieldWithListTitle "wsp_ucc_spa_Agent" "SkillsPerAgent"
	# TrainerTrainee - REMOVED in MC1117115 modernization (list no longer exists)
	# $field3 = GetPnPFieldWithListTitle "wsp_ucc_tt_trainer" "TrainerTrainee"
	# $field4 = GetPnPFieldWithListTitle "wsp_ucc_tt_trainee" "TrainerTrainee"
	EnforceRelationshipBehavior @($field1, $field2)
	$field1 = GetPnPFieldWithListTitle "wsp_ucc_endpoints_ParentQuestion" "Endpoints"
	$field2 = GetPnPFieldWithListTitle "wsp_ucc_skill" "Endpoints"
	$field3 = GetPnPFieldWithListTitle "wsp_ucc_skills_escapeskill" "Skills"
	$field4 = GetPnPFieldWithListTitle "wsp_ucc_routing_parentquestion" "Routing"
	$field5 = GetPnPFieldWithListTitle "wsp_ucc_routing_skill" "Routing"
	$field6 = GetPnPFieldWithListTitle "wsp_ucc_routing_name" "Routing"
	$field7 = GetPnPFieldWithListTitle "wsp_ucc_ivr_AudioAnswer" "IVRQuestions"
	$field8 = GetPnPFieldWithListTitle "wsp_ucc_ivr_AudioQuestion" "IVRQuestions"
	$field9 = GetPnPFieldWithListTitle  "wsp_ucc_ivr_name" "IVRQuestions"
	$field10 = GetPnPFieldWithListTitle "wsp_ucc_ivr_Parent" "IVRQuestions"
	$field11 = GetPnPFieldWithListTitle "wsp_ucc_ivr_Skill" "IVRQuestions"
	$field12 = GetPnPFieldWithListTitle "wsp_ucc_idr_parent" "IDRQuestions"
	$field13 = GetPnPFieldWithListTitle "wsp_ucc_idr_skill" "IDRQuestions"
	$field14 = GetPnPFieldWithListTitle "wsp_ucc_pc_audiofile" "PromptsConfig"
	$field15 = GetPnPFieldWithListTitle "Happy" "PromptsConfig"
	$field16 = GetPnPFieldWithListTitle "Sad" "PromptsConfig"
	$field17 = GetPnPFieldWithListTitle "GoodByeAudio" "QualityMonitorConfig"
	$field18 = GetPnPFieldWithListTitle "WelcomeAudio" "QualityMonitorConfig"
	$field19 = GetPnPFieldWithListTitle "wsp_ucc_odc_prewelcomeaudiomessa" "OutboundDialerCalls"
	$field20 = GetPnPFieldWithListTitle "wsp_ucc_odc_skill" "OutboundDialerCalls"
	$field21 = GetPnPFieldWithListTitle "wsp_ucc_pl_audiofile" "Playlists"
	# Notifications - REMOVED in MC1117115 modernization (list no longer exists)
	# $field22 = GetPnPFieldWithListTitle "wsp_ucc_not_skill" "Notifications"
	$field23 = GetPnPFieldWithListTitle "wsp_ucc_pfs_parentquestion" "PluginFlowSettings"
	$field24 = GetPnPFieldWithListTitle "wsp_ucc_pfs_pluginattribute" "PluginFlowSettings"
	$field25 = GetPnPFieldWithListTitle "wsp_ucc_pfs_prompt" "PluginFlowSettings"
	$field26 = GetPnPFieldWithListTitle "wsp_ucc_pfs_skill" "PluginFlowSettings"
	$field27 = GetPnPFieldWithListTitle "wsp_ucc_ps_prompt" "PluginSettings"
	EnforceRelationshipBehavior @($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10,
								  $field11, $field12, $field13, $field14, $field15, $field16, $field17, $field18, $field19, $field20, 
								  $field21, $field23, $field24, $field25, $field26, $field27) "Restrict"
}
# List: OutboundDialerCalls
# Update list forms
function SiteUpdate_6.0_17($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	AddForms $updateSite.ServerRelativeUrl "OutboundDialerCalls" @("AutonomousDialerView") -RemoveIfExists
}
# List: settingsList 
# Add 'Plugin Attributes', 'Plugin Settings' and 'Plugin Flow Settings' links
# Fix 'Skills per agent' link title
# Fix 'IDR questions' link title
function SiteUpdate_6.0_18($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$lcid = $languageInfo[0]
	if ($lcid -eq 1031)
	{
		$listTitle = "settingsList"
		$language = $languageInfo[2]
		$importFile = "$RootPath\AnywhereNow\CSV\$language\settingsList.csv"
		$data = Import-Csv $importFile -Delimiter ";"
		foreach ($row in $data) 
		{
		    $rowTitle = $row.Title
			if ($rowTitle -eq "Plugin Attributes" -or $rowTitle -eq "Plugin Settings" -or $rowTitle -eq "Plugin Flow Settings")
			{
				$item = Get-PnPListItem -List $listTitle -Query "<View><Query><Where><Eq><FieldRef Name=""Title"" /><Value Type=""Text"">$rowTitle</Value></Eq></Where></Query></View>"
				if ($item -eq $null) 
				{
					AddPnPListItem $listTitle @{"Title" = $row.Title; "wsp_ucc_URL" = $row.wsp_ucc_URL; "wsp_ucc_HeaderTitle" = $row.wsp_ucc_HeaderTitle;
												"wsp_ucc_sort" = $row.wsp_ucc_sort; "wsp_ucc_visible" = $row.wsp_ucc_visible}
				}
			}
		}
		$item = Get-PnPListItem -List $listTitle -Query '<View><Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">Agents skills</Value></Eq></Where></Query></View>'
		if ($item -ne $null) 
		{
			SetPnPListItem $listTitle $item @{"Title" = "Skills per agent"}
		}
		$item = Get-PnPListItem -List $listTitle -Query '<View><Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">IDR</Value></Eq></Where></Query></View>'
		if ($item -ne $null) 
		{
			SetPnPListItem $listTitle $item @{"Title" = "IDR questions"}
		}
	}
}
# Update portal.aspx
# (ivrgfx.aspx removed)
function SiteUpdate_6.0_19($patchVersion)
{
	if ($patchCheck -ge $patchVersion -or $newSite -eq $true) 
	{
		return
	}
	UpdatePages $languageInfo[0] $updateSite @("portal.aspx")
}
# List: AudioFiles, CT: Document
# Enable content types
# Set 'Title' field required = false
function SiteUpdate_6.0_20($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$listTitle = "AudioFiles"
	$ctName = GetDocumentCTLocale $languageInfo[0]
	Set-PnPList -Identity $listTitle -EnableContentTypes $true | Out-Null
	SetContentTypeFieldRequired $listTitle $ctName "Title" $false
}
# List: IVRQuestions
# Add 'Callback' items
function SiteUpdate_6.0_21($patchVersion)
{
	if ($patchCheck -ge $patchVersion -or $newSite -eq $true) 
	{
		return
	}
	$listTitle = "IVRQuestions"
	$list = GetPnPList $listTitle -Includes
	$language = $languageInfo[2]
	$importFile = "$RootPath\AnywhereNow\CSV\$language\IVRQuestions.csv"
    $data = Import-Csv $importFile -Delimiter ";"
    foreach ($row in $data) 
	{
		$rowTitle = $row.Title
		if ($rowTitle -eq "Callback init pre number" -or $rowTitle -eq "Callback init post number" -or $rowTitle -eq "Callback init anonymous" -or $rowTitle -eq "Callback enter number" -or $rowTitle -eq "Callback verify pre number" -or $rowTitle -eq "Callback verify post number" -or $rowTitle -eq "Callback bye")
		{
			$item = Get-PnPListItem -List $listTitle -Query "<View><Query><Where><Eq><FieldRef Name=""Title"" /><Value Type=""Text"">$rowTitle</Value></Eq></Where></Query></View>"
			if ($item -eq $null)
			{
				$ct = $list.ContentTypes | Where { $_.Name -eq $row.ContentType }
				AddPnPListItem $listTitle @{"ContentTypeId" = $ct.Id; "Title" = $row.Title; "wsp_ucc_Question" = $row.wsp_ucc_Question; 
											"wsp_ucc_ivr_choice" = $row.wsp_ucc_ivr_choice; "wsp_ucc_Answer" = $row.wsp_ucc_Answer; "wsp_ucc_ivr_description" = $row.wsp_ucc_ivr_description;
											"wsp_ucc_ivr_order" = $row.wsp_ucc_ivr_order; "wsp_ucc_ivr_queue" = $row.wsp_ucc_ivr_queue; "wsp_ucc_ivr_Workflow" = $row.wsp_ucc_ivr_Workflow}
			}
		}
    }
}
# List: Version
# Fix views
function SiteUpdate_6.0_22($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	$listTitle = "Version"
	RemovePnPView $listTitle "All Items"
	AddPnPView $listTitle "AllItems" "AllItems" 30 '<OrderBy><FieldRef Name="ID" /></OrderBy>' @("LinkTitle") -Default -RemoveIfExists
}
# List: SettingValues, Settings
# Remove items (if any)
# Import new data
# Update 'ImTranslationAgentLanguage' setting key
# Update 'IMTranslationDefaultCustomerLanguage' setting key
# Update 'IMTranslationEnabled' setting key
function SiteUpdate_6.0_23($patchVersion)
{
	if ($patchCheck -ge $patchVersion) 
	{
		return
	}
	if ($newSite -eq $null)
	{
		#UpdateSettingValues Skip because of Update_6.1_05
	}
	$listTitle = "Settings"
	$updateItem = Get-PnPListItem -List $listTitle -Query '<View><Query><Where><Eq><FieldRef Name="wsp_ucc_Key" /><Value Type="Text">IMTranslationAgentLanguage</Value></Eq></Where></Query></View>'
	if ($updateItem -ne $null) 
	{
		SetPnPListItem $listTitle $updateItem @{"wsp_ucc_Key" = "ImTranslationAgentLanguage"}
	}
	$updateItem = Get-PnPListItem -List $listTitle -Query '<View><Query><Where><Eq><FieldRef Name="wsp_ucc_Key" /><Value Type="Text">IMTranslationDefaultCustomerLanguage</Value></Eq></Where></Query></View>'
	if ($updateItem -ne $null) 
	{
		SetPnPListItem $listTitle $updateItem @{"wsp_ucc_Key" = "ImTranslationDefaultCustomerLanguage"}
	}
	$updateItem = Get-PnPListItem -List $listTitle -Query '<View><Query><Where><Eq><FieldRef Name="wsp_ucc_Key" /><Value Type="Text">IMTranslationEnabled</Value></Eq></Where></Query></View>'
	if ($updateItem -ne $null) 
	{
		SetPnPListItem $listTitle $updateItem @{"wsp_ucc_Key" = "ImTranslationEnabled"}
	}
}
