Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
cac8138002
commit
9a8eeee7ab
@@ -243,13 +243,22 @@ const IMPORTERS: ImporterConfig[] = [
|
||||
delete r._clientext; delete r._clientname;
|
||||
delete r._assignedname; delete r._originatingname;
|
||||
if (!r.client_id) return null;
|
||||
const closedFlag = String(r._closedflag ?? "").toLowerCase();
|
||||
const closedFlag = String(r._closedflag ?? "").toLowerCase().trim();
|
||||
delete r._closedflag;
|
||||
const s = String(r.status ?? "").toLowerCase();
|
||||
const s = String(r.status ?? "").toLowerCase().trim();
|
||||
// Only set status when we have an explicit, unambiguous signal.
|
||||
// Otherwise leave status unset so upsert preserves existing value
|
||||
// (and new rows fall back to the column default of 'intake').
|
||||
if (closedFlag === "yes" || closedFlag === "true" || closedFlag === "1") {
|
||||
r.status = "closed";
|
||||
} else if (s === "closed" || s === "active" || s === "on_hold" || s === "intake") {
|
||||
r.status = s;
|
||||
} else if (s === "open") {
|
||||
r.status = "active";
|
||||
} else if (s === "on hold" || s === "hold") {
|
||||
r.status = "on_hold";
|
||||
} else {
|
||||
r.status = s.includes("close") ? "closed" : s.includes("hold") ? "on_hold" : s.includes("intake") ? "intake" : "active";
|
||||
delete r.status;
|
||||
}
|
||||
// Normalise billing method
|
||||
if (r.billing_method) {
|
||||
|
||||
Reference in New Issue
Block a user