Skip to content

ITized/coduripostalero

Repository files navigation

CoduriPostaleRO — Romanian Postal Codes for Dolibarr

License: GPLv3+ Dolibarr: 14.0+ PHP: 7.1+

Dolibarr module that imports the official Romanian postal code database from data.gov.ro (Poșta Română) and provides autocomplete on address forms with e-factura CIUS-RO compliant locality and county names.

Documentație în limba română / Romanian documentation

Features

  • Official data import from data.gov.ro (Poșta Română — Infocod cu SIRUTA)
  • Configurable URL for XLS download (updatable when new data is published)
  • Unified table with all columns from the 3 worksheets (Bucharest, cities >50K, other localities)
  • Street-level granularity — shows street names for precise postal code matching
  • Smart autocomplete on Dolibarr address forms (third-parties, contacts, invoices, etc.)
    • Postal code → auto-fills city + county + country
    • City name → auto-fills postal code + county
    • Street-aware matching for Bucharest (reads address field, matches by street name + house number)
  • e-Factura CIUS-RO compliance:
    • Bucharest: SECTOR1–SECTOR6 (per $SECTOR-RO-CODES in CIUS-RO)
    • Counties: ISO 3166-2:RO codes (RO-AB, RO-AG, …, RO-VS)
    • Respects character limits (PostalZone ≤ 20, CityName ≤ 50)

Installation

  1. Copy the coduripostalero/ directory into htdocs/custom/ of your Dolibarr installation
  2. Enable the module from Home → Setup → Modules (search for "CoduriPostaleRO")
  3. Configure the download URL in Module Settings
  4. Import data from the Import page (automatic download or manual upload)

See the User Guide (EN) or User Guide (RO) for detailed instructions.

Module Structure

coduripostalero/
├── core/modules/modCoduriPostaleRO.class.php   # Module descriptor
├── class/actions_coduripostalero.class.php      # Hook actions class
├── lib/coduripostalero.lib.php                  # Admin helpers + county ISO mapping
├── lib/coduripostalero_functions.lib.php        # Shared functions (normalize, match, etc.)
├── admin/setup.php                              # Settings page (URL, enable/disable)
├── admin/import.php                             # Import page (URL download or file upload)
├── admin/about.php                              # About page
├── ajax/autocomplete.php                        # AJAX endpoint for autocomplete
├── js/coduripostalero.js.php                    # jQuery UI autocomplete (JS served via PHP)
├── sql/llx_coduripostale_ro.sql                 # Table creation DDL
├── sql/llx_coduripostale_ro.key.sql             # Index definitions
├── sql/data.sql                                 # Default configuration seed
├── test/CoduriPostaleUnitTest.php               # Standalone unit tests
├── docs/USER_GUIDE.md                           # User documentation (EN)
├── docs/USER_GUIDE_RO.md                        # User documentation (RO)
└── langs/
    ├── en_US/coduripostalero.lang               # English translations
    └── ro_RO/coduripostalero.lang               # Romanian translations

e-Factura Compliance

This module enforces the CIUS-RO rules from RO16931-UBL-validation.sch:

Rule Description
BR-RO-100 For Bucharest (RO-B), CityName = SECTOR1–SECTOR6
BR-RO-110 CountrySubentity = ISO 3166-2:RO code
BR-RO-L020 PostalZone ≤ 20 characters
BR-RO-L050 CityName ≤ 50 characters

Data Source

  • Organization: Poșta Română / data.gov.ro
  • Dataset: Coduri poștale România
  • License: OGL-ROU-1.0 (Open Government Licence Romania)
  • Format: XLS with 3 worksheets (Bucharest streets, cities > 50K, other localities)
  • ~55,000 records total (street-level for Bucharest)

Requirements

  • Dolibarr ≥ 14.0 (for bundled PhpSpreadsheet)
  • PHP ≥ 7.1
  • jQuery UI (bundled with Dolibarr)

Running Tests

php test/CoduriPostaleUnitTest.php

Contributing

Contributions are welcome! Please read CONTRIBUTING.md before submitting a pull request.

License

This module is licensed under the GNU General Public License v3.0 or later.

Author

About

Modul Dolibarr pentru a scrie rapid adresele in CRM bazat pe date oficiale de pe data.gov.ro

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages