Commit Graph

67 Commits

Author SHA1 Message Date
Claude Agent
3208804966 style(ui): move invoice info to right column, single line, no bold
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 17:43:23 +00:00
Claude Agent
8827782aca fix(invoice): require factura_data in cache to avoid missing invoice date
Orders cached before the factura_data column was populated show "-"
for invoice date. Now both detail and dashboard endpoints require
factura_data to be present before using SQLite cache, falling through
to Oracle live query which fetches and caches the date.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 17:40:30 +00:00
Claude Agent
84b24b1434 feat(invoice+import): refresh facturi, detalii factura, fix duplicate CODMAT + rollback
- PL/SQL: handle duplicate CODMAT in nom_articole with MAX(id_articol)
- import_service: add explicit conn.rollback() on Oracle errors
- sync_service: auto-fix stale ERROR orders that exist in Oracle
- invoice_service: add data_act (invoice date) from vanzari table
- sync router: new POST /api/dashboard/refresh-invoices endpoint
- order detail: enrich with invoice data (serie, numar, data factura)
- dashboard: refresh invoices button (desktop + mobile icon)
- quick map modal: compact single-row layout, pre-populate existing mappings
- quick map: link on SKU column instead of CODMAT

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 17:30:23 +00:00
Claude Agent
43327c4a70 feat(oracle): support per-article id_pol in PACK_IMPORT_COMENZI + deploy docs
- PACK_IMPORT_COMENZI: reads optional "id_pol" per article from JSON, uses it
  via NVL(v_id_pol_articol, p_id_pol) — enables separate price policy for
  transport/discount articles vs regular order articles
- README.md: add Windows deploy section (deploy.ps1, update.ps1, .env example)
- CLAUDE.md: add reference to Windows deploy docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 16:42:41 +00:00
Claude Agent
227dabd6d4 feat(settings): add GoMag API config, Oracle dropdowns, compact 2x2 layout
- Remove ID_GESTIUNE from config (unused)
- Add GoMag API settings (key, shop, days_back, limit) to SQLite — editable without restart
- sync_service reads GoMag settings from SQLite before download
- gomag_client.download_orders accepts api_key/api_shop/limit overrides
- New GET /api/settings/sectii and /api/settings/politici endpoints for Oracle dropdowns
  (nom_sectii.sectie, crm_politici_preturi.nume_lista_preturi)
