Property adverts: data model, saving and notification
The tables of adverts, price history and advert services, the order of checks on saving, the price change notification, the two kinds of deletion and the content scope.
The advert module manages rows of property + deal type + price. On saving, the advert's client company is the property's operator, or its owner if there is none; the content scope is tied to this company. The module is in development status.
Data model
Table names carry the installation's own prefix in the database.
| Table | Role | Main fields |
|---|---|---|
advert | the advert | property_id, company_client_id, deal_type (sale, rent, share_sale), seller_company_id, price, currency, price_unit (total, month, m2_month, day), vat_rate, min_term_months, deposit_months, share_percent, available_from, date_from, date_to, note, status, created_by |
advert_price | price history | advert_id, price, currency, price_unit, user_id, date_added |
advert_service | services of the advert | advert_id, service_id (0 = free text), name (snapshot), price, currency, price_unit (default once), note, sort_order |
Indexes: (property_id, deal_type), (company_client_id, status), (status, date_added). Foreign tables read: property (name, address), company (client and seller name). Methods used by other modules: getAdverts(), getServices(), hasTable().
Saving
- An existing advert must exist and its client must be in scope; otherwise "Warning: you do not have permission for this action!"
- The property must exist ("Select a property from the master data."); the client is its operator or owner, out of scope: "You have no access to this property's client company."
- The deal type is one of the three values; the seller is 0 for a rent and required and existing for a sale or share sale.
- Price above zero, currency HUF or EUR; the unit must fit the deal; an unknown VAT value silently becomes empty.
- For non-rent deals the minimum term and deposit are 0; for a rent 0–600 and 0–36 months. The share is above 0 and at most 100 %.
- Date format and order; service rows: empty rows are skipped, a master item must exist, name, non-negative fee, known unit. Row errors are shown together in one block.
- Write, then replace the services (if the table exists; before the migration the advert is saved without services).
- Read-back: the advert exists, the price matches and the service count matches; otherwise "The advert could not be saved (it could not be read back)."
- Success, the response carries the new ID, plus an info log line.
- If the price, currency or unit of an existing advert that is active after saving changed: a price history row and a notification to the brokers of the property's active brokerage rows (mail template event: price change). Mail errors appear as a warning and do not block saving.
Status and deletion
- Status: 0 inactive, 1 active, 9 trash. The trash appears in the list and the filter only for users allowed to see deleted items; a row in the trash cannot be edited from the list.
- One Delete button: with
statusdeleteit moves to the trash, withdeleteonly it deletes permanently. With both rights the button moves to the trash and Delete permanently on a trashed row deletes the services, price history and the row. Rows out of scope are skipped silently, also for enabling and disabling.
Permissions
- Base access: the menu path of Adverts.
- Function rights (base package):
list,add,edit,statusdelete,delete,debug. The service search needsliston the service master, the property searchliston the property master. - Content scope: the advert's client company must be in the user's company group filter scope — in the list, form, saving, status change and deletion. An advert without a client (0) is reachable only with unrestricted scope.
Connections and limitations
The property list annex of a brokerage contract takes the offer price and services from the advert; client registration offers the active adverts of the contract's properties. The delete confirmation text comes from the framework's base language file; its exact wording cannot be determined from the code. Adverts do not yet appear in the data room.