Commit Graph

61 Commits

Author SHA1 Message Date
luka.2526 ff2bad24c9 Subir presentacion 2026-05-28 18:15:41 +00:00
luka.2526 d5e0b9a119 Eliminar archivo 2026-05-28 18:14:02 +00:00
luka.2526 55d21c8ef0 Creación carpeta presentacion 2026-05-28 18:13:13 +00:00
luklpz df3775d96b fix: map Dolibarr tva_tx to PS id_tax_rules_group on product sync
Price with VAT was showing the same value as price without VAT because
id_tax_rules_group was hardcoded to 1 (no-tax group in this PS instance).

Now reads tva_tx from Dolibarr product, resolves the PS tax rule group
via a configurable map (integration.prestashop.tax-rule-groups), and
sets the correct group in the product XML. Defaults to
default-tax-rules-group-id when no mapping is found.

ES groups configured: 21% → 53, 10% → 54, 4% → 55.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:48:04 +02:00
Mireya Serrano c59d2048db Actualización URLs en apps 2026-05-28 12:47:59 +02:00
Mireya Serrano 4bf6b77c6c products 2026-05-26 17:06:07 +02:00
Mireya Serrano 8d4ebb36e1 productos... 2026-05-26 16:54:50 +02:00
Mireya Serrano 7aa6e7f767 product descriptions and etc. 2026-05-26 16:43:52 +02:00
Mireya Serrano a719e83ce7 delete products 2026-05-26 16:27:25 +02:00
Mireya Serrano f57eb9e924 Product deleted 2026-05-26 16:16:17 +02:00
Mireya Serrano e32e84ac4a product sync 2026-05-25 12:29:10 +02:00
Mireya Serrano 29ae19cbba Merge remote-tracking branch 'origin/main' 2026-05-25 12:18:20 +02:00
Mireya Serrano bc858122af sincronización de producto ha empezado a fallar 2026-05-25 12:17:54 +02:00
mireya-sp 86c12556e5
d 2026-05-24 19:23:34 +02:00
Mireya Serrano abe534f4da uf 2026-05-24 19:19:05 +02:00
Mireya Serrano 411ad0a7d3 aaaaaaaa 2026-05-24 18:58:11 +02:00
Mireya Serrano c3c5b22b12 addresses 2026-05-24 18:44:34 +02:00
Mireya Serrano 877cb594b2 direcciones... 2026-05-24 18:25:10 +02:00
Mireya Serrano f4cf440ff0 Direcciones actualizables 2026-05-24 14:11:23 +02:00
Mireya Serrano a7c8242936 Multiples direcciones para clientes 2026-05-24 13:52:33 +02:00
Mireya Serrano e2b6966cef Manejo de direcciones de cliente 2026-05-24 13:22:30 +02:00
Mireya Serrano 51959292e0 cliente más completo 2026-05-24 12:49:35 +02:00
luklpz 300714c6c1 chore: trigger redeploy 2026-05-23 20:07:39 +02:00
luklpz c02e771f0a fix(orders): copy order lines into invoice on creation
POST /invoices with only fk_commande+socid creates an empty invoice.
Lines must be included in the request body explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 15:39:10 +02:00
luklpz 312829e5f4 chore: remove Claude Code entries from .gitignore 2026-05-18 19:12:49 +02:00
luklpz e501d83c73 fix(sync): push stock immediately on new product creation
ProductSyncService now calls pushInitialStock() after creating a new
product in PrestaShop, so stock is correct without waiting for the next
StockSyncService run. Failures are caught and logged as warnings — the
product mapping is saved as SYNCED regardless, and StockSyncService will
correct any discrepancy on its next scheduled run.

Also applies the PS 8.2.5 false-instead-of-empty-array workaround to
getStockAvailableForProduct(), consistent with getProductByReference().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 18:27:17 +02:00
luklpz a5feff6a1a docs: expand documentation with sequence diagrams, dificultades, conclusion and improvements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 20:35:24 +02:00
luklpz 6df78d7880 docs: add comprehensive technical documentation for TFG
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 20:24:50 +02:00
luklpz 292eca2b4a fix: pin maven to 3.9.9 via .mise.toml to fix Railway build
maven@3.9.16 does not exist in the archive; railpack auto-detected wrong version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 20:16:52 +02:00
luklpz 1193c2d888 docs: add project README with architecture, setup and API reference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 20:14:58 +02:00
luklpz 7eb17a8da2 feat(javafx-client): redesign UI to match Android app and fix functional bugs
- Add typed DTOs (SyncLogResponse, ProductMappingResponse, OrderMappingResponse,
  SyncTriggerResponse, AppSettings) replacing fragile Map<String,Object> API
