# TODO: Clone product routing

## Feature request

Add a **Clone Routing** option in the Product Routing Editor (`routing.php`).

## Use case

When a new product revision is created (e.g. FG1116-04 from FG1116-03), the routing
is identical or very similar. Instead of importing a full CSV or adding ops one by one,
the user should be able to clone the complete routing from another product ref.

## Proposed UX

- On the product detail view (when routing exists), add a "Clone from..." button in the header actions bar.
- On the product detail view (when routing is **empty**), show a more prominent "Copy routing from another product" panel (already partially in place as the copy-source prefill).
- The clone dialog: text input for source product ref (with autocomplete via existing `/ajax/getproducts.php`), confirm button.

## Implementation notes

- Source: all active rows from `llx_productionrules_routing` + their `llx_productionrules_routing_wc` links.
- Target: insert new rows for `$fk_product_target` with same `op_no`, `label`, `routing_instructions`, `inspection_notes`, `sfdc_op_notes`, `subcontract`, `subcon_code`, `active`.
- Skip rows that already exist on target (dedup by `fk_product + op_no + label`).
- Clone workstation links too (`fk_routing` → new rowid, same `fk_workstation`).
- Do NOT copy routing confirmation — new product starts as NOT CONFIRMED.
- Wrap in `$db->begin() / $db->commit()`.
- Log: show summary (X ops cloned, Y skipped, Z workstation links added).

## Priority

Low — workaround is CSV import.
