Data model and validity rules of the power of attorney

The power of attorney table and fields, save validation, handling of removed rows, the validity and coverage rules, and the source of the contract badge.

The power of attorney is part of the property master (getMandates, saveMandates, getValidMandate); the contract only reads it. Recording happens when the property form is saved (mandate_form = 1).

Data model

Table names carry the installation's own prefix in the database. property_mandate (20261101_001): property_id, owner_company_id, mandatary_company_id, scope (brokerage, management, full), date_from, date_to (NULL = open), doc_id, note (at most 255), status (0, 1, 9), created_by, date_added, date_modified. Before the migration the card shows an information text only.

Validation

  1. Without an authorised company: "Choose the authorised company from the list."
  2. Authorised company = owner: "The authorised company cannot be the owner itself."
  3. End before start: "The end of the power of attorney cannot be before its start." (error in #error-mandate-i below the row).
  4. A non-existent document centre id is silently set to 0.
  5. The form writes the response's mandate_ids into hidden fields so the next save updates the rows.

Validity

  • A row left out of the form becomes status = 9 (history is kept).
  • Only rows with status = 1 are valid; a NULL end is open.
  • An open-ended contract period is only covered by an open-ended power of attorney (mandateCovers()).
  • The badge on the contract form's property row comes from getValidMandate(); getMandatedPropertyIds() returns properties with a power of attorney. A gap is a warning, not a blocker. Placeholders in the contract template: {property_owner}, {mandate_clause}.

Document

The power of attorney document is picked by document centre search and opens in the shared js-docmodal viewer.