- Add SettingsStore (java.util.prefs) for persistent credentials across sessions
- Add DateUtils for relative time, duration, localized status labels
- Add LogDetailDialog (modal Stage) with status banner and error details
- Rewrite DashboardController: 3 sync cards, last log info, sync-all with progress,
  30s auto-refresh
- Rewrite ProductsController: SKU search, filter chips, status chips, typed table
- Rewrite OrdersController: typed table, status chips, Spanish labels
- Rewrite LogsController: filter chips, status icons, click row opens LogDetailDialog
- Rewrite SettingsController: password toggle, test connection, save to SettingsStore
- Rewrite LoginStage: pre-fill from SettingsStore, Material 3 card layout
- Rewrite MainStage: 5 tabs (Panel/Productos/Pedidos/Historial/Ajustes), blue header
- Rewrite SyncServiceClient to return typed DTOs via Jackson ObjectMapper
- Rewrite SessionManager to load/save settings via SettingsStore
- Rewrite styles.css: Material 3 palette matching Android app
- Fix logback.xml package name (javafx_client -> javafxclient)
- Fix dashboard showing oldest log instead of newest (putIfAbsent)
- Fix wrong API field names (processed/failed -> itemsProcessed/itemsFailed)
- Remove unused javafx-fxml, javafx-swing deps and broken maven-shade-plugin
- Add javafx-client/.gitignore and remove target/ from tracking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 20:12:44 +02:00
luklpz 0d32497abd fix: set state=1 in product XML so PS 8 admin list shows synced products
PS 8 introduced a state column (0=draft, 1=published). Products created
via Webservice without state default to 0, making them invisible in the
admin product list (which filters state=1 only). The storefront does not
check state, so products appeared there but not in admin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 19:04:24 +02:00
luklpz fe7be5fc80 fix: set id_shop=1 in stock_available XML to fix OUT OF STOCK display
PS Webservice creates stock_available records with id_shop=0 when
products are created via API. The PS frontend reads id_shop=1 records
for stock display in a single-shop setup, causing OUT OF STOCK to appear
even when quantity > 0. Adding id_shop=1 to the XML ensures stock updates
target the correct shop-specific record.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:56:06 +02:00
luklpz 9c16d45c0e fix: add category associations to product XML for PS shop context
Including <associations><categories> in the product XML triggers
Product::addToCategories() in PS, which may also invoke the shop
association logic needed to populate ps_product_shop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:27:30 +02:00
luklpz 776e761a94 fix: catch RestClientException in getProductByReference for PS false response
Spring 6 RestClient wraps HttpMessageNotReadableException (thrown when
deserializing {"products":false}) into RestClientException with message
"Error while extracting response for type [...]". The previous fix only
caught HttpMessageConversionException directly, missing the wrapper.

PrestashopApiException is not a RestClientException, so 4xx/5xx error
handling is unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:19:31 +02:00
luklpz ca7948d6e6 fix: handle PS 8.x {"products":false} response in getProductByReference
PS 8.2.5 returns {"products": false} instead of {"products": []}
when a reference filter finds no matching products. Jackson cannot
deserialize false as a List, throwing HttpMessageConversionException.
Catch it and return Optional.empty() so pushProduct takes the CREATE
path correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:12:21 +02:00
luklpz 9fd11219af feat: add DELETE /api/mappings/products/{id} for broken mapping cleanup
Deletes the PS product via Webservice and removes the local mapping.
Use this to clean up incomplete PS products (missing ps_product_shop
entry) that block re-creation on next sync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:07:42 +02:00
luklpz 9926f37015 fix: add missing PS shop association fields in product XML
Products created via PS Webservice were missing the ps_product_shop
table entry, causing them to be invisible in PS admin (which queries
products with INNER JOIN ps_product_shop). Adding id_shop_default=1
forces PS to create the shop association on product create/update.

