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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: cc quote sender on email
Brad Barbin74c621cc2f13
diff --git a/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx b/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsxindex 2eae60d122..5cf90522a6 100644--- a/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx+++ b/apps/erp/app/routes/x+/quote+/$quoteId.finalize.tsx@@ -205,7 +205,7 @@ export async function action(args: ActionFunctionArgs) {const text = await renderAsync(emailTemplate, { plainText: true });await tasks.trigger<typeof sendEmailResendTask>("send-email-resend", {- to: customerContact.data.contact!.email!,+ to: [user.data.email, customerContact.data.contact!.email!],from: user.data.email,subject: `Quote ${quote.data.quoteId}`,html,diff --git a/packages/database/supabase/migrations/20250128164447_fix-api-key-company-2.sql b/packages/database/supabase/migrations/20250128164447_fix-api-key-company-2.sqlnew file mode 100644index 0000000000..e7e9b84977--- /dev/null+++ b/packages/database/supabase/migrations/20250128164447_fix-api-key-company-2.sql@@ -0,0 +1,29 @@+CREATE+OR REPLACE FUNCTION get_companies_with_permission (permission text) RETURNS text[] LANGUAGE "plpgsql" SECURITY DEFINER+SET+ search_path = public AS $$+DECLARE+ permission_companies text[];+ api_key_company text;+BEGIN+ api_key_company := get_company_id_from_api_key();++ -- If API key exists for a company, add it to results+ IF api_key_company IS NOT NULL THEN+ RETURN ARRAY[api_key_company];+ END IF;++ -- Get companies from user permissions+ SELECT jsonb_to_text_array(COALESCE(permissions->permission, '[]'))+ INTO permission_companies+ FROM public."userPermission"+ WHERE id::text = auth.uid()::text;++ -- Handle special case where user has global permission ('0')+ IF permission_companies IS NOT NULL AND '0'::text = ANY(permission_companies) THEN+ SELECT array_agg(id::text) INTO permission_companies FROM company;+ END IF;++ RETURN permission_companies;+END;+$$;\ No newline at end of file