=== Cenariu Orders & Inventory Barcode ===
Requires at least: 6.5
Requires PHP: 8.1
Requires Plugins: cenariu-orders-inventory
Tested up to: 7.1
Stable tag: 0.2.2
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Optional barcode selection in existing Cenariu order intake and goods receipt forms.

== Description ==

Requires Cenariu Orders & Inventory Free 0.36.5 or later. PRO is optional. This separate module does not modify the Free plugin files or require WooCommerce.

An inventory manager associates EAN-13, EAN-8 and printable ASCII Code 128 strings with existing products in Orders & Inventory > Barcodes. EAN check digits are validated. SKU remains independent. The same code cannot identify two products within a company; separate companies may use the same code independently. A product can have several associated codes. Deactivation retains the association and audit; reactivation requires the same code, format and product.

Order intake shows a compact cart beside the camera. On phones, active camera and scrollable cart share a viewport-height panel with a visible Next step button. Scan successive products, edit quantities directly in the cart, remove unwanted selections, then choose Next step for customer details and final review. Whole-unit products start at one per scan; fractional-step products require a quantity in the cart. Manual product choice and keyboard-reader/manual code entry remain in collapsible sections. Camera stays on between scans; repeated frames of the same code are ignored. Remove the code from view for at least one second before scanning the same code again (minimum1.6seconds between accepted identical reads).

Successful additions show a prominent confirmation and highlight the product row. A short locally generated beep and vibration are attempted where browser/device policy permits; visual confirmation always remains. No microphone or external audio file is used. On phones the camera panel acts as a dialog, with Escape/Stop to close and keyboard focus cycling inside it.

The existing simple stock receipt and multi-product supplier receipt forms retain quantity added per scan (default1). Their camera and barcode-association camera remain one-shot. Confirm the existing form to save. No automatic order creation, delivery, stock adjustment or payment is triggered by scanning.

USB/Bluetooth readers must operate in keyboard-wedge/HID mode with an Enter suffix. Focus the module barcode field before scanning. Direct Bluetooth pairing, proprietary scanner protocols and serial-port APIs are not included.

Camera decoding runs locally with bundled ZXing; no external lookup database or camera service. HTTPS and explicit browser/OS camera permission are required. Device/browser quality, focus and lighting affect recognition. Manual entry remains available. Camera frames are not uploaded or stored; only the decoded text is sent to the authenticated site lookup endpoint. Camera stops at Next step, Stop, form submission, leaving or hiding the page; outside order intake it also stops on the first result. Microphone access is not requested.

Unknown codes do not create products or change stock. Ask an inventory manager to create/select the product in the existing catalog and associate its code. No automatic name, price, lot or expiry lookup. No label generation, variable-weight/price barcode parsing, GS1 application identifiers or serial/lot tracking. Enter quantity/weight manually in the product's unit and step. Code128 leading zeroes and case are preserved; surrounding whitespace is trimmed.

Requires per-site activation, 64-bit PHP and InnoDB. Company scoping and nonce context use the Free Accounts API1.0 and optional Hosting provider. No shared-ledger fallback when company access is unavailable. Order intake and receipt compatibility targets the existing Free0.36.5 markup; future major UI changes require retesting this addon.

English source text and bundled Romanian translation. Authorized operators may look up active products; only inventory managers can manage barcode associations. No public or unauthenticated scanner endpoint.

== Installation ==

1. Back up the full WordPress database and test on a staging site.
2. Activate Free0.36.5 or later, then this module per site.
3. Open Orders & Inventory > Barcodes and associate a valid code with an active product.
4. Open order intake, start the camera and scan products into the cart. For a keyboard reader open Reader or manual barcode entry and focus the barcode field. Edit quantities in the cart before Next step. Receipt forms retain quantity before scanning.
5. Check the product and quantity, then save through the existing form.

== Data and backup ==

Stores barcode/product/company associations and association activation/deactivation events (time and WordPress operator id) in two module-owned tables. No changes to existing Free tables during lookup or association. Actual saved orders and receipts remain under the Free ledger's existing validation, stock rules, transaction and audit controls.

The Free ledger JSON backup does NOT include these two module tables. Use a full WordPress database backup. Restoring an older or unrelated Free-only JSON ledger with this module's old associations can mismatch product ids; restore a coherent full database or recheck all associations before scanning. Database administrators can access these records. Deactivation/uninstall retains data; no automatic erasure or schema downgrade.

== Third-party source ==

Local @zxing/browser0.2.1 distribution with readable bundle, embedded-source maps and license notices in vendor/. See vendor/README.md. No CDN, telemetry or external lookup calls.

== Changelog ==

= 0.2.2 =
* Read-only extension API exports active company barcode mappings for explicit offline preparation. The existing scanner flow is unchanged.

= 0.2.1 =
* Keep active phone camera and cart within one screen; add prominent scan confirmation, optional device beep/vibration and editable cart quantities before Next step.

= 0.2.0 =
* Compact order-intake cart beside the continuous camera, removable selections and next-step quantities. Manual product selection and barcode entry remain available.

= 0.1.1 =
* Add tested WordPress version metadata and document justified direct-table access and bundled translation loading. Barcode behavior unchanged.

= 0.1.0 =
* First local candidate: barcode association, keyboard reader, one-shot camera and integration in existing order/receipt forms.
