diff --git a/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj b/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj index 183dd214..54871113 100644 --- a/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj +++ b/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj @@ -1,6 +1,6 @@  - net6;netcoreapp3.1 + net8;netcoreapp3.1 false diff --git a/Intacct.SDK.Tests/Xml/RequestHandlerTest.cs b/Intacct.SDK.Tests/Xml/RequestHandlerTest.cs index 9194b850..fa43d6c0 100644 --- a/Intacct.SDK.Tests/Xml/RequestHandlerTest.cs +++ b/Intacct.SDK.Tests/Xml/RequestHandlerTest.cs @@ -396,7 +396,7 @@ public async Task MockDefaultNo524RetryTest() var ex = await Record.ExceptionAsync(() => requestHandler.ExecuteOnline(contentBlock)); Assert.IsType(ex); - Assert.Equal("Response status code does not indicate success: 524 ().", ex.Message); + Assert.Equal("Response status code does not indicate success: 524.", ex.Message); } [Fact(Skip="test randomly failing")] diff --git a/Intacct.SDK/Functions/AccountsPayable/ApPaymentCreate.cs b/Intacct.SDK/Functions/AccountsPayable/ApPaymentCreate.cs index e0ed52df..307def2c 100644 --- a/Intacct.SDK/Functions/AccountsPayable/ApPaymentCreate.cs +++ b/Intacct.SDK/Functions/AccountsPayable/ApPaymentCreate.cs @@ -13,6 +13,7 @@ * permissions and limitations under the License. */ +using System.Globalization; using Intacct.SDK.Xml; namespace Intacct.SDK.Functions.AccountsPayable diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDate.cs b/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDate.cs index 0432211b..1b57a720 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDate.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDate.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.EqualTo { public class EqualToDate : AbstractDate @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " = '" + Value.ToString(Format) + "'"; + clause = clause + Field + " = '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDateTime.cs b/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDateTime.cs index 5576d4ea..f802057c 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDateTime.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/EqualTo/EqualToDateTime.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.EqualTo { public class EqualToDateTime : AbstractDateTime @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " = '" + Value.ToString(Format) + "'"; + clause = clause + Field + " = '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDate.cs b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDate.cs index 7a1b6089..5b210986 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDate.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDate.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.GreaterThan { public class GreaterThanDate : AbstractDate @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " > '" + Value.ToString(Format) + "'"; + clause = clause + Field + " > '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDateTime.cs b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDateTime.cs index 15f46d1b..805f0e0c 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDateTime.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThan/GreaterThanDateTime.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.GreaterThan { public class GreaterThanDateTime : AbstractDateTime @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " > '" + Value.ToString(Format) + "'"; + clause = clause + Field + " > '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDate.cs b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDate.cs index 7e9d65ce..5d4c786e 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDate.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDate.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.GreaterThanOrEqualTo { public class GreaterThanOrEqualToDate : AbstractDate @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " >= '" + Value.ToString(Format) + "'"; + clause = clause + Field + " >= '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDateTime.cs b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDateTime.cs index 18ea52fa..58ca33fd 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDateTime.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/GreaterThanOrEqualTo/GreaterThanOrEqualToDateTime.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.GreaterThanOrEqualTo { public class GreaterThanOrEqualToDateTime : AbstractDateTime @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " >= '" + Value.ToString(Format) + "'"; + clause = clause + Field + " >= '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDate.cs b/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDate.cs index 0cde2b7b..bc0f5452 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDate.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDate.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.LessThan { public class LessThanDate : AbstractDate @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " < '" + Value.ToString(Format) + "'"; + clause = clause + Field + " < '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDateTime.cs b/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDateTime.cs index da46d5d8..928bbd37 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDateTime.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/LessThan/LessThanDateTime.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.LessThan { public class LessThanDateTime : AbstractDateTime @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " < '" + Value.ToString(Format) + "'"; + clause = clause + Field + " < '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDate.cs b/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDate.cs index 0cb6da9b..61c85e86 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDate.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDate.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.LessThanOrEqualTo { public class LessThanOrEqualToDate : AbstractDate @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " <= '" + Value.ToString(Format) + "'"; + clause = clause + Field + " <= '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDateTime.cs b/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDateTime.cs index 28620e9a..9134424b 100644 --- a/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDateTime.cs +++ b/Intacct.SDK/Functions/Common/Query/Comparison/LessThanOrEqualTo/LessThanOrEqualToDateTime.cs @@ -13,6 +13,8 @@ * permissions and limitations under the License. */ +using System.Globalization; + namespace Intacct.SDK.Functions.Common.Query.Comparison.LessThanOrEqualTo { public class LessThanOrEqualToDateTime : AbstractDateTime @@ -25,7 +27,7 @@ public override string ToString() clause = "NOT "; } - clause = clause + Field + " <= '" + Value.ToString(Format) + "'"; + clause = clause + Field + " <= '" + Value.ToString(Format, CultureInfo.InvariantCulture) + "'"; return clause; } diff --git a/Intacct.SDK/Functions/Projects/TimesheetUpdate.cs b/Intacct.SDK/Functions/Projects/TimesheetUpdate.cs new file mode 100644 index 00000000..3711c12b --- /dev/null +++ b/Intacct.SDK/Functions/Projects/TimesheetUpdate.cs @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Sage Intacct, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "LICENSE" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +using Intacct.SDK.Xml; + +namespace Intacct.SDK.Functions.Projects +{ + public class TimesheetUpdate : AbstractTimesheet + { + + public TimesheetUpdate(string controlId = null) : base(controlId) + { + } + + public override void WriteXml(ref IaXmlWriter xml) + { + xml.WriteStartElement("function"); + xml.WriteAttribute("controlid", ControlId, true); + + xml.WriteStartElement("update"); + xml.WriteStartElement("TIMESHEET"); + + xml.WriteElement("RECORDNO", RecordNo, true); + xml.WriteElement("EMPLOYEEID", EmployeeId, true); + xml.WriteElement("BEGINDATE", BeginDate, IaXmlWriter.IntacctDateFormat); + + xml.WriteElement("DESCRIPTION", Description); + xml.WriteElement("SUPDOCID", AttachmentsId); + xml.WriteElement("STATE", Action); + + xml.WriteStartElement("TIMESHEETENTRIES"); + if (Entries.Count > 0) + { + foreach (TimesheetEntryCreate entry in Entries) + { + entry.WriteXml(ref xml); + } + } + xml.WriteEndElement(); //TIMESHEETENTRIES + + xml.WriteCustomFieldsImplicit(CustomFields); + + xml.WriteEndElement(); //TIMESHEET + xml.WriteEndElement(); //update + + xml.WriteEndElement(); //function + } + + } +} \ No newline at end of file diff --git a/Intacct.SDK/Logging/MessageFormatter.cs b/Intacct.SDK/Logging/MessageFormatter.cs index 4e1ced98..bacc15dc 100644 --- a/Intacct.SDK/Logging/MessageFormatter.cs +++ b/Intacct.SDK/Logging/MessageFormatter.cs @@ -118,10 +118,10 @@ public string Format(HttpRequestMessage request, HttpResponseMessage response, E result = response.Content.Headers.ContentLength.ToString(); break; case "{req_body}": - result = request.Content.ToString(); + result = request.Content.ReadAsStringAsync().Result; break; case "{res_body}": - result = response != null ? response.Content.ToString() : "NULL"; + result = response != null ? response.Content.ReadAsStringAsync().Result : "NULL"; break; case "{ts}": case "{date_iso_8601}": diff --git a/Intacct.SDK/Xml/IaXmlWriter.cs b/Intacct.SDK/Xml/IaXmlWriter.cs index 4dcb39a6..627d7a43 100644 --- a/Intacct.SDK/Xml/IaXmlWriter.cs +++ b/Intacct.SDK/Xml/IaXmlWriter.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Text; using System.Xml; @@ -260,7 +261,7 @@ public void WriteElement(string localName, bool? value, bool writeNull = false) public void WriteElement(string localName, DateTime value, string format = IntacctDateTimeFormat) { - _writer.WriteElementString(localName, value == default(DateTime) ? "" : value.ToString(format)); + _writer.WriteElementString(localName, value == default(DateTime) ? "" : value.ToString(format, CultureInfo.InvariantCulture)); } public void WriteElement(string localName, DateTime? value, string format = IntacctDateTimeFormat, bool writeNull = false) @@ -274,7 +275,7 @@ public void WriteElement(string localName, DateTime? value, string format = Inta } else { - _writer.WriteElementString(localName, value == default(DateTime) ? "" : value.Value.ToString(format)); + _writer.WriteElementString(localName, value == default(DateTime) ? "" : value.Value.ToString(format, CultureInfo.InvariantCulture)); } }