Contracts: refuse impossible dates (2026-02-30) when adding, editing, activating, renewing, cancelling or starting from a template instead of failing on save; keep each term to the day of the month it started on or the last day of a shorter month so month-end contracts no longer drift (PHP, nightly renewal, the Renew window, templates, Standard terms and contract_form.js); withdraw signing requests still waiting on the client or a countersignature when a contract is cancelled, when it ends nightly or when its client is archived (singly or in bulk), and refuse signing or countersigning on ended, cancelled or archived-client contracts through the link, the portal and Countersign; leave archived clients' contracts alone nightly (no renewing, ending or reminders), keep them out of the all-clients list, Due soon and the side menu count, and refuse sending them to sign; count a self-renewing contract as due soon and remind about it only when its notice date falls within its term, so Standard terms and monthly contracts with 30 days' notice no longer remind every term; keep drawing and adding prepaid hours on a cancelled contract until its last day; refuse deleting a contract once tickets drew on its prepaid hours or it was signed by both, showing why in place of Delete; changelog updated

This commit is contained in:
johnnyq
2026-10-28 23:51:45 -04:00
parent 3c996a0b4b
commit 8e24607a0a
13 changed files with 349 additions and 90 deletions

View File

@@ -446,14 +446,14 @@ function portalContractsGate() {
}
}
/** SQL: a contract sent to sign and not withdrawn - out for signature, or signed (3.4.3 on). */
/** SQL: a contract sent to sign and not withdrawn - out for signature (while a draft or active), or signed (3.4.3 on). */
function portalContractSentSql($client_signed = null) {
if (!contractSignaturesReady()) {
return '0';
}
return "EXISTS (SELECT 1 FROM contract_signatures WHERE contract_signature_contract_id = contract_id AND contract_signature_url_key <> ''
AND contract_signature_sent_at IS NOT NULL AND contract_signature_withdrawn_at IS NULL"
. ($client_signed === false ? ' AND contract_signature_client_signed_at IS NULL' : '') . ")";
. ($client_signed === false ? " AND contract_signature_client_signed_at IS NULL AND contract_status IN ('Draft', 'Active')" : '') . ")";
}
/** SQL: the session client's contracts the portal shows - not drafts, unless sent to sign. */