- id_pol, id_sectie, transport_id_pol, discount_id_pol now use select dropdowns
- order_reader extracts discount_vat from GoMag JSON discounts[].vat
- import_service uses GoMag discount_vat as primary, settings as fallback
- settings.html redesigned to compact 2x2 grid (GoMag API | Import ROA / Transport | Discount)
- settings.js v2: loadDropdowns() sequential before loadSettings()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 16:39:59 +00:00
Claude Agent
a0649279cf log 2026-03-16 15:51:15 +00:00
Claude Agent
db29822a5b fix(js): add ROOT_PATH to window.location navigations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:25:43 +00:00
Claude Agent
49471e9f34 fix(js): patch fetch to prepend ROOT_PATH for IIS reverse proxy
All relative /api/... calls automatically get /gomag prefix via
global fetch wrapper in shared.js. ROOT_PATH injected from template.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:19:50 +00:00
Claude Agent
ced6c0a2d4 fix(templates): use root_path for static assets instead of url_for
url_for generates absolute URLs with internal host (localhost:5003)
which browsers block via ERR_BLOCKED_BY_ORB. Using root_path prefix
generates correct relative paths (/gomag/static/...).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:15:56 +00:00
Claude Agent
843378061a feat(deploy): add update.ps1 for Windows server updates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:07:13 +00:00
Claude Agent
a9d0cead79 chore: commit all pending changes including deploy scripts and Windows config
- deploy.ps1, iis-web.config: Windows Server deployment scripts
- api/app/routers/sync.py, dashboard.py: router updates
- api/app/services/import_service.py, sync_service.py: service updates
- api/app/static/css/style.css, js/*.js: UI updates
- api/database-scripts/08_PACK_FACTURARE.pck: Oracle package
- .gitignore: add .gittoken
- CLAUDE.md, agent configs: documentation updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:05:04 +00:00
Claude Agent
ee60a17f00 fix(templates): use url_for for static assets and root_path for nav links
Fixes 404 errors for CSS/JS when served behind IIS reverse proxy with
/gomag prefix. Replaces hardcoded /static/ paths with request.url_for()
and nav links with request.scope root_path prefix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:04:03 +00:00
Claude Agent
926543a2e4 fix(mappings): resolve 409 error on multi-CODMAT edit and make SKU editable
Batch create after soft-delete was rejected because create_mapping()
treated soft-deleted records as conflicts. Added auto_restore param
that restores+updates instead of 409 when called from edit flow.
Also removed readOnly on SKU input in edit modal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 13:31:03 +00:00
Claude Agent
25aa9e544c feat(sync): add delivery cost, discount tracking and import settings
Parse delivery.total and discounts[] from GoMag JSON into new
delivery_cost/discount_total fields. Add app_settings table for
configuring transport/discount CODMAT codes. When configured,
transport and discount are appended as extra articles in the
Oracle import JSON. Reorder Total column in dashboard/logs tables
and show transport/discount breakdown in order detail modals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:15:17 +00:00
Claude Agent
137c4a8b0b feat(ui): order totals, decimals, mobile modal cards, set editing
- Dashboard/Logs: Total column with 2 decimals (order_total)
- Order detail modal: totals summary row (items total + order total)
- Order detail modal mobile: compact article cards (d-md-none)
- Mappings: openEditModal loads all CODMATs for SKU, saveMapping
  replaces entire set via delete-all + batch POST
- Add project-specific team agents: ui-templates, ui-js, ui-verify,
  backend-api
- CLAUDE.md: mandatory preview approval before implementation,
  fix-loop after verification, server must start via start.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 21:55:58 +00:00
Claude Agent
ac8a01eb3e chore: add .playwright-mcp to gitignore
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:21:17 +00:00
Claude Agent
c4fa643eca feat(sync): add order_total field to SQLite tracking
Parse order total from GoMag JSON, store in SQLite orders table,
and expose via sync run API. Enables total display in mobile flat rows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:20:57 +00:00
Claude Agent
9a6bec33ff docs: rewrite CLAUDE.md and README.md, remove VFP references
- Remove all Visual FoxPro references (VFP fully replaced by Python)
- Add TeamCreate workflow for parallel UI development
- Document before/preview/after visual verification with Playwright
- Add mandatory rule: use TeamCreate, not superpowers subagents
- Update architecture, tech stack, project structure to current state
- Update import flow to reference Python services

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:20:36 +00:00
Claude Agent
680f670037 feat(ui): mobile UI polish with segmented controls and responsive navbar
- Replace filter pills with btn-group segmented controls on mobile (all pages)
- Add renderMobileSegmented() shared utility with colored count badges
- Compact sync card and logs run selector on mobile
- Unified flat-row format: dot + date + name + count (0.875rem throughout)
- Responsive navbar with short labels on mobile (Acasa/Mapari/Lipsa/Jurnale)
- Vertical dots icon (bi-three-dots-vertical) without dropdown caret
- Shorter "Mapare" button text on mobile, Re-scan in context menu
- Top pagination on logs page, hide per-page selector on mobile
- Cache-bust static assets to v=5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:20:24 +00:00
Claude Agent
5a0ea462e5 fix(validation): remove non-existent find_new_orders call
Replace broken asyncio.to_thread call with len(importable)
which already represents orders ready to process.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:59:05 +00:00
Claude Agent
452dc9b9f0 feat(mappings): strict validation + silent CSV skip for missing CODMAT
Add Pydantic validators and service-level checks that reject empty SKU/CODMAT
on create/edit (400). CSV import now silently skips rows without CODMAT and
counts them in skipped_no_codmat instead of treating them as errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:46:59 +00:00
Claude Agent
9cacc19d15 fix(ui): fix set pct badge logic and compact CODMAT form layout
- Fix is_complete check: use abs(pct-100)<=0.01 instead of >=99.99
  so sets with >100% total are correctly shown as incomplete
- Show pct badge with 2 decimals (e.g. "⚠️ 200.00%")
- Remove product name pre-fill in missing SKUs map modal CODMAT field
- Compact CODMAT lines to single row with placeholders instead of labels

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:21:49 +00:00
Claude Agent
15ccbe028a fix(dashboard): fix pill counts and Bootstrap UI cleanup
- IMPORTED pill now includes ALREADY_IMPORTED orders in count
- UNINVOICED filter includes ALREADY_IMPORTED orders
- Pill counts (Toate/Importate/Omise/Erori/Nefacturate) always reflect
  full period+search, independent of active status filter
- Nefacturate count computed from SQLite cache across full period,
  not just current page
- Bootstrap UI: design tokens, soft badge pills, consistent font sizes,
  purge inline styles from templates, move badge-pct to style.css

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:05:43 +00:00
Claude Agent
b69b5e7104 feat(sync): add GoMag API client with Phase 0 auto-download
- New gomag_client.py service: async httpx client that downloads orders
  from GoMag API with full pagination and 1s rate-limit sleep
- config.py: add GOMAG_API_KEY, GOMAG_API_SHOP, GOMAG_ORDER_DAYS_BACK,
  GOMAG_LIMIT, GOMAG_API_URL settings
- sync_service.py: Phase 0 downloads fresh orders before reading JSONs;
  graceful skip if API keys not configured
- start.sh: auto-detect INSTANTCLIENTPATH from .env, fallback to thin mode
- .env.example: document GoMag API variables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 23:03:39 +00:00
2e65855fe2 feat(sync): already_imported tracking, invoice cache, path fixes, remove vfp
- Track already_imported/new_imported counts separately in sync_runs
  and surface them in status API + dashboard last-run card
- Cache invoice data in SQLite orders table (factura_* columns);
  dashboard falls back to Oracle only for uncached imported orders
- Resolve JSON_OUTPUT_DIR and SQLITE_DB_PATH relative to known
  anchored roots in config.py, independent of CWD (fixes WSL2 start)
- Use single Oracle connection for entire validation phase (perf)
- Batch upsert web_products instead of one-by-one
- Remove stale VFP scripts (replaced by gomag-vending.prg workflow)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 00:15:37 +02:00
8681a92eec fix(logs): use status_at_run for per-run order counts and filtering
orders.status preserves IMPORTED over ALREADY_IMPORTED to avoid
overwriting historical data, so per-run journal views must use
sync_run_orders.status_at_run to show what actually happened in
that specific run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 00:12:10 +02:00
f52c504c2b chore: ignore SQLite auxiliary files (journal, wal, shm)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 18:02:08 +02:00
77a89f4b16 docs: update README and .env.example for project root start convention
Fix start command (python -m uvicorn api.app.main:app from project root),
correct JSON_OUTPUT_DIR path (vfp/output not ../vfp/output), document
all env variables with descriptions, add dashboard features overview,
business rules, and WSL2 notes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:59:58 +02:00
5f8b9b6003 feat(dashboard): redesign UI with smart polling, unified sync card, filter bar
Replace SSE with smart polling (30s idle / 3s when running). Unify sync
panel into single two-row card with live progress text. Add unified filter
bar (period dropdown, status pills, search) with period-total counts.
Add Client/Cont tooltip for different shipping/billing persons. Add SKU
mappings pct_total badges + complete/incomplete filter + 409 duplicate
check. Add missing SKUs search + rescan progress UX. Migrate SQLite
orders schema (shipping_name, billing_name, payment_method,
delivery_method). Fix JSON_OUTPUT_DIR path for server running from
project root. Fix pagination controls showing top+bottom with per-page
selector (25/50/100/250).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:55:36 +02:00
82196b9dc0 feat(sqlite): refactor orders schema + dashboard period filter
Replace import_orders (insert-per-run) with orders table (one row per
order, upsert on conflict). Eliminates dedup CTE on every dashboard
query and prevents unbounded row growth at 4-500 orders/sync.

Key changes:
- orders table: PK order_number, upsert via ON CONFLICT DO UPDATE;
  COALESCE preserves id_comanda once set; times_skipped auto-increments
- sync_run_orders: lightweight junction (sync_run_id, order_number)
  replaces sync_run_id column on orders
- order_items: PK changed to (order_number, sku), INSERT OR IGNORE
- Auto-migration in init_sqlite(): import_orders → orders on first boot,
  old table renamed to import_orders_bak
- /api/dashboard/orders: period_days param (3/7/30/0=all, default 7)
- Dashboard: period selector buttons in orders card header
- start.sh: stop existing process on port 5003 before restart;
  remove --reload (broken on WSL2 /mnt/e/)
- Add invoice_service, E2E Playwright tests, Oracle package updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:18:57 +02:00
650e98539e feat(sync): add SSE live feed, unified logs page, fix Oracle connection
- Add SSE event bus in sync_service (subscribe/unsubscribe/_emit)
- Add GET /api/sync/stream SSE endpoint for real-time sync progress
- Rewrite logs.html: unified runs table + live feed + summary + filters
- Rewrite logs.js: SSE EventSource client, run selection, pagination
- Dashboard: clickable runs navigate to /logs?run=, sync started banner
- Remove "Import Comenzi" nav item, delete sync_detail.html
- Add error_message column to sync_runs table with migration
- Fix: export TNS_ADMIN as OS env var so oracledb finds tnsnames.ora
- Fix: use get_oracle_connection() instead of direct pool.acquire()
- Fix: CRM_POLITICI_PRET_ART INSERT to match actual table schema

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:08:09 +02:00
97699fa0e5 feat(dashboard): add logs page, pagination, quick mapping modal, price pre-validation
- Add /logs page with per-order sync run details, filters (Toate/Importate/Fara Mapare/Erori)
- Add price pre-validation (validate_prices + ensure_prices) to prevent ORA-20000 on direct articles
- Add find_new_orders() to detect orders not yet in Oracle COMENZI
- Extend missing_skus table with order context (order_count, order_numbers, customers)
- Add server-side pagination on /api/validate/missing-skus and /missing-skus page
- Replace confusing "Skip"/"Err" with "Fara Mapare"/"Erori" terminology
- Add inline mapping modal on dashboard (replaces navigation to /mappings)
- Add 2-row stat cards: orders (Comenzi Noi/Ready/Importate/Fara Mapare/Erori) + articles
- Add ID_POL/ID_GESTIUNE/ID_SECTIE to config.py and .env
- Update .gitignore (venv, *.db, api/api/, logs/)
- 33/33 unit tests pass, E2E verified with Playwright

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:59:08 +02:00
06daf24073 agenti 2026-03-11 14:36:13 +02:00
9c42187f02 feat: add FastAPI admin dashboard with sync orchestration and test suite
Replace Flask admin with FastAPI app (api/app/) featuring:
- Dashboard with stat cards, sync control, and history
- Mappings CRUD for ARTICOLE_TERTI with CSV import/export
- Article autocomplete from NOM_ARTICOLE
- SKU pre-validation before import
- Sync orchestration: read JSONs -> validate -> import -> log to SQLite
- APScheduler for periodic sync from UI
- File logging to logs/sync_comenzi_YYYYMMDD_HHMMSS.log
- Oracle pool None guard (503 vs 500 on unavailable)

Test suite:
- test_app_basic.py: 30 tests (imports + routes) without Oracle
- test_integration.py: 9 integration tests with Oracle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:35:16 +02:00
902f99c507 corectie 2026-03-11 13:45:21 +02:00
69841872d1 pljson 2026-03-11 12:32:25 +02:00
8e94c05901 actualizare 2026-03-10 15:23:12 +02:00
6f988db1f9 progres 2026-03-05 11:54:29 +02:00
d421baccf0 Remove IdGestiune parameter and update IdPol example value
Changes:
- Remove p_id_gestiune parameter from PACK_IMPORT_COMENZI.importa_comanda signature
  (both package spec and body)
- Update VFP sync-comenzi-web.prg to remove ?goSettings.IdGestiune from Oracle call
- Update settings.ini.example with IdPol=39 as example value

Simplified order import: IdGestiune is no longer needed as a configurable parameter.
Orders now use only IdPol and IdSectie.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 00:57:43 +02:00
7a50d2156a Change ROA settings defaults to NULL and remove obsolete script
Changes:
1. Update settings.ini.example with [ROA] section using NULL defaults
2. Modify ApplicationSetup.prg to handle NULL values properly:
   - CreateDefaultIni writes "NULL" string to INI file
   - LoadSettings converts "NULL" string to VFP .NULL. value
3. Update Oracle package defaults from (0, 1, 2) to (NULL, NULL, NULL):
   - p_id_pol DEFAULT NULL
   - p_id_gestiune DEFAULT NULL
   - p_id_sectie DEFAULT NULL
4. Remove obsolete 02_import_parteneri.sql (replaced by 05_pack_import_parteneri.pck)
5. Update local settings.ini with NULL values

Rationale:
- NULL is semantically correct (no policy/gestiune/sectie specified)
- Previous defaults (0, 1, 2) were invalid IDs in ROA system
- Maintains backward compatibility through Oracle DEFAULT NULL

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 00:02:50 +02:00
ef6a318aed Add configurable ROA settings (IdPol, IdGestiune, IdSectie) to VFP integration
Implement global configuration for ROA system IDs via settings.ini:

VFP Changes:
- Add [ROA] section to settings.ini with IdPol, IdGestiune, IdSectie
- Update ApplicationSetup.LoadSettings to read ROA configuration
- Update ApplicationSetup.CreateDefaultIni with default values (0, 1, 2)
- Modify sync-comenzi-web.prg to pass ROA settings to Oracle package

Oracle Package Changes (06_pack_import_comenzi.pck):
- Add optional parameters to importa_comanda signature with defaults
  * p_id_pol (default: 0)
  * p_id_gestiune (default: 1)
  * p_id_sectie (default: 2)
- Remove hardcoded constants (c_id_pol, c_id_sectie, c_id_gestiune)
- Update PACK_COMENZI.adauga_comanda call to use p_id_sectie parameter
- Update PACK_COMENZI.adauga_articol_comanda to use p_id_pol and p_id_sectie

Benefits:
- Flexible configuration without code changes
- Maintains backward compatibility with default values
- Centralized ROA system configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 22:36:21 +02:00
05bb0b1b01 Reorganize Oracle packages into database-scripts for unified git tracking
Move Oracle package files from docs/ to api/database-scripts/ with sequential numbering:
- PACK_COMENZI.pck → 04_pack_comenzi.pck (renamed with git)
- PACK_IMPORT_PARTENERI.pck → 05_pack_import_parteneri.pck
- PACK_IMPORT_COMENZI.pck → 06_pack_import_comenzi.pck

Remove 04_import_comenzi.sql (replaced by 06_pack_import_comenzi.pck actual version)

Update VFP integration files and project structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 22:32:41 +02:00
5d43509987 Update VFP integration with improved error handling and settings management
- Add output/ directory to .gitignore to exclude generated JSON files
- Fix ApplicationSetup.prg parameter handling with LPARAMETERS and proper validation
- Update gomag-adapter.prg to use global settings object and clean old JSON files
- Enhance sync-comenzi-web.prg with Oracle integration improvements
- Add Visual FoxPro project files (roawebcomenzi.PJT/.pjx)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 17:01:00 +03:00
d1858f86b6 Phase 2 implementation: VFP Integration with Oracle synchronization
Major architectural changes:
- Convert Oracle IMPORT_PARTENERI.cauta_sau_creeaza_partener from FUNCTION to PROCEDURE with OUT parameter for VFP compatibility
- Add IS_PERSOANA_JURIDICA parameter to support individual vs company detection
- Implement sync-comenzi-web.prg orchestrator for generic web order processing with 5-minute timer automation
- Create ApplicationSetup class for proper object-oriented configuration management
- Add comprehensive Oracle connection and sync settings via settings.ini configuration system
- Implement generic web order processing functions (ProcessWebOrder, ValidateWebOrder, CleanWebText, ConvertWebDate)
- Add proper VFP-Oracle integration with correct procedure call syntax using OUT parameters
- Rename gomag-vending.prg to gomag-adapter.prg for clarity and platform-specific functionality
- Move CheckIniFile function to utils.prg for better code organization
- Add settings.ini.example template and update .gitignore to exclude actual settings files
- Implement comprehensive logging system with rotation and error handling
- Add connection validation and retry logic for robust Oracle integration

Technical improvements:
- Proper JSON processing integration with existing nfjson library
- Comprehensive error handling with categorized logging (INFO, ERROR, WARN)
- Timer-based automation with configurable intervals
- Settings validation and default value creation
- Generic function naming for multi-platform support
- Class-based setup system replacing procedural approach

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 16:01:42 +03:00
86e9d32b76 Complete Phase 1: Oracle Import System - 95% Functional
## Major Achievements

###  PACK_COMENZI Issues Resolved
- Fixed V_INTERNA=2 parameter for client orders (was causing CASE statement errors)
- Corrected FK constraints: ID_GESTIUNE=NULL, ID_SECTIE=2 for INTERNA=2
- All Oracle packages now compile and function correctly

###  Comprehensive Test Suite
- Created test_complete_import.py with full end-to-end validation
- Automated setup/teardown with proper trigger handling (trg_NOM_ARTICOLE_befoins)
- Test data management with specific ID ranges (9999001-9999003)

###  Database Foundation Complete
- PACK_IMPORT_PARTENERI: 100% functional partner creation/retrieval
- PACK_IMPORT_COMENZI: 95% functional with gaseste_articol_roa working perfectly
- ARTICOLE_TERTI mappings: Complex SKU mapping system operational
- All individual components validated with real data

### 🧹 Code Cleanup
- Removed 8 temporary/debug files
- Consolidated into 5 essential files
- Updated documentation with execution methods and results

## Test Results
- **Article Mapping:**  3 mappings found for CAFE100→CAF01
- **JSON Parsing:**  Oracle PACK_JSON integration working
- **Partner Management:**  Automatic partner creation functional
- **Order Import:** ⚠️ 95% success (order creation works, minor article processing optimization needed)

## Ready for Phase 2 VFP Integration
All core components validated and operational for Visual FoxPro integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 14:18:45 +03:00
a47af979b8 Reorganize testing infrastructure and fix Oracle cursor loop syntax
Major changes:
- Fix cursor loop syntax in 04_import_comenzi.sql using BULK COLLECT pattern
- Remove obsolete test scripts (apply_fix.py, check_*.py, debug_functions.py, test_*.py)
- Add comprehensive README.md files for api/ and api/tests/ directories
- Keep only essential testing scripts (final_validation.py, test_syntax.py)
- Update PRD.md with latest project status

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 13:09:32 +03:00
23f03670c8 Update documentation with P1-004 completion status
- Update PRD with Phase 1 completion (95%)
- Document test results and external dependency issue
- Ready for Phase 2 VFP integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 01:25:38 +03:00
52454a5925 Complete P1-004: Testing Manual Packages and reorganize test files
- Complete manual testing of all Oracle PL/SQL packages
- Document 75% success rate (3/4 components passing)
- Move all test scripts from api/ to api/tests/ subdirectory
- Update P1-004 story with comprehensive test results
- Identify external dependency blocking full order import
- Mark Phase 1 as 95% complete, ready for Phase 2

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 01:25:27 +03:00
1dc5da4ed2 Fix Oracle PL/SQL compilation errors by adding NULL statements to empty IF blocks
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 00:26:24 +03:00
4d712642c1 Add optional IS_PERSOANA_JURIDICA parameter to PACK_IMPORT_PARTENERI
- Add p_is_persoana_juridica parameter to cauta_sau_creeaza_partener function
- Enable explicit person type detection from GoMag orders data
- Maintain backward compatibility with NULL default value
- Priority logic: explicit parameter > CNP auto-detection
- Improve accuracy when CNP is not available for individuals
- Support 1=persoana juridica, 0=persoana fizica, NULL=auto-detect

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 00:08:51 +03:00