Also add available_for_order, show_price, and visibility=both to
ensure products are fully configured for catalog display.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:54:59 +02:00
luklpz 83bd37efa9 fix: filter only active products in getProductByReference
PS soft-deletes products (sets active=0) when deleted from admin,
keeping them in the DB. The previous filter returned those inactive
products, causing pushProduct to take the UPDATE path and silently
re-update a soft-deleted product that remains invisible.

Adding filter[active]=[1] ensures only visible products are matched.
Products deleted in PS are now correctly re-created on next sync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:43:10 +02:00
luklpz 60dba82f32 fix: use PS as source of truth in product sync; fix active default
ProductSyncService now queries PS by reference before deciding
create vs update, preventing stale local mappings from causing
silent no-ops when PS products are deleted externally.

Also fix active field default: tosell=null now maps to active=1
instead of active=0, so products without an explicit sell flag
are created as visible in PrestaShop.

Add server.forward-headers-strategy=framework so Spring reads
X-Forwarded-Proto from Railway's reverse proxy; fixes Swagger UI
generating http:// URLs instead of https://.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:37:00 +02:00
mireya-sp f50f64dcdf
Merge pull request #1 from luklpz/develop
DesktopClient con JavaFx
2026-05-15 17:25:15 +02:00
Mireya Serrano ee1e9b8a73 Code Debloat 2026-05-15 17:21:20 +02:00
Mireya Serrano ff8c2f9a82 DesktopClient con JavaFx 2026-05-15 16:51:26 +02:00
luklpz 8d6c69d47b feat: add Android client app (Kotlin + Jetpack Compose)
Kotlin Android app consuming the sync-service REST API.
Screens: Dashboard (manual sync triggers), Logs, Log detail,
Product/Order mappings, Settings (server URL + Basic Auth).
Stack: Retrofit + OkHttp, Hilt DI, DataStore, Navigation Compose.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 12:48:54 +02:00
luklpz b55805665b fix: change DolibarrOrderDto.dateCommande to String
Dolibarr GET /orders/{id} returns date fields as ISO strings, not
Unix timestamps, causing Jackson Long deserialization to fail.
String handles both: sends epoch string in POST body (Dolibarr accepts
it); ignores the date_commande string in GET via @JsonIgnoreProperties.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 08:26:16 +02:00
luklpz c5d36bf051 fix: use "date" field name for Dolibarr order creation
Dolibarr POST /orders requires field named "date" (not "date_commande").
Add @JsonAlias("date_commande") so GET responses are still deserialized
correctly when the response uses the alternative field name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 08:19:28 +02:00
luklpz db4db1741d fix: handle Dolibarr/PS 404 on empty filter results
Both APIs return 404 (not 200+empty) when a filter finds no results.
Catch DolibarrApiException(404) in getOrCreateThirdparty and
getProductByRef; catch PrestashopApiException(404) in
getProductByReference — treat as empty/not-found instead of error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 08:14:21 +02:00
luklpz fa20b7cc91 fix: add out_of_stock to stock XML; remove invalid date_add order filter
- PrestashopClient.toStockAvailableXml: add out_of_stock=2 (use shop
  default) — PS 8.2.5 returns 400 code 41 without this field
- PrestashopClient.getOrdersSince: remove filter[date_add] — PS 8.2.5
  does not expose date_add as a filterable field for orders (400 code 32)
  Re-import prevention handled by OrderMapping.existsByPrestashopOrderId

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 08:10:00 +02:00
luklpz aeec27f7af fix: correct Dolibarr/PS filters and handle guest orders
- DolibarrClient.getProductByRef: use sqlfilters=(t.ref:=:'x') instead
  of unsupported ref query param (caused StockSync to push wrong stock)
- PrestashopClient.getProductByReference: wrap value in [x] for PS
  exact-match filter syntax (root cause of createProduct returning null)
- OrderSyncService.resolveCustomer: skip getCustomer when id_customer
  is 0 or null (guest orders returned 404 and failed import)
- StockSyncService: parse stock quantity as Double to handle "5.000"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 08:05:18 +02:00
luklpz 22c92a1ee2 fix: throw PrestashopApiException instead of NPE when createProduct returns null
If PS accepts the POST but the subsequent GET by reference finds nothing,
the null return from createProduct now throws PrestashopApiException, which
is caught by the per-item handler and recorded in SyncLog without aborting
the rest of the sync loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 23:51:36 +02:00