# Cleanup: remaining `productionrules` references

These files still reference the old `productionrules` module name and must be updated
before `rules.php` / `salesorder_rules.php` work independently of the old module.

---

## 1. Rights checks — `productionrules` → `routingmanager`

Rights key `$user->rights->productionrules->X` must become `$user->rights->routingmanager->X`.
The corresponding right IDs in `modRoutingManager.class.php` must also match.

| File | Lines | Old right | New right |
|---|---|---|---|
| `rules.php` | 16, 57, 75, 108, 136, 150, 197, 226, 544, 561, 606, 639, 706 | `productionrules->read/write/config/generate_bom` | `routingmanager->routing_read/routing_write/config/…` |
| `salesorder_rules.php` | 14 | `productionrules->read` | `routingmanager->routing_read` |
| `class/ruleset.class.php` | 135 | `productionrules->viewallrulesets` | `routingmanager->viewallrulesets` (or admin-only) |
| `class/soruleset.class.php` | 15 | `productionrules->viewallrulesets` | same |

New right `generate_bom` and `viewallrulesets` may need to be **added** to `modRoutingManager.class.php`.

---

## 2. Lang file load

| File | Line | Old | New |
|---|---|---|---|
| `rules.php` | 14 | `$langs->load("productionrules@productionrules")` | `$langs->load("routingmanager@routingmanager")` |
| `salesorder_rules.php` | 12 | same | same |

Requires creating `langs/en_US/routingmanager.lang` with all used string keys.

---

## 3. CSS / JS / AJAX paths — `/custom/productionrules/…` → `/custom/routingmanager/…`

### `rules.php`
- Line 461: `productionrules/css/productionrules.css` → `routingmanager/css/routingmanager.css`
- Line 463: `productionrules/css/productionrules_flow.css` → `routingmanager/css/routingmanager_flow.css`
- Line 465: `productionrules/css/productionrules_flow_mobile.css` → `routingmanager/css/routingmanager_flow_mobile.css`
- Line 473–476: all `productionrules/ajax/…` → `routingmanager/ajax/…`
- Line 483–484: `productionrules/js/productionrules_flow.js` / `productionrules_ui.js` → `routingmanager/js/…`
- Line 467: `id="productionrules-page"` — HTML id, update corresponding CSS selectors too

### `salesorder_rules.php`
- Line 462: CSS path
- Line 636: `getproducts.php` AJAX path
- Line 638: `productionrules_ui.js` path

### `routing.php`
- Line 394: `routingmanager/css/productionrules.css` → `routingmanager/css/routingmanager.css`

### `core/modules/modRoutingManager.class.php`
- Line 34: `css/productionrules.css` → `css/routingmanager.css`

---

## 4. PHP `dol_include_once` paths

| File | Line | Old | New |
|---|---|---|---|
| `salesorder_rules.php` | 8 | `/productionrules/class/soruleset.class.php` | `/routingmanager/class/soruleset.class.php` |
| `salesorder_rules.php` | 9 | `/productionrules/class/ruleset.class.php` | `/routingmanager/class/ruleset.class.php` |

---

## 5. CSS/JS file renames needed

These physical files in `css/` and `js/` still have the old prefix in their filenames.
Rename + update all `<link>` / `<script>` references together:

- `css/productionrules.css` → `css/routingmanager.css`
- `css/productionrules_flow.css` → `css/routingmanager_flow.css`
- `css/productionrules_flow_mobile.css` → `css/routingmanager_flow_mobile.css`
- `js/productionrules_flow.js` → `js/routingmanager_flow.js`
- `js/productionrules_ui.js` → `js/routingmanager_ui.js`

---

## 6. Comments only (safe to leave, low priority)

- `admin/import_routing.php:10` — old file path in doc comment
- `ajax/add_steporder.php:5` — old module name in path comment
- `class/routing_rules.class.php:574,838,1047,1080` — mentions of "productionrules" in docblocks

---

## 7. HTML id attribute

`rules.php:467` — `id="productionrules-page"` is used in CSS selectors.
Rename to `id="routingmanager-page"` and update all `#productionrules-page` selectors in CSS/JS.
