Changeset 3473678
- Timestamp:
- 03/03/2026 01:17:18 PM (4 weeks ago)
- Location:
- partita-iva-e-codice-fiscale
- Files:
-
- 5 edited
- 4 copied
-
tags/1.4.1 (copied) (copied from partita-iva-e-codice-fiscale/trunk)
-
tags/1.4.1/assets/js/piva_cf_wc_checkout.js (modified) (2 diffs)
-
tags/1.4.1/cf-piva-sdi.php (copied) (copied from partita-iva-e-codice-fiscale/trunk/cf-piva-sdi.php) (6 diffs)
-
tags/1.4.1/include/option_page.php (copied) (copied from partita-iva-e-codice-fiscale/trunk/include/option_page.php) (3 diffs)
-
tags/1.4.1/readme.txt (copied) (copied from partita-iva-e-codice-fiscale/trunk/readme.txt) (2 diffs)
-
trunk/assets/js/piva_cf_wc_checkout.js (modified) (2 diffs)
-
trunk/cf-piva-sdi.php (modified) (6 diffs)
-
trunk/include/option_page.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
partita-iva-e-codice-fiscale/tags/1.4.1/assets/js/piva_cf_wc_checkout.js
r3334154 r3473678 1 // jQuery(function($) {2 // function toggleFields() {3 // var tipo = $('#tipo_contribuente').val();4 // $('.cf-only, .piva-only').hide();5 // if (tipo === 'cf') $('.cf-only').show();6 // else if (tipo === 'piva') $('.piva-only').show();7 // }8 9 // $('#tipo_contribuente').change(toggleFields);10 // toggleFields();11 // });12 13 1 jQuery(function($) { 14 2 function toggleFields() { 15 3 var tipo = $('#tipo_contribuente').val(); 16 //console.log('[DEBUG] tipo_contribuente:', tipo);17 4 $('.cf-only, .piva-only').hide(); 18 5 if (tipo === 'cf') { 19 6 $('.cf-only').show(); 20 //console.log('[DEBUG] Mostro CF-only');21 7 } else if (tipo === 'piva') { 22 8 $('.piva-only').show(); 23 //console.log('[DEBUG] Mostro PIVA-only');24 } else {25 //console.log('[DEBUG] Nessun tipo selezionato o tipo diverso');26 9 } 27 10 } 28 11 29 12 function toggleFiscaliSection() { 13 var country = $('#billing_country').val(); 14 if (country) country = country.toUpperCase(); 30 15 31 32 var country = $('#billing_country').val();33 //console.log('[DEBUG] billing_country raw:', country);34 if (country) country = country.toUpperCase();35 //console.log('[DEBUG] billing_country upper:', country);36 37 16 if (typeof cfPivaSettings === 'undefined' || !cfPivaSettings.nascond_nonita) { 38 // Flag disattivato o non definito, mostro sempre la sezione 39 console.log('[DEBUG] Flag disattivato o non definito, non nascondo'+cfPivaSettings.nascond_nonita); 40 17 // Flag disattivato: mostra sempre 18 $('#cf_piva_checkout').show(); 41 19 } else { 42 console.log('[DEBUG] Flag attivato, nascondo'+cfPivaSettings.nascond_nonita);43 44 if ( country !== 'IT') {20 // Paesi con sistema fiscale italiano: IT e SM (San Marino) 21 var paesiConFiscaleIT = ['IT']; 22 if (paesiConFiscaleIT.indexOf(country) === -1) { 45 23 $('#cf_piva_checkout').hide(); 46 //console.log('[DEBUG] Nascondo section CF/PIVA');47 24 } else { 48 25 $('#cf_piva_checkout').show(); 49 //console.log('[DEBUG] Mostro section CF/PIVA');50 26 } 51 27 } 52 53 54 28 } 55 29 … … 59 33 $('#billing_country').on('select2:select', toggleFiscaliSection); 60 34 35 // Dopo ogni aggiornamento del checkout WooCommerce (es. cambio spedizione, coupon) 36 // il DOM viene rifatto, quindi ri-eseguiamo entrambe le funzioni 37 $('body').on('updated_checkout', function() { 38 toggleFields(); 39 toggleFiscaliSection(); 40 }); 41 61 42 // Inizializzazione 62 //console.log('[DEBUG] Inizializzazione script');63 43 toggleFields(); 64 44 toggleFiscaliSection(); 65 45 }); 66 -
partita-iva-e-codice-fiscale/tags/1.4.1/cf-piva-sdi.php
r3376461 r3473678 3 3 Plugin Name: Partita IVA e Codice Fiscale 4 4 Description: Aggiunge Codice Fiscale, Partita IVA, Ragione Sociale, PEC e Codice SDI al checkout WooCommerce. 5 Version: 1.4 5 Version: 1.4.1 6 6 Author: Andrea Marinucci 7 7 Text Domain: partita-iva-e-codice-fiscale … … 23 23 24 24 25 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni 26 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale']; // Rendi Opzionale Ragione Sociale 27 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec']; // Rendi Opzionale Indirizzo PEC 28 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi']; // Rendi Opzionale Codice destinatario SDI 29 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz']; 25 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 26 27 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale'] ?? false; 28 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec'] ?? false; 29 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi'] ?? false; 30 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz'] ?? false; 30 31 31 32 echo '<div id="cf_piva_checkout"><h3>Dati Fiscali</h3>'; … … 161 162 162 163 163 164 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni 165 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale']; // Rendi Opzionale Ragione Sociale166 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec']; // Rendi Opzionale Indirizzo PEC167 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi'];168 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz']; // Rendi Opzionale Codice destinatario SDI169 164 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 165 166 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale'] ?? false; 167 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec'] ?? false; 168 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi'] ?? false; 169 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz'] ?? false; 170 170 171 // Controllo nonce con sanificazione e wp_unslash 171 172 $nonce = isset($_POST['woocommerce-process-checkout-nonce']) ? sanitize_text_field(wp_unslash($_POST['woocommerce-process-checkout-nonce'])) : ''; … … 235 236 ); 236 237 238 237 239 //flag per far nascondere i dati se lo stato di billing non e italia se tue al cambiameto di stato nasconde se nn IT 238 $nascond_nonita = false; // true o false 240 241 242 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 243 $nascond_nonita = isset( $piva_cf_wc_options['nascond_nonita'] ) && $piva_cf_wc_options['nascond_nonita'] === '1'; 239 244 240 245 wp_localize_script('piva_cf_wc_checkout-js', 'cfPivaSettings', [ … … 248 253 function piva_cf_wc__mostra_cf_piva_frontend($order) { 249 254 250 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni 251 // Rendi Opzionale Codice destinatario SDI 252 $nascondi_dati_fiscali_nella_pagina_checkout_3 = $piva_cf_wc_options['piva_cf_wc_nascondi']; // Nascondi dati fiscali nella conferma ordine 253 255 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 256 $nascondi_dati_fiscali_nella_pagina_checkout_3 = $piva_cf_wc_options['piva_cf_wc_nascondi'] ?? false; 254 257 255 258 … … 287 290 288 291 289 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni // Nascondi dati fiscali nella conferma ordine290 $telegram = $piva_cf_wc_options['piva_cf_wc_telegram'];292 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 293 $telegram = $piva_cf_wc_options['piva_cf_wc_telegram'] ?? false; 291 294 292 295 if (!$telegram) { -
partita-iva-e-codice-fiscale/tags/1.4.1/include/option_page.php
r3376461 r3473678 90 90 'Nascondi dati fiscali nella pagina di conferma ordine (Front End)', 91 91 array( $this, 'piva_cf_wc_nascondi_callback' ), 92 'piva-cf-wc-admin', 93 'piva_cf_wc_setting_section' 94 ); 95 96 97 add_settings_field( 98 'nascond_nonita', 99 'Nascondi il form se nei dati di Fatturazione lo stato non è ITALIA', 100 array( $this, 'nascond_nonita_callback' ), 92 101 'piva-cf-wc-admin', 93 102 'piva_cf_wc_setting_section' … … 128 137 } 129 138 139 140 if ( isset( $input['nascond_nonita'] ) ) { 141 $sanitary_values['nascond_nonita'] = $input['nascond_nonita']; 142 } 143 130 144 if ( isset( $input['piva_cf_wc_sdi'] ) ) { 131 145 $sanitary_values['piva_cf_wc_sdi'] = $input['piva_cf_wc_sdi']; … … 204 218 '<input type="checkbox" name="piva_cf_wc_options[piva_cf_wc_telegram]" id="piva_cf_wc_telegram" value="1" %s>', 205 219 ( isset( $this->piva_cf_wc_options['piva_cf_wc_telegram'] ) && $this->piva_cf_wc_options['piva_cf_wc_telegram'] === '1' ) ? 'checked' : '' 220 ); 221 } 222 223 public function nascond_nonita_callback() { 224 printf( 225 '<label for="nascond_nonita"> 226 <input type="checkbox" name="piva_cf_wc_options[nascond_nonita]" id="nascond_nonita" value="1" %s> 227 Abilta La richiesta dei campi Piva e CF solo per clienti Italiani. 228 </label>', 229 ( isset( $this->piva_cf_wc_options['nascond_nonita'] ) && $this->piva_cf_wc_options['nascond_nonita'] === '1' ) ? 'checked' : '' 206 230 ); 207 231 } -
partita-iva-e-codice-fiscale/tags/1.4.1/readme.txt
r3376461 r3473678 3 3 Tags: woocommerce, checkout, partita iva, codice fiscale 4 4 Requires at least: 5.0 5 Tested up to: 6. 85 Tested up to: 6.9.1 6 6 Requires PHP: 7.0 7 7 Stable tag: 1.4 … … 41 41 == Changelog == 42 42 43 = 1.4.1 = 44 * Aggiunta opzione nelle impostazioni del plugin per nascondere automaticamente il blocco "Dati Fiscali" nel checkout quando il cliente seleziona un paese di fatturazione diverso dall'Italia. 45 * Fixed PHP 8 warnings: Undefined array key for plugin options. 46 * Improved compatibility with PHP 8+ strict array handling. 47 48 43 49 = 1.4 = 44 50 * Aggiunta Opzione per rendere opzionale i dati fiscali nel checkout -
partita-iva-e-codice-fiscale/trunk/assets/js/piva_cf_wc_checkout.js
r3334154 r3473678 1 // jQuery(function($) {2 // function toggleFields() {3 // var tipo = $('#tipo_contribuente').val();4 // $('.cf-only, .piva-only').hide();5 // if (tipo === 'cf') $('.cf-only').show();6 // else if (tipo === 'piva') $('.piva-only').show();7 // }8 9 // $('#tipo_contribuente').change(toggleFields);10 // toggleFields();11 // });12 13 1 jQuery(function($) { 14 2 function toggleFields() { 15 3 var tipo = $('#tipo_contribuente').val(); 16 //console.log('[DEBUG] tipo_contribuente:', tipo);17 4 $('.cf-only, .piva-only').hide(); 18 5 if (tipo === 'cf') { 19 6 $('.cf-only').show(); 20 //console.log('[DEBUG] Mostro CF-only');21 7 } else if (tipo === 'piva') { 22 8 $('.piva-only').show(); 23 //console.log('[DEBUG] Mostro PIVA-only');24 } else {25 //console.log('[DEBUG] Nessun tipo selezionato o tipo diverso');26 9 } 27 10 } 28 11 29 12 function toggleFiscaliSection() { 13 var country = $('#billing_country').val(); 14 if (country) country = country.toUpperCase(); 30 15 31 32 var country = $('#billing_country').val();33 //console.log('[DEBUG] billing_country raw:', country);34 if (country) country = country.toUpperCase();35 //console.log('[DEBUG] billing_country upper:', country);36 37 16 if (typeof cfPivaSettings === 'undefined' || !cfPivaSettings.nascond_nonita) { 38 // Flag disattivato o non definito, mostro sempre la sezione 39 console.log('[DEBUG] Flag disattivato o non definito, non nascondo'+cfPivaSettings.nascond_nonita); 40 17 // Flag disattivato: mostra sempre 18 $('#cf_piva_checkout').show(); 41 19 } else { 42 console.log('[DEBUG] Flag attivato, nascondo'+cfPivaSettings.nascond_nonita);43 44 if ( country !== 'IT') {20 // Paesi con sistema fiscale italiano: IT e SM (San Marino) 21 var paesiConFiscaleIT = ['IT']; 22 if (paesiConFiscaleIT.indexOf(country) === -1) { 45 23 $('#cf_piva_checkout').hide(); 46 //console.log('[DEBUG] Nascondo section CF/PIVA');47 24 } else { 48 25 $('#cf_piva_checkout').show(); 49 //console.log('[DEBUG] Mostro section CF/PIVA');50 26 } 51 27 } 52 53 54 28 } 55 29 … … 59 33 $('#billing_country').on('select2:select', toggleFiscaliSection); 60 34 35 // Dopo ogni aggiornamento del checkout WooCommerce (es. cambio spedizione, coupon) 36 // il DOM viene rifatto, quindi ri-eseguiamo entrambe le funzioni 37 $('body').on('updated_checkout', function() { 38 toggleFields(); 39 toggleFiscaliSection(); 40 }); 41 61 42 // Inizializzazione 62 //console.log('[DEBUG] Inizializzazione script');63 43 toggleFields(); 64 44 toggleFiscaliSection(); 65 45 }); 66 -
partita-iva-e-codice-fiscale/trunk/cf-piva-sdi.php
r3376461 r3473678 3 3 Plugin Name: Partita IVA e Codice Fiscale 4 4 Description: Aggiunge Codice Fiscale, Partita IVA, Ragione Sociale, PEC e Codice SDI al checkout WooCommerce. 5 Version: 1.4 5 Version: 1.4.1 6 6 Author: Andrea Marinucci 7 7 Text Domain: partita-iva-e-codice-fiscale … … 23 23 24 24 25 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni 26 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale']; // Rendi Opzionale Ragione Sociale 27 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec']; // Rendi Opzionale Indirizzo PEC 28 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi']; // Rendi Opzionale Codice destinatario SDI 29 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz']; 25 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 26 27 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale'] ?? false; 28 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec'] ?? false; 29 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi'] ?? false; 30 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz'] ?? false; 30 31 31 32 echo '<div id="cf_piva_checkout"><h3>Dati Fiscali</h3>'; … … 161 162 162 163 163 164 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni 165 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale']; // Rendi Opzionale Ragione Sociale166 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec']; // Rendi Opzionale Indirizzo PEC167 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi'];168 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz']; // Rendi Opzionale Codice destinatario SDI169 164 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 165 166 $rendi_opzionale_ragione_sociale_0 = $piva_cf_wc_options['piva_cf_wc_ragione_sociale'] ?? false; 167 $rendi_opzionale_indirizzo_pec_1 = $piva_cf_wc_options['piva_cf_wc_pec'] ?? false; 168 $rendi_opzionale_codice_destinatario_sdi_2 = $piva_cf_wc_options['piva_cf_wc_sdi'] ?? false; 169 $piva_cf_wc_dati_fiscali_opz = $piva_cf_wc_options['piva_cf_wc_dati_fiscali_opz'] ?? false; 170 170 171 // Controllo nonce con sanificazione e wp_unslash 171 172 $nonce = isset($_POST['woocommerce-process-checkout-nonce']) ? sanitize_text_field(wp_unslash($_POST['woocommerce-process-checkout-nonce'])) : ''; … … 235 236 ); 236 237 238 237 239 //flag per far nascondere i dati se lo stato di billing non e italia se tue al cambiameto di stato nasconde se nn IT 238 $nascond_nonita = false; // true o false 240 241 242 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 243 $nascond_nonita = isset( $piva_cf_wc_options['nascond_nonita'] ) && $piva_cf_wc_options['nascond_nonita'] === '1'; 239 244 240 245 wp_localize_script('piva_cf_wc_checkout-js', 'cfPivaSettings', [ … … 248 253 function piva_cf_wc__mostra_cf_piva_frontend($order) { 249 254 250 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni 251 // Rendi Opzionale Codice destinatario SDI 252 $nascondi_dati_fiscali_nella_pagina_checkout_3 = $piva_cf_wc_options['piva_cf_wc_nascondi']; // Nascondi dati fiscali nella conferma ordine 253 255 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 256 $nascondi_dati_fiscali_nella_pagina_checkout_3 = $piva_cf_wc_options['piva_cf_wc_nascondi'] ?? false; 254 257 255 258 … … 287 290 288 291 289 $piva_cf_wc_options = get_option( 'piva_cf_wc_options' ); // Array di tutte le opzioni // Nascondi dati fiscali nella conferma ordine290 $telegram = $piva_cf_wc_options['piva_cf_wc_telegram'];292 $piva_cf_wc_options = get_option( 'piva_cf_wc_options', [] ); 293 $telegram = $piva_cf_wc_options['piva_cf_wc_telegram'] ?? false; 291 294 292 295 if (!$telegram) { -
partita-iva-e-codice-fiscale/trunk/include/option_page.php
r3376461 r3473678 90 90 'Nascondi dati fiscali nella pagina di conferma ordine (Front End)', 91 91 array( $this, 'piva_cf_wc_nascondi_callback' ), 92 'piva-cf-wc-admin', 93 'piva_cf_wc_setting_section' 94 ); 95 96 97 add_settings_field( 98 'nascond_nonita', 99 'Nascondi il form se nei dati di Fatturazione lo stato non è ITALIA', 100 array( $this, 'nascond_nonita_callback' ), 92 101 'piva-cf-wc-admin', 93 102 'piva_cf_wc_setting_section' … … 128 137 } 129 138 139 140 if ( isset( $input['nascond_nonita'] ) ) { 141 $sanitary_values['nascond_nonita'] = $input['nascond_nonita']; 142 } 143 130 144 if ( isset( $input['piva_cf_wc_sdi'] ) ) { 131 145 $sanitary_values['piva_cf_wc_sdi'] = $input['piva_cf_wc_sdi']; … … 204 218 '<input type="checkbox" name="piva_cf_wc_options[piva_cf_wc_telegram]" id="piva_cf_wc_telegram" value="1" %s>', 205 219 ( isset( $this->piva_cf_wc_options['piva_cf_wc_telegram'] ) && $this->piva_cf_wc_options['piva_cf_wc_telegram'] === '1' ) ? 'checked' : '' 220 ); 221 } 222 223 public function nascond_nonita_callback() { 224 printf( 225 '<label for="nascond_nonita"> 226 <input type="checkbox" name="piva_cf_wc_options[nascond_nonita]" id="nascond_nonita" value="1" %s> 227 Abilta La richiesta dei campi Piva e CF solo per clienti Italiani. 228 </label>', 229 ( isset( $this->piva_cf_wc_options['nascond_nonita'] ) && $this->piva_cf_wc_options['nascond_nonita'] === '1' ) ? 'checked' : '' 206 230 ); 207 231 } -
partita-iva-e-codice-fiscale/trunk/readme.txt
r3376461 r3473678 3 3 Tags: woocommerce, checkout, partita iva, codice fiscale 4 4 Requires at least: 5.0 5 Tested up to: 6. 85 Tested up to: 6.9.1 6 6 Requires PHP: 7.0 7 7 Stable tag: 1.4 … … 41 41 == Changelog == 42 42 43 = 1.4.1 = 44 * Aggiunta opzione nelle impostazioni del plugin per nascondere automaticamente il blocco "Dati Fiscali" nel checkout quando il cliente seleziona un paese di fatturazione diverso dall'Italia. 45 * Fixed PHP 8 warnings: Undefined array key for plugin options. 46 * Improved compatibility with PHP 8+ strict array handling. 47 48 43 49 = 1.4 = 44 50 * Aggiunta Opzione per rendere opzionale i dati fiscali nel checkout
Note: See TracChangeset
for help on using the changeset viewer.