Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.9.1</Version>
<Version>10.9.2</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Dynamicweb Provider</Title>
<Description>Dynamicweb Provider</Description>
Expand Down
58 changes: 8 additions & 50 deletions src/DynamicwebProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,7 @@
{
get { return connection ??= (SqlConnection)Database.CreateConnection(); }
set { connection = value; }
}

protected string defaultLanguage = null;
[AddInParameter("Default Language"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;"), AddInParameterGroup("Destination"), AddInParameterOrder(10)]
public string DefaultLanguage
{
get
{
if (defaultLanguage == null)
{
defaultLanguage = Ecommerce.Services.Languages.GetDefaultLanguageId();
}
return defaultLanguage;
}
set
{
defaultLanguage = value;
}
}
}

[AddInParameter("Shop"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;"), AddInParameterGroup("Destination"), AddInParameterOrder(20)]
public string Shop { get; set; }
Expand Down Expand Up @@ -225,9 +207,8 @@
xmlTextWriter.WriteElementString("DeleteIncomingItems", DeleteIncomingItems.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("SqlConnectionString", SqlConnectionString);
xmlTextWriter.WriteElementString("Shop", Shop);
xmlTextWriter.WriteElementString("DeleteProductsAndGroupForSpecificLanguage", DeleteProductsAndGroupForSpecificLanguage.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("DefaultLanguage", DefaultLanguage);
xmlTextWriter.WriteElementString("DeleteProductsAndGroupForSpecificLanguage", DeleteProductsAndGroupForSpecificLanguage.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("RepositoriesIndexUpdate", RepositoriesIndexUpdate);

Check warning on line 211 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
xmlTextWriter.WriteElementString("DiscardDuplicates", DiscardDuplicates.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("HideDeactivatedProducts", HideDeactivatedProducts.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("SkipFailingRows", SkipFailingRows.ToString(CultureInfo.CurrentCulture));
Expand Down Expand Up @@ -323,14 +304,11 @@
{
DeleteProductsAndGroupForSpecificLanguage = node.FirstChild.Value == "True";
}
break;
case "DefaultLanguage":
DefaultLanguage = node.HasChildNodes ? node.FirstChild.Value : "";
break;
break;
case "RepositoriesIndexUpdate":
if (node.HasChildNodes)
{
RepositoriesIndexUpdate = node.FirstChild.Value;

Check warning on line 311 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
break;
case "DiscardDuplicates":
Expand Down Expand Up @@ -368,8 +346,7 @@
DynamicwebProvider newProvider = (DynamicwebProvider)source;
Shop = newProvider.Shop;
UserKeyField = newProvider.UserKeyField;
DeactivateMissingProducts = newProvider.DeactivateMissingProducts;
DefaultLanguage = newProvider.DefaultLanguage;
DeactivateMissingProducts = newProvider.DeactivateMissingProducts;
UpdateOnlyExistingRecords = newProvider.UpdateOnlyExistingRecords;
InsertOnlyNewRecords = newProvider.InsertOnlyNewRecords;
HideDeactivatedProducts = newProvider.HideDeactivatedProducts;
Expand Down Expand Up @@ -470,6 +447,7 @@
bool deactivateMissingProducts = false;
try
{
string defaultLanguage = Ecommerce.Services.Languages.GetDefaultLanguageId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to be careful with this - with this solution, if no languageid columnmapping exists, we create a hidden one for the job. I don't believe this is the intended behaviour, we'll need to discuss this with Rasmus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the default languageId is needed in the mappings, so you can not import products without LanguageId, etc so for ages it worked like that, once there was no language id in the mapping it was auto added, a lot of existing jobs will fail if we remove that support, also the jobs @MatthiasSort is using for the BluePrints BC import may fail.
Usually ERP systems don't care what is the default language id in DW, so it is super incovenient to adjust manually the jobs

ReplaceMappingConditionalsWithValuesFromRequest(job);
if (Connection.State != ConnectionState.Open)
Connection.Open();
Expand Down Expand Up @@ -709,15 +687,15 @@

private void MoveRepositoriesIndexToJob(Job job)
{
if (!string.IsNullOrEmpty(RepositoriesIndexUpdate))

Check warning on line 690 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
{
char[] separator = [','];
// if the provider already have RepositoriesIndexUpdate set, then we move them to the job, and set the add-in to string.empty
if (job.RepositoriesIndexSettings?.RepositoriesIndexes?.Count == 0)
{
job.RepositoriesIndexSettings = new RepositoriesIndexSettings(new Collection<string>([.. RepositoriesIndexUpdate.Split(separator, StringSplitOptions.RemoveEmptyEntries)]));

Check warning on line 696 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
RepositoriesIndexUpdate = string.Empty;

Check warning on line 698 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
job.Save();
}
}
Expand Down Expand Up @@ -758,8 +736,7 @@
root.Add(CreateParameterNode(GetType(), "Remove missing rows after import in the destination tables only", RemoveMissingAfterImportDestinationTablesOnly.ToString()));
root.Add(CreateParameterNode(GetType(), "Delete incoming rows", DeleteIncomingItems.ToString()));
root.Add(CreateParameterNode(GetType(), "Shop", Shop));
root.Add(CreateParameterNode(GetType(), "Delete products/groups for languages included in input", DeleteProductsAndGroupForSpecificLanguage.ToString()));
root.Add(CreateParameterNode(GetType(), "Default Language", DefaultLanguage));
root.Add(CreateParameterNode(GetType(), "Delete products/groups for languages included in input", DeleteProductsAndGroupForSpecificLanguage.ToString()));
root.Add(CreateParameterNode(GetType(), "Discard duplicates", DiscardDuplicates.ToString()));
root.Add(CreateParameterNode(GetType(), "Hide deactivated products", HideDeactivatedProducts.ToString()));
root.Add(CreateParameterNode(GetType(), "Persist successful rows and skip failing rows", SkipFailingRows.ToString()));
Expand Down Expand Up @@ -851,22 +828,7 @@
{
options.Add(new("Full", "Full"));
options.Add(new("Partial", "Partial"));
}
else if (parameterName == "Default Language")
{
SqlCommand sqlLanguageCommand = new SqlCommand { Connection = Connection };
if (Connection.State == ConnectionState.Closed)
Connection.Open();

SqlDataAdapter languagesDataAdapter = new SqlDataAdapter("select LanguageID, LanguageCode2, LanguageName from EcomLanguages", sqlLanguageCommand.Connection);
new SqlCommandBuilder(languagesDataAdapter);
DataSet languageDataSet = new DataSet();
languagesDataAdapter.Fill(languageDataSet);
foreach (DataRow row in languageDataSet.Tables[0].Rows)
{
options.Add(new(row["LanguageName"].ToString(), row["LanguageID"]));
}
}
}
else
{
var accessuserTable = GetSchema().GetTables().Find(t => t.Name == "AccessUser");
Expand Down Expand Up @@ -895,11 +857,7 @@
{
var result = new List<string>();
switch (parameterName)
{
case "Default Language":
if (string.IsNullOrEmpty(defaultLanguage) || defaultLanguage.Equals(Ecommerce.Services.Languages.GetDefaultLanguageId(), StringComparison.OrdinalIgnoreCase))
result.Add("Default Language");
break;
{
case "Shop":
if (string.IsNullOrEmpty(Shop))
result.Add("Shop");
Expand Down
Loading