Rules behavior
Documented against app commit ed7d6935. The same text lives in docs/agent/rules.md in the app repo.
Rules and bank CSV
Section titled “Rules and bank CSV”Rules, copy rules, cleanup rules, momskoder, and Import Bank CSV. Bank import lives here because finishing a bank line creates and applies a rule. The bilag it produces is docs/agent/transactions.md.
Imports\oldBankBogforingController is not routed. On Imports\BankBogforingController, update_old, exclude, and the commented store are not routed. Do not extend them. The live bank methods are index, store, type, display, update, and edit.
Screens
Section titled “Screens”| Path | View | What it is |
|---|---|---|
GET /rules | resources/views/pages/rules/index.blade.php | Rule list. |
GET /rules/add and GET /rules/{id} | resources/views/pages/rules/form.blade.php | Create and edit. |
GET /rules/copy | resources/views/pages/copyrule/index.blade.php | Copy rules onto another company or year. |
GET /cleanup | resources/views/pages/cleanups/index.blade.php | Cleanup rules. |
GET /settings/momskode | resources/views/pages/momskode/index.blade.php | Momskoder. |
GET /bogforings/importbank | resources/views/pages/imports/bankbogforings/index.blade.php | Upload a bank CSV. |
POST /bogforings/importbank/type | resources/views/pages/imports/bankbogforings/type.blade.php | Map columns. |
POST /bogforings/importbank/display | resources/views/pages/imports/bankbogforings/display.blade.php | New rows against what is already posted. |
GET /bogforings/importbank/{id} | resources/views/pages/imports/bankbogforings/edit.blade.php | Finish each line: type, konto, modkonto, rule. |
Middleware for rules, copy, and cleanup: module:rule or module:cleanup, plus account and year. Momskode is module:momskode and does not require a year. Bank import uses module:bogforing, account, and year.
Off-screen
Section titled “Off-screen”POST /rules/add (RuleController@save) stores the match text, the bogføring type, leverandør or kunde, konto, modkonto, and momskode. GET /rules/delete/{id} removes one rule. The form script public/js/rule.js can create the party in place with POST /api/leverandorers or POST /api/kunders.
The bank edit script and the daybook also call:
| Call | Effect |
|---|---|
POST /api/rules | Api\RuleController@save. Creates or updates the rule for the line just booked. |
POST /api/rules/get-rules | Returns rules that match the current text, for the picker. |
POST /api/rules/batch-update | Applies one rule onto many bank lines. |
GET /api/rules/delete/{id} | Deletes a rule from the edit screen. |
POST /rules/copy (CopyRuleController@store) copies the selected rules onto the target company. It does not post bilag.
POST /cleanup and POST /cleanup/{id} store a cleanup rule (match text, optional regex via is_regex, replacement). GET /cleanup/delete/{id} removes it. POST /api/cleanup (Api\CleanupController@store) is what public/js/cleanup.js calls from this page and from bogføring cleanup. GET /api/cleanup/test is not used.
Applying a rule to existing daybook rows is BogforingController@groupUpdate, documented in docs/agent/bogforing.md.
Momskode
Section titled “Momskode”POST /settings/momskode and POST /settings/momskode/{id} store the code, VAT percent, and the konto numbers VAT posts to. A momskode with a second konto is what momskodeDoubleMap represents. BogforingTransactionService::store uses the first konto for the type 3 or 4 line and, when the second exists, writes an extra line with the opposite sign. Changing VAT does not rewrite old lines.
Bank CSV
Section titled “Bank CSV”GET /bogforings/importbank is the file form. POST /bogforings/importbank/type opens the column mapper (date, text, amount, delimiter, saldo). POST /bogforings/importbank (store) saves the column map on bank_csv_configs and, for type custom, a bank_csv_types row for this company. An empty file redirects back with “No data found in the file”.
POST /bogforings/importbank/display compares the file with existing rows and shows which lines are new. Grey rows are matches and will be ignored. POST /bogforings/importbank/update writes a bank_csvs header, a csv_saldos row, and one inactive bogføring per unmatched line through BogforingService::storeBankCsvRows (is_active = 0, is_bogfo_visible = 0, category Daglig, type Finansbilag). It then redirects to GET /bogforings/importbank/{id}.
edit lists those draft headers. The script posts:
| Call | Effect |
|---|---|
POST /api/bankbogforing/compare | Checks the line against existing bilag before save. |
POST /api/bankbogforing/update | Api\BankBogforingController@update completes one line. |
POST /api/bankbogforing/batch-update | Completes many lines with the same type and konto. |
Completion runs BogforingService::updateBankBogforingPost, which sets is_active = 1 and is_bogfo_visible = 1, then buildBankBogforingTransactions and simplifiedStore so the lines match a manual bilag. Saving also posts the rule through /api/rules, which is why the next file with the same text can be filled in.
public/js/imports/express.js, rule2.js, and modalCleanup.js belong to the unrouted old bank blades. The live edit page loads public/js/imports/bankbogforing/edit.js only.