Brokerage rows, commission calculation and data room sync

The data model of the brokerage row, the pure commission rules, the shared internal path for closing a row and how data room access is built from the contract.

A brokerage row (contract_property) is one property in a brokerage contract. Closing a row goes through a single internal endpoint (contract/contract.closerow); data room access is built by the syncContract() process of the data room access service.

Data model

Table names carry the installation's own prefix in the database.

FieldMeaning
property_idthe property from master data
deal_typesummary kind: sale, rent, share_sale, sale_rent (for legacy readers)
deal_casescomma-separated cases: sale, share_sale, rent_long, rent_short; if empty, deal_type decides
commission_rate, commission_share_rate, commission_months, commission_rent_ratecommission per case
date_from, date_towindow of the brokerage right (NULL = contract term)
stateactive, closed, ended
end_reasonsold_by_other, rented_by_other, withdrawn, expired, manual, terminated
closed_casethe concluded case on closing; the completion certificate calculates from it
ended_by_company_id, ended_by_namewho sold it
date_ended, doc_share_id, note, sort_orderend date, offering folder, note, order

On a legacy row a case with value 0 is not brokered and does not appear in the document.

Commission calculation

  • sale, business share, short lease: fee = base × % (clamped to 0–100), rounded to two decimals;
  • long lease: fee = net monthly rent × months;
  • the fee is due in proportion to the instalments actually paid, so a completion certificate is issued per payment.

Closing a row

  1. Manual: the "Status of the property in this brokerage" modal (contract/contract.propertyclose, edit permission) with a date.
  2. From a deal: saving a deal that refers to an active, concluded underlying contract closes the row once with the deal's case.
  3. Both paths call the internal closerow endpoint: on success every other active row of the property ends (sold_by_other or rented_by_other), the brokers get a case-specific e-mail, and the data room access of every affected contract is refreshed.
  4. From the property list, with masterdata/property + brokerend, the active rows of all contracts can be ended.

The offering folder of an ended or closed row remains available until the end of the day before the end date.

Data room access from the contract

  1. The agent party's persons flagged dataroom become users if they are not yet; on an e-mail match the name match is checked too.
  2. The broker functions of the data room (view, download, broker, terminate) are granted for the contract term (user_feature, source = order, origin = contract, source_ref = contract_id, access_mode = usable).
  3. The offering folders are granted for the row window (doc_share_user.source = contract, source_ref = contract_property_id).
  4. The contract's own rows that are no longer wanted end; manual rows are not touched.
  5. Timeline events: access_granted, access_changed, access_revoked. The login e-mail is not sent automatically.

The group of new data room users comes from the extension setting "Data room – group of new users"; without it no user is created and the error says where to set it.

Permissions

The data room sync runs with contract/contract + grantaccess; without it the contract is saved but no access is created. Closing a row requires edit and content scope.