Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(contacts, users): contacts can share an email, deleted customers take their contacts, and pending invites can be resent (#2059)

Sidf922057bbc8c
diff --git a/.claude/rules/customer-supplier-database-schema.md b/.claude/rules/customer-supplier-database-schema.md
index 306a19b35e..cd7e1aaf02 100644
--- a/.claude/rules/customer-supplier-database-schema.md
+++ b/.claude/rules/customer-supplier-database-schema.md
@@ -42,11 +42,12 @@ Key columns (both, unless noted):
`id` (default `xid()`), `firstName`, `lastName`, `fullName` (GENERATED `firstName || ' ' || lastName` STORED), `email` (**nullable** since `20251224160904`), `title`, `mobilePhone`, `homePhone`, `workPhone`, `fax`, `notes`, `isCustomer` BOOLEAN NOT NULL DEFAULT TRUE, `companyId`.
- `isCustomer` distinguishes a contact as customer-side (`true`) vs supplier-side (`false`); set at insert time.
- Contact has **no address fields** — `addressLine1/city/state/postalCode/countryCode/birthday` were dropped (`20240813152858`). Addresses live in the `address` table.
-- Email is **not** uniquely constrained anymore (the partial unique index was dropped in `20260112120041`).
+- Email is **not** uniquely constrained. `20260112120041` meant to drop the partial unique index but named it unquoted, so Postgres lower-cased the name and `IF EXISTS` dropped nothing; `20261027162653` drops it for real.
+- A contact lives through its `customerContact` / `supplierContact` rows. Usually there is one, but Paperless Parts reuses a contact found by email and links it to more customers. When the LAST link goes (deleted directly, by cascade when its customer or supplier is deleted, or moved to another contact by an UPDATE), the `sync_delete_unlinked_contact` after-interceptor on both link tables deletes the contact. It locks the contact before checking for other links, so a concurrent re-link survives, and it does nothing under `app.sync_in_progress` (dataset wipes and restores manage contacts themselves). Before it, a deleted customer left its contacts behind, invisible in the app.
### `customerContact` / `supplierContact` (join: entity ↔ contact)
`id` (default `xid()`), `customerId`/`supplierId` → entity (ON DELETE CASCADE), `contactId` → `contact` (CASCADE), `customerLocationId`/`supplierLocationId` → location (nullable, SET NULL), `userId` → `user` (nullable), `tags`, `customFields`.
-- Code creates a `contact` row first, then the join row (see `insertCustomerContact` in `apps/erp/app/modules/sales/sales.service.ts`, and the supplier equivalent in `purchasing.service.ts`).
+- `insertCustomerContact` (`sales.service.ts`) and `insertSupplierContact` (`purchasing.service.ts`) write the `contact` row and its link in ONE Kysely transaction, after checking the customer or supplier and the location belong to the company. Two separate writes left an orphaned contact whenever the link insert failed.
### `customerLocation` / `supplierLocation` (join: entity ↔ address)
`id` (default `xid()`), `customerId`/`supplierId` (CASCADE), `addressId` → `address` (CASCADE), `name` TEXT NOT NULL (`20240813213122`), `tags`, `supplierLocation.externalId` JSONB, `customFields`.
diff --git a/apps/erp/app/modules/purchasing/purchasing.server.ts b/apps/erp/app/modules/purchasing/purchasing.server.ts
index 27386fc681..bf3fb44d5f 100644
--- a/apps/erp/app/modules/purchasing/purchasing.server.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.server.ts
@@ -4913,7 +4913,7 @@ export const insertSupplierContact = defineServiceFn({
return unwrap(
ctx,
await service.insertSupplierContact(
- ctx.asCaller.supabase,
+ ctx.asSystem.pg,
payload(ctx, input).forUpsert() as never
)
);
diff --git a/apps/erp/app/modules/purchasing/purchasing.service.ts b/apps/erp/app/modules/purchasing/purchasing.service.ts
index 52fe9cdc97..8f20b69e04 100644
--- a/apps/erp/app/modules/purchasing/purchasing.service.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.service.ts
@@ -23,12 +23,18 @@ import {
getCompanyTimeZone
} from "@carbon/database";
import { isBeforeCutover } from "@carbon/database/accounting-cutover-dates";
-import type { Kysely, KyselyDatabase, KyselyTx } from "@carbon/database/client";
+import {
+ type Kysely,
+ type KyselyDatabase,
+ type KyselyTx,
+ withTransaction
+} from "@carbon/database/client";
import {
type AutomaticJournalStatus,
journalPostingStatus,
readAccountingCutoverDate
} from "@carbon/database/journal-posting-status";
+import { toJson } from "@carbon/database/json";
import type { AccountClass } from "@carbon/database/ledger";
import { toStoredAmount } from "@carbon/database/ledger";
import { assertBalanced, equals } from "@carbon/database/precision";
@@ -127,7 +133,7 @@ import { getUser } from "~/modules/users/users.service";
import { path } from "~/utils/path";
import type { GenericQueryFilters, Paging } from "~/utils/query";
import { listCount, setGenericQueryFilters } from "~/utils/query";
-import { sanitize } from "~/utils/supabase";
+import { ruleError, sanitize } from "~/utils/supabase";
import {
getCurrencyByCode,
getExchangeRate
@@ -1302,7 +1308,7 @@ export async function insertSupplier(
}
export async function insertSupplierContact(
- client: SupabaseClient<Database>,
+ db: Kysely<KyselyDatabase>,
supplierContact: {
supplierId: string;
companyId: string;
@@ -1311,40 +1317,69 @@ export async function insertSupplierContact(
customFields?: Json;
}
) {
- const insertContact = await client
- .from("contact")
- .insert([
- {
- ...supplierContact.contact,
- companyId: supplierContact.companyId,
- isCustomer: false
+ const { supplierId, companyId, supplierLocationId, contact } =
+ supplierContact;
+ try {
+ // One transaction: a contact with no supplier link is invisible in the app.
+ const id = await withTransaction(db, async (trx) => {
+ const owner = await trx
+ .selectFrom("supplier")
+ .select("id")
+ .where("id", "=", supplierId)
+ .where("companyId", "=", companyId)
+ .executeTakeFirst();
+ if (!owner) return "Supplier not found";
+ if (supplierLocationId) {
+ const location = await trx
+ .selectFrom("supplierLocation")
+ .select("id")
+ .where("id", "=", supplierLocationId)
+ .where("supplierId", "=", supplierId)
+ .executeTakeFirst();
+ if (!location) return "Location not found";
}
- ])
- .select("id")
- .single();
- if (insertContact.error) {
- return insertContact;
- }
+ const inserted = await trx
+ .insertInto("contact")
+ .values({
+ companyId,
+ isCustomer: false,
+ firstName: contact.firstName,
+ lastName: contact.lastName,
+ title: contact.title,
+ email: contact.email,
+ mobilePhone: contact.mobilePhone,
+ homePhone: contact.homePhone,
+ workPhone: contact.workPhone,
+ notes: contact.notes
+ })
+ .returning("id")
+ .executeTakeFirstOrThrow();
- const contactId = insertContact.data?.id;
- if (!contactId) {
- return { data: null, error: new Error("Contact ID not found") };
+ const link = await trx
+ .insertInto("supplierContact")
+ .values({
+ supplierId,
+ contactId: inserted.id,
+ supplierLocationId,
+ companyId,
+ customFields: toJson(supplierContact.customFields)
+ })
+ .returning("id")
+ .executeTakeFirstOrThrow();
+ return { id: link.id };
+ });
+ return typeof id === "string"
+ ? { data: null, error: ruleError(id) }
+ : { data: id, error: null };
+ } catch (error) {
+ logger.error("Failed to create supplier contact", {
+ companyId,
+ supplierId,
+ error
+ });
+ return { data: null, error: error as Error };
}
-
- return client
- .from("supplierContact")
- .insert([
- {
- supplierId: supplierContact.supplierId,
- contactId,
- supplierLocationId: supplierContact.supplierLocationId,
- companyId: supplierContact.companyId,
- customFields: supplierContact.customFields
- }
- ])
- .select("id")
- .single();
}
export async function insertSupplierInteraction(
diff --git a/apps/erp/app/modules/sales/sales.server.ts b/apps/erp/app/modules/sales/sales.server.ts
index ea5254201f..7167dc0d5e 100644
--- a/apps/erp/app/modules/sales/sales.server.ts
+++ b/apps/erp/app/modules/sales/sales.server.ts
@@ -6864,7 +6864,7 @@ export const insertCustomerContact = defineServiceFn({
return unwrap(
ctx,
await service.insertCustomerContact(
- ctx.asCaller.supabase,
+ ctx.asSystem.pg,
payload(ctx, input).forUpsert() as never
)
);
diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.ts
index ed3ba39f67..eece508ae8 100644
--- a/apps/erp/app/modules/sales/sales.service.ts
+++ b/apps/erp/app/modules/sales/sales.service.ts
@@ -14,7 +14,12 @@ import { getUserClaims } from "@carbon/auth/users.server";
import type { Database, Json } from "@carbon/database";
import { fetchAllFromTable, getCompanyTimeZone } from "@carbon/database";
import { toBaseAmount } from "@carbon/database/accounting-currency";
-import type { Kysely, KyselyDatabase, KyselyTx } from "@carbon/database/client";
+import {
+ type Kysely,
+ type KyselyDatabase,
+ type KyselyTx,
+ withTransaction
+} from "@carbon/database/client";
import {
applyContractMovement,
EMPTY_POSITION
@@ -155,7 +160,7 @@ import { getUser } from "~/modules/users/users.service";
import { path } from "~/utils/path";
import type { GenericQueryFilters, Paging } from "~/utils/query";
import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";
-import { sanitize } from "~/utils/supabase";
+import { ruleError, sanitize } from "~/utils/supabase";
import {
getCurrencyByCode,
getExchangeRate
@@ -2131,7 +2136,7 @@ export async function getSalesRFQLines(
}
export async function insertCustomerContact(
- client: SupabaseClient<Database>,
+ db: Kysely<KyselyDatabase>,
customerContact: {
customerId: string;
companyId: string;
@@ -2140,39 +2145,69 @@ export async function insertCustomerContact(
customFields?: Json;
}
) {
- const insertContact = await client
- .from("contact")
- .insert([
- {
- ...customerContact.contact,
- isCustomer: true,
- companyId: customerContact.companyId
+ const { customerId, companyId, customerLocationId, contact } =
+ customerContact;
+ try {
+ // One transaction: a contact with no customer link is invisible in the app.
+ const id = await withTransaction(db, async (trx) => {
+ const owner = await trx
+ .selectFrom("customer")
+ .select("id")
+ .where("id", "=", customerId)
+ .where("companyId", "=", companyId)
+ .executeTakeFirst();
+ if (!owner) return "Customer not found";
+ if (customerLocationId) {
+ const location = await trx
+ .selectFrom("customerLocation")
+ .select("id")
+ .where("id", "=", customerLocationId)
+ .where("customerId", "=", customerId)
+ .executeTakeFirst();
+ if (!location) return "Location not found";
}
- ])
- .select("id")
- .single();
- if (insertContact.error) {
- return insertContact;
- }
- const contactId = insertContact.data?.id;
- if (!contactId) {
- return { data: null, error: new Error("Contact ID not found") };
- }
+ const inserted = await trx
+ .insertInto("contact")
+ .values({
+ companyId,
+ isCustomer: true,
+ firstName: contact.firstName,
+ lastName: contact.lastName,
+ title: contact.title,
+ email: contact.email,
+ mobilePhone: contact.mobilePhone,
+ homePhone: contact.homePhone,
+ workPhone: contact.workPhone,
+ notes: contact.notes
+ })
+ .returning("id")
+ .executeTakeFirstOrThrow();
- return client
- .from("customerContact")
- .insert([
- {
- customerId: customerContact.customerId,
- contactId,
- customerLocationId: customerContact.customerLocationId,
- companyId: customerContact.companyId,
- customFields: customerContact.customFields
- }
- ])
- .select("id")
- .single();
+ const link = await trx
+ .insertInto("customerContact")
+ .values({
+ customerId,
+ contactId: inserted.id,
+ customerLocationId,
+ companyId,
+ customFields: toJson(customerContact.customFields)
+ })
+ .returning("id")
+ .executeTakeFirstOrThrow();
+ return { id: link.id };
+ });
+ return typeof id === "string"
+ ? { data: null, error: ruleError(id) }
+ : { data: id, error: null };
+ } catch (error) {
+ logger.error("Failed to create customer contact", {
+ companyId,
+ customerId,
+ error
+ });
+ return { data: null, error: error as Error };
+ }
}
export async function insertCustomerLocation(
diff --git a/apps/erp/app/modules/users/ui/Customers/CustomerAccountsTable.tsx b/apps/erp/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
index 06461303f8..d56191d3f9 100644
--- a/apps/erp/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
+++ b/apps/erp/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
@@ -286,29 +286,35 @@ const CustomerAccountsTable = memo(
<MenuIcon icon={<LuBan />} />
<Trans>Deactivate Account</Trans>
</MenuItem>
- ) : hasUnrevokedInvite ? (
- permissions.can("delete", "users") && (
+ ) : (
+ <>
<MenuItem
+ disabled={!permissions.can("create", "users")}
onClick={() => {
setSelectedUserIds([row.user.id]);
- revokeInviteModal.onOpen();
+ resendInviteModal.onOpen();
}}
- destructive
>
- <MenuIcon icon={<LuBan />} />
- <Trans>Revoke Invite</Trans>
+ <MenuIcon icon={<LuMailCheck />} />
+ {hasUnrevokedInvite ? (
+ <Trans>Resend Invite</Trans>
+ ) : (
+ <Trans>Send Invite</Trans>
+ )}
</MenuItem>
- )
- ) : (
- <MenuItem
- onClick={() => {
- setSelectedUserIds([row.user.id]);
- resendInviteModal.onOpen();
- }}
- >
- <MenuIcon icon={<LuMailCheck />} />
- <Trans>Send Invite</Trans>
- </MenuItem>
+ {hasUnrevokedInvite && permissions.can("delete", "users") && (
+ <MenuItem
+ onClick={() => {
+ setSelectedUserIds([row.user.id]);
+ revokeInviteModal.onOpen();
+ }}
+ destructive
+ >
+ <MenuIcon icon={<LuBan />} />
+ <Trans>Revoke Invite</Trans>
+ </MenuItem>
+ )}
+ </>
)}
</>
);
diff --git a/apps/erp/app/modules/users/ui/Employees/EmployeesTable.tsx b/apps/erp/app/modules/users/ui/Employees/EmployeesTable.tsx
index d9f03bc678..2410e5055e 100644
--- a/apps/erp/app/modules/users/ui/Employees/EmployeesTable.tsx
+++ b/apps/erp/app/modules/users/ui/Employees/EmployeesTable.tsx
@@ -423,29 +423,35 @@ const EmployeesTable = memo(
</MenuItem>
)}
</>
- ) : hasUnrevokedInvite ? (
- permissions.can("delete", "users") && (
+ ) : (
+ <>
<MenuItem
+ disabled={!permissions.can("create", "users")}
onClick={() => {
setSelectedUserIds([row.id!]);
- revokeInviteModal.onOpen();
+ resendInviteModal.onOpen();
}}
- destructive
>
- <MenuIcon icon={<LuBan />} />
- <Trans>Revoke Invite</Trans>
+ <MenuIcon icon={<LuMailCheck />} />
+ {hasUnrevokedInvite ? (
+ <Trans>Resend Invite</Trans>
+ ) : (
+ <Trans>Send Invite</Trans>
+ )}
</MenuItem>
- )
- ) : (
- <MenuItem
- onClick={() => {
- setSelectedUserIds([row.id!]);
- resendInviteModal.onOpen();
- }}
- >
- <MenuIcon icon={<LuMailCheck />} />
- <Trans>Send Invite</Trans>
- </MenuItem>
+ {hasUnrevokedInvite && permissions.can("delete", "users") && (
+ <MenuItem
+ onClick={() => {
+ setSelectedUserIds([row.id!]);
+ revokeInviteModal.onOpen();
+ }}
+ destructive
+ >
+ <MenuIcon icon={<LuBan />} />
+ <Trans>Revoke Invite</Trans>
+ </MenuItem>
+ )}
+ </>
)}
</>
);
diff --git a/apps/erp/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx b/apps/erp/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx
index 30a107888d..a0a59b4959 100644
--- a/apps/erp/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx
+++ b/apps/erp/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx
@@ -283,29 +283,35 @@ const SupplierAccountsTable = memo(
<MenuIcon icon={<LuBan />} />
<Trans>Deactivate Account</Trans>
</MenuItem>
- ) : hasUnrevokedInvite ? (
- permissions.can("delete", "users") && (
+ ) : (
+ <>
<MenuItem
+ disabled={!permissions.can("create", "users")}
onClick={() => {
setSelectedUserIds([row.user.id]);
- revokeInviteModal.onOpen();
+ resendInviteModal.onOpen();
}}
- destructive
>
- <MenuIcon icon={<LuBan />} />
- <Trans>Revoke Invite</Trans>
+ <MenuIcon icon={<LuMailCheck />} />
+ {hasUnrevokedInvite ? (
+ <Trans>Resend Invite</Trans>
+ ) : (
+ <Trans>Send Invite</Trans>
+ )}
</MenuItem>
- )
- ) : (
- <MenuItem
- onClick={() => {
- setSelectedUserIds([row.user.id]);
- resendInviteModal.onOpen();
- }}
- >
- <MenuIcon icon={<LuMailCheck />} />
- <Trans>Send Invite</Trans>
- </MenuItem>
+ {hasUnrevokedInvite && permissions.can("delete", "users") && (
+ <MenuItem
+ onClick={() => {
+ setSelectedUserIds([row.user.id]);
+ revokeInviteModal.onOpen();
+ }}
+ destructive
+ >
+ <MenuIcon icon={<LuBan />} />
+ <Trans>Revoke Invite</Trans>
+ </MenuItem>
+ )}
+ </>
)}
</>
);
diff --git a/apps/erp/app/modules/users/ui/components/ResendInviteModal.tsx b/apps/erp/app/modules/users/ui/components/ResendInviteModal.tsx
index 9bcc180de8..4b2b9a3b41 100644
--- a/apps/erp/app/modules/users/ui/components/ResendInviteModal.tsx
+++ b/apps/erp/app/modules/users/ui/components/ResendInviteModal.tsx
@@ -93,6 +93,11 @@ const ResendInviteModal = ({
</Trans>
)}
</p>
+ <p className="text-sm text-muted-foreground mb-2">
+ <Trans>
+ A new invite link is sent. A link sent before stops working.
+ </Trans>
+ </p>
{allMatching ? (
<AllMatchingUsersNote />
) : (
diff --git a/apps/erp/app/routes/x+/customer+/$customerId.contacts.new.tsx b/apps/erp/app/routes/x+/customer+/$customerId.contacts.new.tsx
index 0fa9b189d1..c0fec65ee1 100644
--- a/apps/erp/app/routes/x+/customer+/$customerId.contacts.new.tsx
+++ b/apps/erp/app/routes/x+/customer+/$customerId.contacts.new.tsx
@@ -7,13 +7,14 @@ import { requirePermissions } from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
-import { isUniqueViolation, redirect } from "@carbon/utils";
+import { redirect } from "@carbon/utils";
import type { ActionFunctionArgs } from "react-router";
import { data, useNavigate, useParams } from "react-router";
import { customerContactValidator } from "~/modules/sales/sales.models";
import { insertCustomerContact } from "~/modules/sales/sales.service";
import { CustomerContactForm } from "~/modules/sales/ui/Customer";
import { requireCompanyRecord } from "~/modules/shared/shared.service";
+import { getDatabaseClient } from "~/services/database.server";
import { setCustomFields } from "~/utils/form";
import { path } from "~/utils/path";
@@ -23,7 +24,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
create: "sales"
});
- // RLS doesn't work for selecting a contact with no customer
const client = getCarbonServiceRole();
const { customerId } = params;
@@ -55,60 +55,36 @@ export async function action({ request, params }: ActionFunctionArgs) {
: null
]);
- const createCustomerContact = await insertCustomerContact(client, {
- customerId,
- companyId,
- contact,
- customerLocationId,
- customFields: setCustomFields(formData)
- });
- if (createCustomerContact.error) {
- let errorMessage = "Failed to create customer contact";
- if (isUniqueViolation(createCustomerContact.error)) {
- const contact = await client
- .from("contact")
- .select("id")
- .eq("email", validation.data.email)
- .eq("companyId", companyId)
- .single();
- if (contact.data) {
- const customerContact = await client
- .from("customerContact")
- .select("customerId")
- .eq("contactId", contact.data.id)
- .single();
- if (customerContact.data) {
- const customer = await client
- .from("customer")
- .select("name")
- .eq("id", customerContact.data.customerId)
- .single();
- errorMessage = `Contact ${validation.data.email} already exists for ${customer.data?.name}`;
- } else {
- const supplierContact = await client
- .from("supplierContact")
- .select("supplierId")
- .eq("contactId", contact.data.id)
- .single();
- if (supplierContact.data) {
- const supplier = await client
- .from("supplier")
- .select("name")
- .eq("id", supplierContact.data.supplierId)
- .single();
- errorMessage = `Contact ${validation.data.email} already exists for ${supplier.data?.name}`;
- }
- }
- }
+ const createCustomerContact = await insertCustomerContact(
+ getDatabaseClient(),
+ {
+ customerId,
+ companyId,
+ contact,
+ customerLocationId,
+ customFields: setCustomFields(formData)
}
-
+ );
+ if (createCustomerContact.error) {
return modal
- ? data(error(createCustomerContact.error, errorMessage), {
- status: 400
- })
+ ? data(
+ error(
+ createCustomerContact.error,
+ "Failed to create customer contact"
+ ),
+ {
+ status: 400
+ }
+ )
: redirect(
path.to.customerContacts(customerId),
- await flash(request, error(createCustomerContact.error, errorMessage))
+ await flash(
+ request,
+ error(
+ createCustomerContact.error,
+ "Failed to create customer contact"
+ )
+ )
);
}
diff --git a/apps/erp/app/routes/x+/supplier+/$supplierId.contacts.new.tsx b/apps/erp/app/routes/x+/supplier+/$supplierId.contacts.new.tsx
index a9293f73ee..3f1c6833a2 100644
--- a/apps/erp/app/routes/x+/supplier+/$supplierId.contacts.new.tsx
+++ b/apps/erp/app/routes/x+/supplier+/$supplierId.contacts.new.tsx
@@ -7,13 +7,14 @@ import { requirePermissions } from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
-import { isUniqueViolation, redirect } from "@carbon/utils";
+import { redirect } from "@carbon/utils";
import type { ActionFunctionArgs } from "react-router";
import { data, useNavigate, useParams } from "react-router";
import { supplierContactValidator } from "~/modules/purchasing/purchasing.models";
import { insertSupplierContact } from "~/modules/purchasing/purchasing.service";
import SupplierContactForm from "~/modules/purchasing/ui/Supplier/SupplierContactForm";
import { requireCompanyRecord } from "~/modules/shared/shared.service";
+import { getDatabaseClient } from "~/services/database.server";
import { setCustomFields } from "~/utils/form";
import { path } from "~/utils/path";
@@ -23,7 +24,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
create: "purchasing"
});
- // RLS doesn't work for selecting a contact with no supplier
const client = getCarbonServiceRole();
const { supplierId } = params;
@@ -55,59 +55,33 @@ export async function action({ request, params }: ActionFunctionArgs) {
: null
]);
- const createSupplierContact = await insertSupplierContact(client, {
- supplierId,
- companyId,
- contact,
- supplierLocationId,
- customFields: setCustomFields(formData)
- });
-
- if (createSupplierContact.error) {
- let errorMessage = "Failed to create supplier contact";
- if (isUniqueViolation(createSupplierContact.error)) {
- const contact = await client
- .from("contact")
- .select("id")
- .eq("email", validation.data.email)
- .eq("companyId", companyId)
- .single();
- if (contact.data) {
- const supplierContact = await client
- .from("supplierContact")
- .select("supplierId")
- .eq("contactId", contact.data.id)
- .single();
- if (supplierContact.data) {
- const supplier = await client
- .from("supplier")
- .select("name")
- .eq("id", supplierContact.data.supplierId)
- .single();
- errorMessage = `Contact ${validation.data.email} already exists for ${supplier.data?.name}`;
- } else {
- const customerContact = await client
- .from("customerContact")
- .select("customerId")
- .eq("contactId", contact.data.id)
- .single();
- if (customerContact.data) {
- const customer = await client
- .from("customer")
- .select("name")
- .eq("id", customerContact.data.customerId)
- .single();
- errorMessage = `Contact ${validation.data.email} already exists for ${customer.data?.name}`;
- }
- }
- }
+ const createSupplierContact = await insertSupplierContact(
+ getDatabaseClient(),
+ {
+ supplierId,
+ companyId,
+ contact,
+ supplierLocationId,
+ customFields: setCustomFields(formData)
}
+ );
+ if (createSupplierContact.error) {
+ // The form reads `{ data, error }`; never send it the database's message.
return modal
- ? createSupplierContact
+ ? {
+ data: null,
+ error: { message: "Failed to create supplier contact" }
+ }
: redirect(
path.to.supplierContacts(supplierId),
- await flash(request, error(createSupplierContact.error, errorMessage))
+ await flash(
+ request,
+ error(
+ createSupplierContact.error,
+ "Failed to create supplier contact"
+ )
+ )
);
}
diff --git a/packages/database/src/event-system/attachments.ts b/packages/database/src/event-system/attachments.ts
index d6f0e0005d..ebe14a7f16 100644
--- a/packages/database/src/event-system/attachments.ts
+++ b/packages/database/src/event-system/attachments.ts
@@ -63,7 +63,10 @@ export const attachments = {
after: ["sync_add_customer_account_to_group"],
events: true
},
- customerContact: { statement: ["broadcast_reference_changes"] },
+ customerContact: {
+ after: ["sync_delete_unlinked_contact"],
+ statement: ["broadcast_reference_changes"]
+ },
customerContract: { after: ["sync_advance_document_sequence"] },
customerItemPriceOverride: { events: true },
customerItemPriceOverrideBreak: { events: true },
@@ -424,7 +427,10 @@ export const attachments = {
after: ["sync_add_supplier_account_to_group"],
events: true
},
- supplierContact: { statement: ["broadcast_reference_changes"] },
+ supplierContact: {
+ after: ["sync_delete_unlinked_contact"],
+ statement: ["broadcast_reference_changes"]
+ },
supplierLocation: { statement: ["broadcast_reference_changes"] },
supplierPart: { events: true },
supplierPayment: { events: true },
diff --git a/packages/database/src/event-system/handlers/sync_delete_unlinked_contact.sql b/packages/database/src/event-system/handlers/sync_delete_unlinked_contact.sql
new file mode 100644
index 0000000000..76474b6bff
--- /dev/null
+++ b/packages/database/src/event-system/handlers/sync_delete_unlinked_contact.sql
@@ -0,0 +1,34 @@
+CREATE OR REPLACE FUNCTION public.sync_delete_unlinked_contact(p_table text, p_operation text, p_new jsonb, p_old jsonb)
+ RETURNS void
+ LANGUAGE plpgsql
+ SET search_path TO 'public'
+AS $function$
+DECLARE
+ v_contact_id TEXT := p_old->>'contactId';
+BEGIN
+ -- A dataset wipe or a backup restore manages contact rows itself.
+ IF current_setting('app.sync_in_progress', true) = 'true' THEN
+ RETURN;
+ END IF;
+
+ IF p_operation = 'INSERT' THEN
+ RETURN;
+ END IF;
+
+ IF p_operation = 'UPDATE'
+ AND v_contact_id IS NOT DISTINCT FROM p_new->>'contactId' THEN
+ RETURN;
+ END IF;
+
+ -- Lock the contact first: an insert linking it holds a key-share lock until
+ -- it commits, so the checks below, each with a new snapshot, see its link.
+ PERFORM 1 FROM "contact" WHERE "id" = v_contact_id FOR UPDATE;
+
+ IF EXISTS (SELECT 1 FROM "customerContact" WHERE "contactId" = v_contact_id)
+ OR EXISTS (SELECT 1 FROM "supplierContact" WHERE "contactId" = v_contact_id) THEN
+ RETURN;
+ END IF;
+
+ DELETE FROM "contact" WHERE "id" = v_contact_id;
+END;
+$function$;
diff --git a/packages/database/supabase/migrations/20261027162653_contact-email-index-and-orphans.sql b/packages/database/supabase/migrations/20261027162653_contact-email-index-and-orphans.sql
new file mode 100644
index 0000000000..aff33244f0
--- /dev/null
+++ b/packages/database/supabase/migrations/20261027162653_contact-email-index-and-orphans.sql
@@ -0,0 +1,19 @@
+-- Contact email is not unique. 20260112120041 meant to drop the index, but it
+-- named it unquoted, Postgres folded the name to lower case and `IF EXISTS`
+-- found nothing, so a second contact with one email was still refused.
+SET lock_timeout = '5s';
+DROP INDEX IF EXISTS "contact_email_companyId_unique_idx";
+RESET lock_timeout;
+
+-- A contact belongs to a customer or supplier through its link rows. Deleting
+-- the customer or supplier removed the links but left the contact behind,
+-- invisible in the app. sync_delete_unlinked_contact now removes it with its
+-- last link; this removes the ones already left. Under app.sync_in_progress,
+-- so no webhook, workflow or audit event is queued for contacts nobody saw.
+DO $$
+BEGIN
+ PERFORM set_config('app.sync_in_progress', 'true', true);
+ DELETE FROM "contact" c
+ WHERE NOT EXISTS (SELECT 1 FROM "customerContact" cc WHERE cc."contactId" = c."id")
+ AND NOT EXISTS (SELECT 1 FROM "supplierContact" sc WHERE sc."contactId" = c."id");
+END $$;
diff --git a/packages/database/supabase/migrations/20261027171946_contact-unlinked-cleanup.sql b/packages/database/supabase/migrations/20261027171946_contact-unlinked-cleanup.sql
new file mode 100644
index 0000000000..af63a60c22
--- /dev/null
+++ b/packages/database/supabase/migrations/20261027171946_contact-unlinked-cleanup.sql
@@ -0,0 +1,44 @@
+-- Generated by `pnpm --filter @carbon/database authz migration` from packages/database/src/authz. Do not edit.
+
+-- Ships these rules to databases where `authz sync` does not run after migrations yet.
+
+CREATE OR REPLACE FUNCTION public.sync_delete_unlinked_contact(p_table text, p_operation text, p_new jsonb, p_old jsonb)
+ RETURNS void
+ LANGUAGE plpgsql
+ SET search_path TO 'public'
+AS $function$
+DECLARE
+ v_contact_id TEXT := p_old->>'contactId';
+BEGIN
+ -- A dataset wipe or a backup restore manages contact rows itself.
+ IF current_setting('app.sync_in_progress', true) = 'true' THEN
+ RETURN;
+ END IF;
+
+ IF p_operation = 'INSERT' THEN
+ RETURN;
+ END IF;
+
+ IF p_operation = 'UPDATE'
+ AND v_contact_id IS NOT DISTINCT FROM p_new->>'contactId' THEN
+ RETURN;
+ END IF;
+
+ -- Lock the contact first: an insert linking it holds a key-share lock until
+ -- it commits, so the checks below, each with a new snapshot, see its link.
+ PERFORM 1 FROM "contact" WHERE "id" = v_contact_id FOR UPDATE;
+
+ IF EXISTS (SELECT 1 FROM "customerContact" WHERE "contactId" = v_contact_id)
+ OR EXISTS (SELECT 1 FROM "supplierContact" WHERE "contactId" = v_contact_id) THEN
+ RETURN;
+ END IF;
+
+ DELETE FROM "contact" WHERE "id" = v_contact_id;
+END;
+$function$;
+
+-- event triggers (packages/database/src/event-system/attachments.ts)
+SET lock_timeout = '5s';
+SELECT set_event_triggers('customerContact', ARRAY[]::text[], ARRAY['sync_delete_unlinked_contact']::text[], false, ARRAY['broadcast_reference_changes']::text[]);
+SELECT set_event_triggers('supplierContact', ARRAY[]::text[], ARRAY['sync_delete_unlinked_contact']::text[], false, ARRAY['broadcast_reference_changes']::text[]);
+RESET lock_timeout;
diff --git a/packages/ee/src/paperless-parts/lib/lib.ts b/packages/ee/src/paperless-parts/lib/lib.ts
index 4050839d54..9adfe2dbbf 100644
--- a/packages/ee/src/paperless-parts/lib/lib.ts
+++ b/packages/ee/src/paperless-parts/lib/lib.ts
@@ -1399,18 +1399,38 @@ export async function getCustomerIdAndContactId(
}
if (!customerContactId) {
- // If there is no matching contact in Carbon, check if contact exists by email first
+ // If there is no matching contact in Carbon, check if contact exists by email first.
+ // Contacts may share an email: reuse one already on this customer, or the only match.
const existingContactByEmail = await carbon
.from("contact")
- .select("id")
+ .select("id, customerContact(customerId)")
.eq("companyId", company.id)
.eq("email", contact.email!)
.eq("isCustomer", true)
- .maybeSingle();
+ .order("id");
+
+ if (existingContactByEmail.error) {
+ logger.error("Failed to look up contact by email in Carbon", {
+ error: existingContactByEmail.error
+ });
+ return {
+ customerContactId: null,
+ customerId
+ };
+ }
+
+ const contactsWithEmail = existingContactByEmail.data;
+ const reusableContact =
+ contactsWithEmail.find((c) =>
+ c.customerContact.some((link) => link.customerId === customerId)
+ ) ??
+ // Several contacts with this email and none on the customer: they are
+ // other people's, so create a new one rather than take one over.
+ (contactsWithEmail.length === 1 ? contactsWithEmail[0] : undefined);
let contactId: string;
- if (existingContactByEmail.data) {
+ if (reusableContact) {
// Update the existing contact
const updatedContact = await carbon
.from("contact")
@@ -1418,7 +1438,7 @@ export async function getCustomerIdAndContactId(
firstName: contact.first_name!,
lastName: contact.last_name!
})
- .eq("id", existingContactByEmail.data.id)
+ .eq("id", reusableContact.id)
.select()
.single();
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 267ded0c0e..1fe6002aec 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Ein Name ist erforderlich, um eine Ansicht zu speichern"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Ein verhandelter, für einen bestimmten Artikel festgelegter Preis — pro Kunde, Kundentyp oder alle Kunden — der den Basispreis vollständig ersetzt, optional mit Mengenstaffeln."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Ein neuer Einladungslink wird gesendet. Ein zuvor gesendeter Link funktioniert nicht mehr."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Für jeden Lieferant wird eine neue Bestellung erstellt. Alternativ können Sie eine bestehende Entwurfs-Bestellung des Lieferanten auswählen, um die Fremdvergabe-Arbeitsgänge hinzuzufügen."
@@ -19431,6 +19434,9 @@ msgstr "Umplanungstoleranz"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Einladung erneut senden"
+
msgid "Reserve floor"
msgstr "Reservemindestbestand"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 00f36d6e13..37069a0d85 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -1237,6 +1237,9 @@ msgstr "A name is required to save a view"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "A new invite link is sent. A link sent before stops working."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
@@ -19431,6 +19434,9 @@ msgstr "Reschedule Tolerance"
msgid "Reschedule tolerance updated"
msgstr "Reschedule tolerance updated"
+msgid "Resend Invite"
+msgstr "Resend Invite"
+
msgid "Reserve floor"
msgstr "Reserve floor"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index c5818755da..e2b2948b8b 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Se requiere un nombre para guardar una vista"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Un precio negociado fijado para un artículo específico — por cliente, tipo de cliente o todos los clientes — que reemplaza completamente el precio base, opcionalmente con escalas de cantidades."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Se envía un nuevo enlace de invitación. Un enlace enviado antes deja de funcionar."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Se creará una nueva orden de compra para cada proveedor. Alternativamente, puede elegir una orden de compra en borrador existente para el proveedor y agregar las operaciones externas a ella."
@@ -19431,6 +19434,9 @@ msgstr "Tolerancia de Reprogramación"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Reenviar Invitación"
+
msgid "Reserve floor"
msgstr "Piso de reserva"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index d54601b6f3..830eec3f5f 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Un nom est requis pour enregistrer une vue"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Un prix négocié fixé pour un article spécifique — par client, type de client ou tous les clients — qui remplace le prix de base purement et simplement, optionnellement avec des paliers de quantité."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Un nouveau lien d'invitation est envoyé. Un lien envoyé auparavant ne fonctionne plus."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Un nouveau bon de commande sera créé pour chaque fournisseur. Vous pouvez également choisir un bon de commande brouillon existant du fournisseur auquel ajouter les opérations externes."
@@ -19431,6 +19434,9 @@ msgstr "Tolérance de reprogrammation"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Renvoyer l'invitation"
+
msgid "Reserve floor"
msgstr "Plancher de réserve"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 3440663474..6eed3c55f7 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -1237,6 +1237,9 @@ msgstr "एक दृश्य को सहेजने के लिए एक
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "एक समझौता किया गया मूल्य एक विशिष्ट आइटम के लिए तय किया गया — ग्राहक, ग्राहक प्रकार, या सभी ग्राहकों द्वारा — जो मूल मूल्य को पूरी तरह से प्रतिस्थापित करता है, वैकल्पिक रूप से मात्रा स्तर के साथ।"
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "एक नया आमंत्रण लिंक भेजा जाता है। पहले भेजा गया लिंक काम करना बंद कर देता है।"
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "प्रत्येक आपूर्तिकर्ता के लिए एक नया क्रय आदेश बनाया जाएगा। वैकल्पिक रूप से, आप आपूर्तिकर्ता के लिए एक मौजूदा ड्राफ्ट क्रय आदेश चुन सकते हैं ताकि बाहरी ऑपरेशन जोड़े जा सकें।"
@@ -19431,6 +19434,9 @@ msgstr "पुनर्निर्धारण सहनशीलता"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "आमंत्रण दोबारा भेजें"
+
msgid "Reserve floor"
msgstr "रिज़र्व फ़्लोर"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index dd0e50eec3..aa68686ca3 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Un nome è obbligatorio per salvare una vista"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Un prezzo negoziato fissato per un articolo specifico — per cliente, tipo di cliente o tutti i clienti — che sostituisce completamente il prezzo base, facoltativamente con scaglioni di quantità."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Viene inviato un nuovo link di invito. Un link inviato in precedenza smette di funzionare."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Un nuovo ordine di acquisto verrà creato per ogni fornitore. In alternativa, puoi scegliere un ordine di acquisto in bozza esistente per il fornitore per aggiungere le operazioni esterne."
@@ -19431,6 +19434,9 @@ msgstr "Tolleranza di Riprogrammazione"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Reinvia Invito"
+
msgid "Reserve floor"
msgstr "Limite di riserva"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 4431c7f584..ad2bf606a3 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -1237,6 +1237,9 @@ msgstr "ビューを保存するには名前が必要です"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "得意先、得意先タイプ、またはすべての得意先ごとに設定され、基本価格を完全に置き換える交渉済み価格で、オプションで数量スケールを含みます。"
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "新しい招待リンクが送信されます。以前に送信したリンクは使えなくなります。"
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "仕入先ごとに新しい発注書が作成されます。または、既存の下書き発注書を選択して、外注工程を追加することもできます。"
@@ -19431,6 +19434,9 @@ msgstr "スケジュール変更許容値"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "招待を再送信"
+
msgid "Reserve floor"
msgstr "予備床"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 2ec6b8fabb..c5f01bd72a 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -1237,6 +1237,9 @@ msgstr "보기를 저장하려면 이름이 필요합니다"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "특정 품목에 대해 협상으로 고정된 가격으로 고객, 고객 유형 또는 모든 고객 기준으로 기본 가격을 완전히 대체하며 선택적으로 수량 구간을 포함합니다."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "새 초대 링크가 전송됩니다. 이전에 보낸 링크는 더 이상 작동하지 않습니다."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "각 공급업체마다 새로운 발주서가 생성됩니다. 또는 공급업체의 기존 초안 발주서를 선택하여 외주 공정을 추가할 수 있습니다."
@@ -19431,6 +19434,9 @@ msgstr "재일정 허용도"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "초대 다시 보내기"
+
msgid "Reserve floor"
msgstr "예약 최저 수량"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 4bf0520be6..30621045f0 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Nazwa jest wymagana, aby zapisać widok"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Wynegocjowana cena ustalona dla konkretnego artykułu — dla klienta, typu klienta lub wszystkich klientów — która w pełni zastępuje cenę bazową, opcjonalnie z progami ilościowymi."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Wysyłany jest nowy link z zaproszeniem. Link wysłany wcześniej przestaje działać."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Dla każdego dostawcy zostanie utworzone nowe zamówienie zakupu. Alternatywnie możesz wybrać istniejące zamówienie zakupu w wersji roboczej dla dostawcy, aby dodać do niego operacje zewnętrzne."
@@ -19431,6 +19434,9 @@ msgstr "Tolerancja przesunięcia"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Wyślij zaproszenie ponownie"
+
msgid "Reserve floor"
msgstr "Poziom rezerwy"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 32c9063fb9..e77772e729 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Um nome é necessário para salvar uma visualização"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Um preço negociado fixado para um item específico — por cliente, tipo de cliente ou todos os clientes — que substitui completamente o preço base, opcionalmente com faixas de quantidade."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Um novo link de convite é enviado. Um link enviado antes deixa de funcionar."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Uma nova ordem de compra será criada para cada fornecedor. Alternativamente, você pode escolher um pedido de compra em rascunho existente do fornecedor para adicionar as operações externas a ele."
@@ -19431,6 +19434,9 @@ msgstr "Tolerância de reagendamento"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Reenviar Convite"
+
msgid "Reserve floor"
msgstr "Piso de reserva"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index ce38531bc9..ef5af1033a 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Требуется имя для сохранения представл
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Согласованная цена, установленная для конкретной номенклатуры — по покупателю, типу покупателя или для всех покупателей — которая полностью заменяет базовую цену, опционально с шкалами количества."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Отправляется новая ссылка-приглашение. Ранее отправленная ссылка перестаёт работать."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Для каждого поставщика будет создан новый заказ на покупку. Кроме того, вы можете выбрать существующий черновик заказа на покупку поставщика, чтобы добавить к нему внешние операции."
@@ -19431,6 +19434,9 @@ msgstr "Допуск переноса"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Отправить приглашение повторно"
+
msgid "Reserve floor"
msgstr "Минимальный уровень запаса"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index de32f2525b..b9d7774383 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -1237,6 +1237,9 @@ msgstr "Bir görünüm kaydetmek için bir isim gereklidir"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "Belirli bir müşteri, müşteri türü veya tüm müşteriler için sabitlenmiş ve temel fiyatın yerini tamamıyla alan, isteğe bağlı olarak miktar kademesileri ile birlikte gelen müzakere edilmiş fiyat."
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "Yeni bir davet bağlantısı gönderilir. Daha önce gönderilen bağlantı artık çalışmaz."
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "Her tedarikçi için yeni bir satın alma siparişi oluşturulacaktır. Alternatif olarak, tedarikçinin dış operasyonları eklemesi için mevcut taslak bir satın alma siparişi seçebilirsiniz."
@@ -19431,6 +19434,9 @@ msgstr "Yeniden Planlama Toleransı"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "Daveti Yeniden Gönder"
+
msgid "Reserve floor"
msgstr "Rezerv tabanı"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 8ce82a5837..6ddcbb97b9 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -1237,6 +1237,9 @@ msgstr "需要名称才能保存查看"
msgid "A negotiated price pinned for a specific item — by customer, customer type, or all customers — that replaces the base price outright, optionally with quantity breaks."
msgstr "为特定物料约定的固定价格——按客户、客户类型或所有客户——完全替代基准价格,可选择数量阶梯。"
+msgid "A new invite link is sent. A link sent before stops working."
+msgstr "将发送新的邀请链接。之前发送的链接将失效。"
+
msgid "A new purchase order will be created for each supplier. Alternatively, you can choose an existing draft purchase order for the supplier to add the outside operations to."
msgstr "将为每个供应商创建一个新的采购订单。或者,您可以选择供应商的现有草稿采购订单以向其添加外协工序。"
@@ -19431,6 +19434,9 @@ msgstr "重新安排容差"
msgid "Reschedule tolerance updated"
msgstr ""
+msgid "Resend Invite"
+msgstr "重新发送邀请"
+
msgid "Reserve floor"
msgstr "储备下限"