From 3e4a47fd480d52d74a880d228fdd03c29d3bf452 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 20 Jan 2023 01:28:14 +0000 Subject: [PATCH] --- server/DataList/PurchaseDataList.cs | 10 +++++----- server/biz/FormFieldReference.cs | 2 +- server/biz/GlobalBizSettingsBiz.cs | 3 ++- server/models/Purchase.cs | 2 +- server/util/AySchema.cs | 10 +++++----- todo.txt | 4 +--- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/server/DataList/PurchaseDataList.cs b/server/DataList/PurchaseDataList.cs index 824f20e..575e906 100644 --- a/server/DataList/PurchaseDataList.cs +++ b/server/DataList/PurchaseDataList.cs @@ -14,7 +14,7 @@ namespace Sockeye.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - DefaultColumns = new List() { "PurchaseDate", "PurchaseSalesOrderNumber", "Customer", "Product", "PurchaseProcessedDate" }; + DefaultColumns = new List() { "PurchaseDate", "PurchaseSalesOrderNumber", "Customer", "Product", "PurchaseProcessed" }; DefaultSortBy = new Dictionary() { { "PurchaseDate", "-" } }; FieldDefinitions = new List(); @@ -120,10 +120,10 @@ namespace Sockeye.DataList FieldDefinitions.Add(new DataListFieldDefinition { - TKey = "PurchaseProcessedDate", - FieldKey = "PurchaseProcessedDate", - UiFieldDataType = (int)UiFieldDataType.DateTime, - SqlValueColumnName = "apurchase.processeddate" + TKey = "PurchaseProcessed", + FieldKey = "PurchaseProcessed", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "apurchase.processed" }); diff --git a/server/biz/FormFieldReference.cs b/server/biz/FormFieldReference.cs index 3678d16..6a93c30 100644 --- a/server/biz/FormFieldReference.cs +++ b/server/biz/FormFieldReference.cs @@ -380,7 +380,7 @@ namespace Sockeye.Biz l.Add(new FormField { TKey = "PurchaseCouponCode", FieldKey = "PurchaseCouponCode" }); l.Add(new FormField { TKey = "PurchaseNotes", FieldKey = "PurchaseNotes" }); l.Add(new FormField { TKey = "PurchaseVendorData", FieldKey = "PurchaseVendorData" }); - l.Add(new FormField { TKey = "PurchaseProcessedDate", FieldKey = "PurchaseProcessedDate" }); + l.Add(new FormField { TKey = "PurchaseProcessed", FieldKey = "PurchaseProcessed" }); l.Add(new FormField { TKey = "Tags", FieldKey = "Tags" }); l.Add(new FormField { TKey = "Wiki", FieldKey = "Wiki" }); diff --git a/server/biz/GlobalBizSettingsBiz.cs b/server/biz/GlobalBizSettingsBiz.cs index 7463bf2..53b05a5 100644 --- a/server/biz/GlobalBizSettingsBiz.cs +++ b/server/biz/GlobalBizSettingsBiz.cs @@ -285,7 +285,8 @@ namespace Sockeye.Biz s.CouponCode = jPurchase["couponCode"].Value(); s.ExpireDate = DateUtil.EpochToDateNullIsNull(jPurchase["expireDate"].Value()); s.Name = p.Name; - s.ProcessedDate = s.PurchaseDate = DateUtil.EpochToDateNullIsMin(jPurchase["purchaseDate"].Value()); + s.Processed = true; + s.PurchaseDate = DateUtil.EpochToDateNullIsMin(jPurchase["purchaseDate"].Value()); s.Quantity = jPurchase["quantity"].Value(); s.RenewNoticeSent = jPurchase["renewNoticeSent"].Value(); s.SalesOrderNumber = jPurchase["salesOrderNumber"].Value(); diff --git a/server/models/Purchase.cs b/server/models/Purchase.cs index e116f68..bb96a3d 100644 --- a/server/models/Purchase.cs +++ b/server/models/Purchase.cs @@ -33,7 +33,7 @@ namespace Sockeye.Models public bool RenewNoticeSent { get; set; } = false; public int Quantity { get; set; } = 1; public string VendorData { get; set; } - public DateTime? ProcessedDate { get; set; } + public bool Processed { get; set; } = false;//indicates it was processed, false means it should be processed public string Wiki { get; set; } public List Tags { get; set; } //workaround for notification diff --git a/server/util/AySchema.cs b/server/util/AySchema.cs index 9cfc3f8..a906201 100644 --- a/server/util/AySchema.cs +++ b/server/util/AySchema.cs @@ -902,7 +902,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "vendorid BIGINT NOT NULL REFERENCES avendor(id), productid BIGINT REFERENCES aproduct(id), pgroup INTEGER NOT NULL DEFAULT 4, salesordernumber TEXT NOT NULL, " + "purchasedate TIMESTAMPTZ NOT NULL, expiredate TIMESTAMPTZ, canceldate TIMESTAMPTZ, couponcode text, notes text, " + "renewnoticesent BOOL NOT NULL DEFAULT false, quantity INTEGER NOT NULL DEFAULT 1, " - + "vendordata TEXT, processeddate TIMESTAMPTZ, " + + "vendordata TEXT, processed BOOL NOT NULL DEFAULT false, " + "wiki TEXT, tags VARCHAR(255) ARRAY )"); @@ -1206,7 +1206,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseRenewNoticeSent', 'Renew notice sent' FROM atranslation t where t.baselanguage = 'en'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseQuantity', 'Quantity' FROM atranslation t where t.baselanguage = 'en'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseVendorData', 'Vendor data' FROM atranslation t where t.baselanguage = 'en'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessedDate', 'Processed' FROM atranslation t where t.baselanguage = 'en'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessed', 'Processed' FROM atranslation t where t.baselanguage = 'en'"); //spanish translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Purchase', 'Purchase' FROM atranslation t where t.baselanguage = 'es'"); @@ -1220,7 +1220,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseRenewNoticeSent', 'Renew notice sent' FROM atranslation t where t.baselanguage = 'es'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseQuantity', 'Quantity' FROM atranslation t where t.baselanguage = 'es'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseVendorData', 'Vendor data' FROM atranslation t where t.baselanguage = 'es'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessedDate', 'Processed' FROM atranslation t where t.baselanguage = 'es'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessed', 'Processed' FROM atranslation t where t.baselanguage = 'es'"); //french translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Purchase', 'Purchase' FROM atranslation t where t.baselanguage = 'fr'"); @@ -1234,7 +1234,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseRenewNoticeSent', 'Renew notice sent' FROM atranslation t where t.baselanguage = 'fr'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseQuantity', 'Quantity' FROM atranslation t where t.baselanguage = 'fr'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseVendorData', 'Vendor data' FROM atranslation t where t.baselanguage = 'fr'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessedDate', 'Processed' FROM atranslation t where t.baselanguage = 'fr'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessed', 'Processed' FROM atranslation t where t.baselanguage = 'fr'"); //german translations @@ -1249,7 +1249,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseRenewNoticeSent', 'Renew notice sent' FROM atranslation t where t.baselanguage = 'de'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseQuantity', 'Quantity' FROM atranslation t where t.baselanguage = 'de'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseVendorData', 'Vendor data' FROM atranslation t where t.baselanguage = 'de'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessedDate', 'Processed' FROM atranslation t where t.baselanguage = 'de'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'PurchaseProcessed', 'Processed' FROM atranslation t where t.baselanguage = 'de'"); #endregion purchase diff --git a/todo.txt b/todo.txt index 9c19ec3..ff1fce7 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,6 @@ TODO: -- JOB: notify user active license saved - this should go out immediately on save once when state is changed from inactive to active - can manually re-send by toggling active + - JOB: Process purchases that are from vendor notification - create customer if necessary from purchase notification or add to existing - if v7 needs to account for there being a delay sometimes in order completeness