# Edit locks, document immutability, corrections

> Edit locks, immutable posted documents and corrections by reversal in Smakład — why a posted document is never edited in place.

> Machine translation, editorial review pending.

Source: https://docs.smaklad.pl/en/guide/locks-corrections/

A food business is accountable to the tax office (JPK, KSeF), the sanitary inspectorate (HACCP) and the auditor. That is why the system follows three rules:

1. **Only one person edits a document at any given time.** This is ensured by edit locks.
2. **What has been posted is not rewritten.** Posted documents, journal entries and paid payslips are immutable.
3. **An error is corrected with a new entry.** To correct it, a reversal (storno), a correction entry or a cancellation is created. The original entry remains visible.

## 12.1. Edit lock

When you open a document for editing, the system places a lock on it with your name. For example, the following are locked:

- sales invoices and supplier invoices;
- submission to KSeF;
- warehouse lots and stocktakes;
- a warehouse or location;
- an order;
- a recipe and a production order;
- a receiving session.

How the lock works:

- The lock lasts 5 minutes and is renewed automatically every minute while the screen is open.
- After saving, the lock is taken again, so you can keep working.
- When you close the screen or tab, the lock is released.
- If another user is already editing the document, a bar with their name and the time they started editing appears above the form. The form opens **read-only**, and the "Save" button is unavailable.
- The **Try again** button in the bar tries to take the lock again, for example when the colleague has finished.
- Only an administrator can force-release someone else's lock, but **there is no button for this in the interface** (the bar only has "Try again"): release is available only via the API (`DELETE /admin/locks/<type>/<id>/force`, BUG-LOCK-NO-FORCE-UI). The server refuses managers and other roles (403). If the colleague simply closed the tab, the lock disappears by itself after about 5 minutes.

