Phase 11, step 1: the parties of a contract and the conflict check
CI / secret scan (push) Successful in 8s
CI / fmt, clippy, tests (push) Successful in 1m14s
CI / release (push) Skipped

A contract's other side was one line of text. Now each other party is a
row with its names in English and Thai, an ID, passport or registration
number and its role (migration 0010; the old line became the first
party). Parties are never deleted or rewritten: taking one off marks it
removed, and both are in the journal.

The conflict check (src/conflicts.rs) looks for the name or number among
the clients, the other parties, the visa people and the employers. Names
match regardless of case, word order, punctuation and company words in
English and Thai (Co., Ltd., บริษัท ... จำกัด), or when every word of the
shorter name, at least two, is in the longer one. A new party that is a
client, a visa client or an employer is a conflict; a new or renamed
client that was on the other side of a contract is one too; a client's
name or number again is perhaps the same client. Those stop the save
(409) until a lawyer ticks that they looked, with what they checked; the
matches and the note go into the journal entry. /conflicts runs the
check alone before a first meeting and saves nothing.

Tests: 119 unit, 63 integration.
This commit is contained in:
grabowski committed 2026-11-22 22:12:17 +07:00
1 parent f7fb2c7af4
commit 9ae4d7bd07
16 files changed
+1464 -25

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% import "_fields.html" as fm %}
{% import "_conflicts.html" as cf %}
{% block main %}
<div class="crumbs"><a href="/clients">Clients</a></div>
<div class="pagehead"><h1>Conflict check</h1></div>
<p class="meta">Before a first meeting, look up a name or a number among the clients, the other parties of the contracts, the visa clients and the employers. Nothing is saved here. Adding a client or a party runs the same check and writes it into the journal.</p>
<form method="get" action="/conflicts" class="form" id="conflict-search">
<section class="card">
<div class="grid">
{{ fm.text("name", "Name", name, cls="wide", hint="In English or Thai. Word order, capitals and words such as Co., Ltd. or บริษัท do not count.") }}
{{ fm.text("number", "ID, passport or registration number", number, hint="Compared on its letters and digits.") }}
</div>
<div class="formactions"><button type="submit" class="btn pri" id="check">Check</button></div>
</section>
</form>
{% if asked %}
<section class="card" id="results">
<header><h2>{% if check.hits %}{{ check.hits|length }} match{% if check.hits|length != 1 %}es{% endif %}{% else %}No match{% endif %}</h2></header>
{% if check.hits %}{{ cf.block(check) }}{% else %}<p class="empty-inline">Nobody on record has this name or number.</p>{% endif %}
</section>
{% endif %}
{% endblock %}