This commit is contained in:
2022-07-12 18:07:44 +00:00
parent f6d9910bcf
commit f7e4226e66
3 changed files with 32 additions and 8 deletions

View File

@@ -741,6 +741,19 @@ namespace AyaNovaQBI
hasError = true;
initErrors.AppendLine($"Work order Status \"{AccountingStatus.Name}\" must be set to Active=true");
}
if (AccountingStatus.Locked)
{
hasError = true;
initErrors.AppendLine($"Work order Status \"{AccountingStatus.Name}\" must *not* be a locking status");
}
if (AccountingStatus.Completed)
{
hasError = true;
initErrors.AppendLine($"Work order Status \"{AccountingStatus.Name}\" must *not* be a completed status");
}
return !hasError;
}
@@ -1820,21 +1833,21 @@ namespace AyaNovaQBI
/// Given a QB Item ID, return the
/// AyaNova Vendor ID linked to that items
/// QB preferred Vendor ID or
/// 0 on any problem or not found
/// null on any problem or not found
/// </summary>
/// <param name="QBItemID"></param>
/// <returns></returns>
public static long AyaVendorForQBItem(string QBItemID)
public static long? AyaVendorForQBItem(string QBItemID)
{
if (string.IsNullOrWhiteSpace(QBItemID)) return 0;
if (string.IsNullOrWhiteSpace(QBItemID)) return null;
DataRow dr = _dtQBItems.Rows.Find(QBItemID);
if (dr == null || dr["VendorID"] == null || dr["VendorID"].ToString() == "") return 0;
if (dr == null || dr["VendorID"] == null || dr["VendorID"].ToString() == "") return null;
DataRow drVendor = _dtQBVendors.Rows.Find(dr["VendorID"].ToString());
if (drVendor == null) return 0;
if (drVendor == null) return null;
var item = QBIntegration.Items.FirstOrDefault(z => z.IntegrationItemId == drVendor["ID"].ToString());
if (item == null) return 0;
if (item == null) return null;
//Ok we have a matching vendor in the list, return the id of it
return item.ObjectId;