=== OVP-Sponsorizare ===
Contributors: ovpdigital
Tags: nonprofit, form-230, form-177, tax-redirection, romania
Requires at least: 5.8
Tested up to: 7.1.2
Requires PHP: 7.4
Stable tag: 2.1.6
License: GPLv2 or later
Domain Path: /languages
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Complete plugin for Romanian nonprofits: Form 230, Form D177 (XML for SPV) and Sponsorship Contract. Fully ANAF compliant.

== Description ==

**OVP-Sponsorizare** is a WordPress plugin dedicated to Romanian nonprofit organizations for online collection of tax redirection forms and sponsorship contracts, fully compliant with Romanian tax legislation (ANAF).

= Form 230 — Individual Taxpayers =

* Complete online form compliant with OPANAF 103/2025
* Digital handwritten signature (canvas)
* Automatic generation of official ANAF PDF
* Automatic email with PDF attachment
* Organization submits the form to ANAF on behalf of the taxpayer

= Form D177 — Legal Entities =

* Form compliant with schema D177_A1.0.8 (SPV ANAF)
* Generates valid **XML file** for submission via SPV (ANAF Private Virtual Space)
* Multiple beneficiaries — add/remove dynamically
* Clear instructions for qualified electronic signature and SPV submission
* Taxpayer submits signed XML directly via SPV

= Sponsorship Contract =

* Form for individuals and legal entities
* 3 types of sponsorship: monetary, goods, services
* Generates complete PDF with 10 chapters (including GDPR clauses)
* Dedicated space for manual signature and stamp
* Automatic email to sponsor with signing instructions

= Admin Features =

* Dashboard with statistics: number of forms 230, 177, contracts and declared amounts
* Fully configurable colors from admin with live preview
* Organization data auto-filled in forms from settings
* Responsive — works on any device
* Server-side validation on all forms
* WordPress nonce protection on all requests
* Data stored securely in WordPress database

= Shortcodes =

* `[ovpspo_formular230]` — Form 230 for individual taxpayers
* `[ovpspo_formular177]` — Form D177 for legal entities
* `[ovpspo_contract_sponsorizare]` — Sponsorship contract

= Screenshots =

**Dashboard** — statistics cards with totals for Form 230, Form 177, contracts and declared amounts:

