Uses wbc_location_code setting on all order lines including shipping.
Header-level location to be handled by BC extension post-processing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PATCH salesOrders status to 'Released' after creation and line items.
Controlled by Auto-Release Order checkbox in Order Settings.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Search BC customers by taxRegistrationNumber (NIF/CIF from _nif meta)
- If NIF found in BC, use that customer; if not, create with NIF
- If no NIF on order, use configurable default customer number
- Add Default Customer Number setting in Order Settings tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BC OData filter options are in English (Draft/Active/Inactive),
not the localized display values.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Source_Type (not Assign_to_Type), Status='Activo' and
Source_Type='Todos los clientes' (Spanish enum values from BC).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace broken itemLedgerEntries approach with custom ItemByLocation
OData V4 endpoint for location-specific stock. Add ListaPrecios
endpoint for price list sync (B2C regular, B2C_OF sale price) with
filters for active status and all-customers assignment.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reversed the product sync direction: instead of pulling all 60k+ items
from BC and matching against WooCommerce (600+ paginated API calls that
timeout), now iterates the ~100 WooCommerce products and queries BC for
each one by GTIN/item number (1-2 API calls per product).
Added Location Code setting (e.g. "ICP") to filter stock by BC location.
Uses Item Ledger Entries endpoint to sum per-location stock. Falls back
to total inventory if the endpoint is unavailable.
Also registered wbc_location_code in sync settings group and uninstall.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two bugs fixed:
1. sanitize_text_field() was stripping special characters from Azure AD
client secrets (e.g. %XX sequences, angle brackets). Replaced with
trim() to preserve the raw secret before encryption.
2. All settings tabs shared one option group (wbc_settings), so saving
from any tab would trigger sanitize callbacks for ALL settings. This
caused checkboxes on other tabs to reset to 'no' and could interfere
with the client secret. Split into per-tab groups: wbc_connection,
wbc_sync, wbc_orders.
Also clears OAuth token cache when client secret is changed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Native PHP plugin (no Composer) that syncs:
- Product stock and pricing from BC to WooCommerce (scheduled cron)
- Orders from WooCommerce to BC (on payment received)
- Auto-creates customers in BC from WooCommerce billing data
Product matching: WooCommerce SKU → BC Item Number, fallback to GTIN (EAN).
OAuth2 client credentials auth with encrypted secret storage.
Admin settings page with connection test, manual sync, and log viewer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>