![Lock bar: the document is being edited by another user](https://docs.smaklad.pl/img/system-01-lock-banner.png)

The server checks the lock on every save. If you save a document locked by another user, the response is 423 and the system shows the message "The record is being edited by another user." A cook changing an order's status in the kitchen and a courier changing a delivery's status neither bypass nor break the lock: a status change does not require locking the whole order.

**Example: warehouses and locations.** The location edit dialog (**System → Locations & Warehouses**) takes the warehouse lock for as long as the dialog is open. Only an administrator can deactivate a location, and only after confirmation.

![Editing a location with a lock](https://docs.smaklad.pl/img/system-02-location-edit.png)

## 12.2. What cannot be changed after posting

| What | When it becomes immutable | How to correct |
|---|---|---|
| Warehouse document (PZ, WZ, RW, PW, MM, ZW, INW, PS) | on posting: the number `TYPE/YYYY/MM/NNNN/WAREHOUSE` is assigned | cancellation = a reversing KOR document, see [chapter 6](https://docs.smaklad.pl/en/guide/warehouse/) |
| Supplier invoice (FZ) | on posting: stock receipt and postings | cancelling the invoice (accountant or administrator). Open receipt lines are marked as cancelled |
| Sales invoice and KSeF | after submission to KSeF | a correction invoice, see [chapter 9](https://docs.smaklad.pl/en/guide/finance/) |
| Fiscal printer receipt | after printing | only a refund, not a void |
| Regulatory journal entry | immediately after saving | a correction entry (the **Correct** button in the history) |
| Signed-off journal period | after the manager's signature | a change after the signature is shown as "changed after sign-off" |
| Goods-in check record | after the receiving session is completed | only in the receiving wizard, while the session is open |
| Verified corrective action | after the "verified" status | a new corrective action |
| Product recall | after completion or cancellation | a new recall |
| Payslip | after being marked "paid" | recalculation skips a paid payslip (it does not change); correction in the next payroll run |

### Journals and the hash chain

Each regulatory journal entry contains the hash of the previous entry. If an entry is changed in the database bypassing the application, the chain breaks. The history screen shows the first broken entry, and such a period cannot be signed off. A correction via the **Correct** button does not break the chain: it is a new entry linked to the original one.

![Correcting a journal entry](https://docs.smaklad.pl/img/system-03-journal-correction.png)

### Goods-in check of deliveries

A goods-in check record in the HACCP journal is linked to a receiving session. While the session is open, errors are corrected in the receiving wizard. The service keeps a history of corrections with the author and reason. After the session is completed, a correction is rejected (409), and the error is recorded with a corrective action.

The history is visible in **HACCP → Goods receipt**: for an entry from the wizard, expand **Correction history** in the "Decision" column. For each change, the previous and new decision, the reason, the author and the time are shown.

## 12.3. Payroll calculation: recalculation and payment

Payslips go through the statuses "calculated", "approved" and "paid". Screen: **Finance → Payroll** (address `/people/payroll`). The section is visible to the administrator (owner), the accountant and the manager. **Only the administrator and the accountant can calculate, approve and pay**: the manager has no buttons, and the server rejects a direct calculation request (403). Contracts are also created and changed by the administrator or the accountant.

- **Calculate.** Creates payslips for the month. Existing payslips are not touched.
- **Recalculate.** Updates only payslips in the "calculated" status: the payslip remains the same and its version increases by 1. The system asks for confirmation before recalculating. Recalculation skips approved and paid payslips and names them in the message; they need to be corrected with a correcting payroll list (not yet implemented).
- **One payslip per contract.** An employee with an employment contract and a contract of mandate in the same month has two payslips. A B2B contract is not part of payroll; if the employee has only B2B, the calculation is refused (422 `CONTRACT_NOT_PAYROLL`).
- **When a posting appears.** Calculation and recalculation post nothing to the books. The accrual (pay, contributions, PIT, PPK) is posted once, when the payslip is approved. The payment is posted once: Dr 231 / Cr 131 for the net amount, on the payment date. Transfers to ZUS, the tax office and PPK are posted from the bank statement, not from payroll.

Before calculating, check the **Period** field: the calculation is done for the month specified in it (the current month by default).

**Payroll list date.** Next to the period is the **Payroll list date** field (lista płac): the day the payroll list is drawn up, today by default. The date cannot be in the future or earlier than the first day of the period, so a payroll list for a future month cannot be drawn up. In the books, the payroll accrual is posted on **the last day of the period, but no later than the payroll list date**: a November payroll list drawn up on 03.12 is posted on 30.11 (a November expense); a December payroll list drawn up on 02.12 is posted on 02.12, not 31.12. The system does not make postings dated in the future. If November has already been closed, the accrual lands in **Refused postings** (code PERIOD_CLOSED).

**Example: Pierogarnia Przykładowa, November 2026.** Cook Marek Zieliński, employment contract, 6,500.00 zł gross, PPK on:

| Item | 2026 rate | Amount |
|---|---|---|
| ZUS pension (emerytalne) | 9.76 % | 634.40 zł |
| ZUS disability (rentowe) | 1.5 % | 97.50 zł |
| ZUS sickness (chorobowe) | 2.45 % | 159.25 zł |
| Total social contributions | 13.71 % | 891.15 zł |
| Health contribution | 9 % of (gross − social) | 504.80 zł |
| PIT advance | 12 % × 5,456 zł − 300 zł | 355.00 zł |
| Employee PPK | 2 % | 130.00 zł |
| **Net** | | **4,619.05 zł** |
| Employer cost | | 7,928.70 zł |

PIT advance base: gross − social contributions − 250 zł KUP (tax-deductible costs) + employer PPK (1.5 % = 97.50 zł; under Art. 12 of the PIT Act this is the employee's income) = 5,456.35 zł, rounded to 5,456 zł.
- **Approve** and **Pay.** The actions are performed on a single payslip or on all payslips of the month at once. Each action requires confirmation: for a single payslip the dialog shows the employee, the net amount and the month; for a bulk action — the total net amount. **A payment cannot be undone:** a paid payslip is no longer recalculated. In the payment dialog, enter the **payment date** (today by default; not in the future and not earlier than the payroll list date): Dr 231 / Cr 131 is posted on that date. Two simultaneous approvals or payments of the same payslip are not duplicated: one goes through, the others get 409. If some payslips could not be processed, the system lists the employees for whom it failed.

### Contracts

**Payroll → Contracts.** New contract: choose the employee from the list, the type (employment contract, contract of mandate, contract for specific work, B2B — for record-keeping only, not part of payroll), the monthly gross pay (PLN), the start date (today by default), the end date if needed (empty — open-ended), hours per week (40 by default, no more than 60), position, department and **date of birth** — it is needed for the "ulga dla młodych" (PIT exemption for those under 26). PPK participation is on by default (PPK is not charged for a contract for specific work or for a contract of mandate without mandatory pension insurance). For contracts of mandate and contracts for specific work there are flags: student under 26 (no ZUS), another insurance title at or above the minimum wage (social contributions are voluntary), voluntary pension and sickness insurance, copyright transfer (KUP 50 %).

### Employee card: NFZ and emergency contact

**The employee card in the "Payroll" section** (`/people/payroll/employees/<id>`): in addition to the name, contact details, department, hire date and PESEL, it has:

- **NFZ branch** — a list of the 16 voivodeship branches (01 Lower Silesian … 16 West Pomeranian); the code is needed for the ZUS ZUA/ZZA registration forms. An empty value means "not specified".
- **Emergency contact** — first and last name, phone, relationship. The phone number is validated (digits, spaces, `+`, brackets, hyphen). A cleared field is saved as "no data".

In a concluded contract, only the gross pay, end date, position and the "active" flag can change. The type, start date, hours and department do not change: different terms mean a new contract.

![Monthly payroll calculation](https://docs.smaklad.pl/img/system-04-payroll-run.png)

## 12.4. Double-click protection

- While a request is running, the save button is unavailable, and a second click does nothing.
- Enter in a search or form field submits the form once. An Enter used to confirm input through an input method editor (IME) does not submit the form.
- Operations that the server processes idempotently do not create duplicates even if the request arrives again, for example:
  - posting a supplier invoice;
  - receiving an invoice line into stock;
  - resending an event;
  - confirming the receiving wizard.

## 12.5. Common error messages

| Code | What it means | What to do |
|---|---|---|
| 400 | the data failed validation (for example, a password shorter than 12 characters or a mandatory field left empty) | correct the field highlighted in the form |
| 403 | your role does not have permission for this action | contact the owner or manager |
| 409 | state conflict: the document is already posted, the payslip is already paid, a duplicate invoice number, the receiving session is closed | reload the page and use the correction path from the table above |
| 422 | not enough data to generate the file, for example an incomplete company profile for JPK | complete the data in **System → Settings** |
| 423 | the document is being edited by another user | wait until they finish or click **Try again** in the lock bar |

## 12.6. Warehouses and locations

**System → Locations & Warehouses.** The name, type and address of a warehouse are changed by a manager or administrator (the edit dialog takes a lock). A warehouse's active status is not changed in this dialog:

- **Deactivate** — only an administrator, with a separate button and confirmation. A deactivated warehouse does not take part in receiving, issuing or transfers.
- **Reactivate** — also only an administrator, with a button and confirmation in the inactive warehouse's row. Inactive warehouses will appear in the list once the gateway starts passing the `includeInactive` parameter (at the moment the list shows only active ones).

## 12.7. Website content: pages and blog

The SEO title, the page's SEO description and the blog post summary are filled in in four languages (language switch next to the field). On saving, all languages are sent at once, so translations are not lost, and a cleared field is actually cleared. Structured JSON-LD data, if the page has any, is saved unchanged.

## 12.8. Settings and passwords

**System → Settings** holds the company's general data, taxes, the fiscal printer, security, notifications and integrations. Only the administrator can change integration keys. After saving, the keys are shown masked: only the last 4 characters are visible. If you leave a key field empty, the saved key does not change.

The **"General"** tab saves only what has changed: a field you cleared is deleted on the server (previously it came back after saving), and the other sections are not affected. Links to Facebook, Instagram and TikTok are accepted only in full, with `https://`; they appear as icons in the footer of the customer website.

The minimum password length in the system is **12 characters**. The requirement applies everywhere: when creating an employee, when resetting a password and in the security settings. A lower value cannot be set.

When creating an employee account, there are two ways to set the password:

- **E-mail invitation.** The employee sets their own password and confirms the address. Until then, they cannot sign in.
- **The administrator sets the password.** The address is considered confirmed. You can mark the password as temporary: it must then be changed at the first sign-in.

The form also has: **hire date** (mandatory, today by default), position, department (management, kitchen, floor, delivery, accounting, IT), roles (the first selected is the primary one) and a PIN for the till. Employees choose the interface language themselves in the top right corner; it is not stored in the card.

![Creating an employee: invitation or administrator password](https://docs.smaklad.pl/img/system-05-staff-create.png)

**System → Integrations** shows which integrations are fully configured, which partially and which not at all. The "Configure" button leads to the integrations tab in the settings.

![Integration status](https://docs.smaklad.pl/img/system-06-integrations.png)

![Confirming payment of a single payslip](https://docs.smaklad.pl/img/system-07-payslip-pay-confirm.png)

![New contract](https://docs.smaklad.pl/img/system-08-contract-new.png)
