lockReport: false overrides and confusion when activity shows no one manually locked reports.toBeInvoiced === true and there are no active agreements in the Agreement collection, checkReportAccess returns unlocked even if lockReport is still true (see integration tests in lockReport.test.ts).inspection.lockReport !== false and label copy “Requires Payment & Agreement” (reportGateCopy.ts)—which does not change for invoice-terms jobs and can read as “locked” while clients may already be allowed.toBeInvoiced is set at Attik job creation when a contact has invoiceApproved and a role with portal pay permission (createInspection.ts), or toggled later via Allow Invoice Terms on Services & Payments (ServicesPayments.tsx).attik-backend/src/util/functions/inspection/checkReportAccess.ts — source of truth for client report access: lockReport === false bypasses all rules; otherwise unlock when toBeInvoiced and no active agreements (or agreements signed); payment ignored when toBeInvoiced.attik-backend/src/models/inspectionSchema.ts — lockReport (default true), toBeInvoiced, synced agreement.present / agreement.signed.attik-backend/src/routes/reports.ts — client portal report fetch uses checkReportAccess (403 when locked).attik-backend/src/routes/inspection.ts — PATCH supports lockReport and toBeInvoiced.attik-backend/src/util/functions/agreements/agreementLockSync.ts — agreement present/signed math (stale rows, archived excluded).attik-backend/tests/integration/lockReport.test.ts — toBeInvoiced + no agreements → unlocked.attik-frontend/src/app/tools/inspections/[id]/components/reports/Reports.tsx — Reports switch PATCHes lockReport; reportGatingEnabled = inspection?.lockReport !== false (does not use computed access).attik-frontend/src/util/functions/report/reportGateCopy.ts — switch labels/toasts always payment + agreement wording.attik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsx — To Be Invoiced chip and Allow Invoice Terms / Disable Invoice Terms toggle.attik-frontend/src/app/client/job/[slug]/components/AttikReportList.tsx and ReportList.tsx — client portal lock UI from toBeInvoiced, payment, and agreements; falls back to inspection.agreement when agreement list is empty (align with backend DB query behavior).attik-frontend/src/util/functions/report/computeAgreementSignedForReportLock.ts — portal agreement lock math (keep aligned with backend).attik-frontend/src/app/tools/inspections/[id]/components/Agreements.tsx — empty state when no agreements on inspection.toBeInvoiced && no agreements?lockReport: false.checkReportAccess stay aligned for invoice-terms jobs with empty agreements.attik-backend/src/util/functions/inspection/checkReportAccess.tsattik-backend/tests/integration/lockReport.test.tsattik-frontend/src/app/tools/inspections/[id]/components/reports/Reports.tsxattik-frontend/src/util/functions/report/reportGateCopy.tsattik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsxattik-frontend/src/app/client/job/[slug]/components/AttikReportList.tsxPlease authenticate to join the conversation.
Canceled
Main App
1 day ago
Linear
Get notified by email when there are changes.
Canceled
Main App
1 day ago
Linear
Get notified by email when there are changes.