![Dashboard](https://ps.w.org/ovp-sponsorizare/assets/screenshot-1-dashboard.png)

**Form D177** — taxpayer identification and tax redirection details:

![Form D177 - Taxpayer identification](https://ps.w.org/ovp-sponsorizare/assets/screenshot-3-formular%20177-1.png)

**Form D177** — multiple beneficiaries section with identification details:

![Form D177 - Beneficiaries](https://ps.w.org/ovp-sponsorizare/assets/screenshot-2-formular%20177-2.png)

**Form D177** — proxy data, XML generation and SPV submission steps:

![Form D177 - SPV submission steps](https://ps.w.org/ovp-sponsorizare/assets/screenshot-4-formular%20177-3.png)

**Form 230** — complete form for individual taxpayers with handwritten signature:

![Form 230](https://ps.w.org/ovp-sponsorizare/assets/screenshot-5-formular%20230.png)

**Settings** — Organization data (CIF, IBAN, legal representative):

![Settings - Organization](https://ps.w.org/ovp-sponsorizare/assets/screenshot-6-setari-1.png)

**Settings** — Organization address and contact details:

![Settings - Address](https://ps.w.org/ovp-sponsorizare/assets/screenshot-7-setari-2.png)

**Settings** — Configurable form colors with live preview:

![Settings - Colors](https://ps.w.org/ovp-sponsorizare/assets/screenshot-8-setari-3.png)

**Settings** — Email configuration:

![Settings - Email](https://ps.w.org/ovp-sponsorizare/assets/screenshot-9-setari-4.png)

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/ovp-sponsorizare/`, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **OVP-Sponsorizare → Settings** and fill in your organization details.
4. Create pages and add the shortcodes: `[ovpspo_formular230]`, `[ovpspo_formular177]`, `[ovpspo_contract_sponsorizare]`.
5. Configure the email address where forms should be received.

== Frequently Asked Questions ==

= Is the plugin compliant with current legislation? =
Yes. Forms comply with OPANAF 103/2025. The XML schema for D177 is D177_A1.0.8 issued by ANAF.

= Does the organization need to submit Form 177 on behalf of the taxpayer? =
No. Form D177 is submitted by the taxpayer themselves (the legal entity) in SPV with a qualified electronic signature. The plugin generates the valid XML that the taxpayer downloads, signs, and uploads to SPV.

= Does it work on multiple sites? =
Yes. The plugin is multi-site ready. Organization data is configured in Settings and automatically populated in all generated documents.

= Can I customize the form colors? =
Yes. From **OVP-Sponsorizare → Settings → Organization** you can configure 5 colors (header, accent, sections, button, text) with live preview.

= Is user data saved? =
Yes. All data is saved in the WordPress database. You can view and download PDFs/XMLs from the admin panel.

= What PHP extensions are required? =
PHP 7.4 or newer. For the official ANAF 230 PDF, the `imagick` or `gd` PHP extension is required (both are standard on most hosting providers).

== Screenshots ==

1. Dashboard with form statistics and declared amounts
2. Form D177 — multiple beneficiaries and proxy details
3. Form D177 — taxpayer identification and tax redirection details
4. Form D177 — signing instructions and SPV submission steps
5. Form 230 — individual taxpayers with handwritten signature
6. Settings — Organization data (general info)
7. Settings — Organization address and contact details
8. Settings — Configurable form colors with live preview
9. Settings — Email configuration

== Changelog ==

= 2.1.6 =
* Added: Romanian language support (ro_RO) — plugin now ships with translation files
* Added: `load_plugin_textdomain()` for proper i18n support
* Compatibility: Tested and confirmed compatible with WordPress 7.1.2

= 2.1.5 =
* Fix: All shortcodes now use the `ovpspo_` prefix to comply with WordPress.org naming requirements
* Note: Update your pages — replace `[formular230]` → `[ovpspo_formular230]`, `[formular177]` → `[ovpspo_formular177]`, `[contract_sponsorizare]` → `[ovpspo_contract_sponsorizare]`

= 2.1.4 =
* Fix: Removed all K_PATH_* and K_BLANK_IMAGE defines from TCPDF wrapper classes — these are now handled automatically by TCPDF's own autoconfig
* Fix: Removed unprefixed shortcode backward-compatibility aliases — only `ovpspo_*` prefixed shortcodes are now registered
* Fix: AJAX action names updated to use full `ovpspo_` prefix throughout
* Fix: Admin submenu page slugs updated to `ovpspo-*` prefix for full WordPress.org compliance
* Improvement: Full Plugin Check compliance — zero errors

= 2.1.3 =
* Fix: Custom colors (primary, accent, section, button, text) now applied correctly on all three forms (230, 177, Contract)
* Fix: Button hover state no longer reverts to default WordPress blue
* Fix: Checkbox rendering — replaced Unicode character with pure CSS checkmark for cross-browser compatibility
* Improvement: All emoji replaced with Dashicons for better theme compatibility
* Improvement: TCPDF library now bundled directly inside the plugin — no separate installation required
* Improvement: Event delegation implemented for full Elementor page builder compatibility
* Improvement: Plugin Check compliance improvements — reduced warnings

= 2.1.2 =
* Added: Sponsorship Contract (Contract de Sponsorizare) for individuals and legal entities — 3 contract types
* Added: Dedicated admin panel for contracts with PDF download and management
* Added: Detailed address fields for organization in Settings (street, city, county, postal code)
* Added: Fields for legal representative name, position, bank, and association register number
* Added: Admin email notification with contract PDF attached
* Improved: D177 taxpayer confirmation email now includes detailed SPV signing instructions
* Fix: "Headers already sent" PHP warning on admin record deletion
* Fix: Double arrow appearing on contract form dropdown selects

= 2.1.1 =
* Fix: TCPDF class conflict resolved — added `class_alias()` to avoid collisions with other plugins loading TCPDF
* Fix: Section III (organization data) now correctly pre-filled in the ANAF official PDF overlay
* Fix: CIF (fiscal identification code) placement on Form 230 PDF corrected — white overlay covers pre-drawn boxes, text centered above
* Fix: Organization name shown in PDF instead of legal representative name
* Fix: Canvas signature lazy initialization — resolves timing issues in Elementor and other page builders
* Fix: Form submit handler now uses event delegation to work reliably inside Elementor widgets

= 2.1.0 =
* Added: Contract Sponsorizare module foundation (admin infrastructure, DB table, PDF class)
* Added: Settings tabs reorganized — General, Adresă, Contact, Email, Culori
* Improved: Settings page UX — live color preview updated in real time
* Improved: CSS architecture refactored — all selectors migrated from ID (`#bf230-wrap`) to class (`.bf230-wrap`) for multiple-instance support
* Fix: CSS not loading when shortcode used inside Elementor (removed `has_shortcode()` check — assets loaded unconditionally)
* Fix: JS localized variable name unified to `OVPSPO230` across all files

= 2.0.0 =
* Added: Form D177 — complete XML generation for SPV submission (schema D177_A1.0.8)
* Added: Support for multiple beneficiary organizations in Form 177
* Added: Admin dashboard with submission statistics and informational cards
* Added: Separate admin sections for Form 230 and Form 177 submissions
* Added: Fully configurable brand colors with live preview (primary, accent, button, text, sections)
* Added: Organization data from Settings pre-filled automatically in PDF forms
* Renamed: Plugin renamed from "Formular 230" to "OVP-Sponsorizare" to reflect expanded functionality
* Improved: Completely redesigned responsive front-end layout
* Improved: Settings reorganized with tabbed navigation
* Fix: Form 177 XML output — corrected namespace and encoding for SPV D177_A1.0.8 schema
* Fix: Dashboard statistics count now excludes deleted records
* Fix: Duplicate define() calls for OVPSPO_VERSION and OVPSPO_PATH removed from main plugin file
* Security: Added ABSPATH guard to all 45 PHP files in bundled TCPDF library

= 1.0.0 =
* Initial release: Form 230 (online form for 3.5% income tax redirection)
* Front-end form with taxpayer identification and address fields
* Admin panel for viewing and managing Form 230 submissions
* CSV export of submissions
* GDPR consent checkbox and data processing agreement
* Form validation — CNP format (13 digits), email, required fields
* Official ANAF Form 230 PDF generated via coordinate overlay on the authentic ANAF template
* Handwritten signature capture on HTML canvas — embedded in generated PDF
* Redirection period selection (1 year / 2 years)
* Email notification to admin and confirmation email to taxpayer with completed ANAF PDF attached
* Data saved to custom database table


== Upgrade Notice ==

= 2.1.6 =
Adaugă suport pentru limba română și confirmare compatibilitate WordPress 7.1.2. Actualizare recomandată.

= 2.1.5 =
Actualizare obligatorie pentru utilizatorii care se pregătesc să urce pluginul pe WordPress.org. Shortcode-urile s-au schimbat — înlocuiește [formular230] cu [ovpspo_formular230] pe paginile tale.

= 2.1.4 =
Fix-uri de conformitate WordPress.org. Actualizare recomandată dacă folosești Plugin Check.

= 2.1.3 =
Fix important pentru culori și compatibilitate Elementor. Actualizare recomandată.

= 2.1.2 =
Adaugă modulul Contract de Sponsorizare. Actualizare opțională dacă nu ai nevoie de contracte.

= 2.0.0 =
Versiune majoră — include Form D177 și rebranding complet. Actualizare recomandată.
