Changeset 3460146
- Timestamp:
- 02/12/2026 04:12:26 PM (7 weeks ago)
- Location:
- woopop-electronic-invoice-free/trunk
- Files:
-
- 1 added
- 40 edited
-
addon/for/cozmos/assets/js/invoiceFields.js (modified) (9 diffs)
-
addon/for/cozmos/assets/js/invoiceFields.min.js (modified) (1 diff)
-
addon/for/cozmos/vendor/composer/installed.php (modified) (2 diffs)
-
addon/for/pmpro/assets/js/pmpro-invoiceFields.js (modified) (6 diffs)
-
addon/for/pmpro/assets/js/pmpro-invoiceFields.min.js (modified) (1 diff)
-
addon/for/pmpro/inc/billingFields.php (added)
-
addon/for/pmpro/inc/filtersFront.php (modified) (1 diff)
-
addon/for/pmpro/inc/snippets/billing-fields.php (modified) (1 diff)
-
addon/for/pmpro/inc/snippets/council-directive-2006-112-ec.php (modified) (1 diff)
-
addon/for/pmpro/src/Providers/Product.php (modified) (2 diffs)
-
addon/for/pmpro/vendor/composer/installed.php (modified) (2 diffs)
-
addon/to/aruba/vendor/composer/installed.php (modified) (2 diffs)
-
addon/to/fattureincloud-stock/vendor/composer/installed.php (modified) (2 diffs)
-
addon/to/fattureincloud/changelog.txt (modified) (1 diff)
-
addon/to/fattureincloud/index.php (modified) (1 diff)
-
addon/to/fattureincloud/src/Functions/Api.php (modified) (4 diffs)
-
addon/to/fattureincloud/vendor/composer/installed.php (modified) (2 diffs)
-
addon/to/sdi-pec/vendor/composer/installed.php (modified) (2 diffs)
-
assets/js/invoiceFields.js (modified) (15 diffs)
-
assets/js/invoiceFields.min.js (modified) (1 diff)
-
changelog.txt (modified) (1 diff)
-
inc/settings/pageSettingsFields.php (modified) (1 diff)
-
inc/wc/settings/pageSettingsFields.php (modified) (2 diffs)
-
index.php (modified) (2 diffs)
-
languages/el-inv-es_ES.mo (modified) (previous)
-
languages/el-inv-es_ES.po (modified) (2 diffs)
-
languages/el-inv-fr_FR.mo (modified) (previous)
-
languages/el-inv-fr_FR.po (modified) (2 diffs)
-
languages/el-inv-it_IT.mo (modified) (previous)
-
languages/el-inv-it_IT.po (modified) (2 diffs)
-
languages/el-inv.pot (modified) (1 diff)
-
readme.md (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
src/Admin/Settings/Fields/XmlOrdersList.php (modified) (1 diff)
-
src/Functions/Invoice.php (modified) (1 diff)
-
src/Integrations.php (modified) (1 diff)
-
src/WooCommerce/Fields/InvoiceFields.php (modified) (15 diffs)
-
src/WooCommerce/Product/QuickEditProduct.php (modified) (5 diffs)
-
src/Xml/BuildXml.php (modified) (1 diff)
-
src/Xml/CreateXml.php (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woopop-electronic-invoice-free/trunk/addon/for/cozmos/assets/js/invoiceFields.js
r3418379 r3460146 146 146 147 147 if (!invoiceType) { 148 console.log('[POP-CZM] changeCountryEventHandler: missing invoiceType, aborting.'); 148 149 return false; 149 150 } … … 434 435 var companyFiled = document.getElementById('pms_billing_company'); 435 436 if (companyFiled) { 436 console.log(' toggleBillingCompany');437 console.log('[POP-CZM] toggleBillingCompany'); 437 438 if ('company' === type) { 438 439 companyFiled.setAttribute('required', 'required'); … … 454 455 { 455 456 var country = document.getElementById('pms_billing_country'); 457 if (!country) { 458 console.log('[POP-CZM] switchType: missing country, aborting.'); 459 return; 460 } 456 461 var choiceTypeField = document.querySelector('.pms-pms-choice-type'); 457 462 var invoiceTypeField = document.querySelector('.pms-pms-invoice-type'); … … 463 468 var taxCode = document.getElementById('pms_tax_code'); 464 469 var taxCodeField = document.querySelector('.pms-pms-tax-code'); 465 var cfMessage = taxCode .nextElementSibling;470 var cfMessage = taxCode ? taxCode.nextElementSibling : null; 466 471 467 472 // No UE check … … 666 671 var taxCode = document.getElementById('pms_tax_code'); 667 672 668 console.log('toggle:', type, 'event:', ev.type); 673 if (!invoiceType) { 674 console.log('[POP-CZM] toggleFieldsDisplay: missing invoiceType, aborting.'); 675 return; 676 } 677 678 console.log('[POP-CZM] toggle:', type, 'event:', ev.type); 669 679 670 680 switch (type) { … … 817 827 }; 818 828 var cfDataFinal = new CodiceFiscale(args); 819 console.log(' CodiceFiscale di ' + args.name + ' ' + args.surname, cfDataFinal);829 console.log('[POP-CZM] CodiceFiscale di ' + args.name + ' ' + args.surname, cfDataFinal); 820 830 checkCodeFinal = (0 === cfDataFinal.code.indexOf(computeInverse.surname + computeInverse.name)); 821 831 } else { 822 832 checkCodeFinal = false; 823 833 } 824 console.log(' Check CF:', checkCodeFinal);834 console.log('[POP-CZM] Check CF:', checkCodeFinal); 825 835 if (!checkCodeFinal) { 826 836 setTimeout(function () { … … 831 841 832 842 //taxCode.value = ''; 833 console.log( wc_el_inv_invoice.pop_invalid_tax_code)843 console.log('[POP-CZM] pop_invalid_tax_code', wc_el_inv_invoice.pop_invalid_tax_code) 834 844 taxCode.insertAdjacentHTML('afterend', 835 845 "<p class='no-valid-cf'><small>(*) <b>" + CF + "</b> " + wc_el_inv_invoice.invalid_tax_code + "</small></p>" … … 927 937 sdi.setCustomValidity(""); 928 938 } else { 929 console.log( wc_el_inv_invoice.pop_invalid_sdi_pec)939 console.log('[POP-CZM] pop_invalid_sdi_pec', wc_el_inv_invoice.pop_invalid_sdi_pec) 930 940 sdi.setCustomValidity(wc_el_inv_invoice.pop_invalid_sdi_pec); 931 941 } … … 1031 1041 if (submit) { 1032 1042 submit.addEventListener('submit', function (event) { 1033 console.log( event.type)1043 console.log('[POP-CZM] submit event type:', event.type) 1034 1044 if (!taxCode.classList.contains('hide-field') && 'IT' === country.value) { 1035 1045 cfCheck(); -
woopop-electronic-invoice-free/trunk/addon/for/cozmos/assets/js/invoiceFields.min.js
r3418379 r3460146 24 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 25 */ 26 !function(e,t){const n=/^[a-zA-Z0-9]{7}$/,i=/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:\w*.?pec(?:.?\w+)*)$/i,l=/^(ATU[0-9]{8}|BE0[0-9]{9}|BG[0-9]{9,10}|CY[0-9]{8}L|CZ[0-9]{8,10}|DE[0-9]{9}|DK[0-9]{8}|EE[0-9]{9}|(EL|GR)[0-9]{9}|ES[0-9A-Z][0-9]{7}[0-9A-Z]|FI[0-9]{8}|FR[0-9A-Z]{2}[0-9]{9}|GB([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{13})|HU[0-9]{8}|IE[0-9][A-Z0-9][0-9]{5}[A-Z]{1,2}|IT[0-9]{11}|LT([0-9]{9}|[0-9]{12})|LU[0-9]{8}|LV[0-9]{11}|MT[0-9]{8}|NL[0-9]{9}B[0-9]{2}|PL[0-9]{10}|PT[0-9]{9}|RO[0-9]{2,10}|SE[0-9]{12}|SI[0-9]{8}|SK[0-9]{10})$/i;function s(){var t=document.getElementById("pms_invoice_type");if(!t)return!1;void 0!==window.PMS_ChosenStrings&&void 0!==e.fn.chosen&&e(t).chosen(PMS_ChosenStrings);var n=document.getElementById("pms_choice_type");if(!n)return!1;void 0!==e(n).select2&&e(n).chosen(PMS_ChosenStrings)}function d(e){var t=e.target.value,n=document.getElementById("pms_invoice_type"),i=document.getElementById("pms_choice_type");if(i&&r(i.value,e),!n)return!1;"IT"!==t?o(n.value,e):u(n.value,e),y(),v(),p()}function a(e){var n=document.getElementById("pms_billing_country"),i=e.target.value;n&&"IT"===n.value&&-1!==t.eu_vat_country.indexOf(n.value)?u(i,e):o(i,e),y(),v(),p()}function o(e,n){var i=document.getElementById("pms_billing_country"),l=document.querySelector(".pms-pms-choice-type"),s=document.querySelector(".pms-pms-invoice-type"),d=document.querySelector('.pms-pms-choice-type label[for*="pms_choice_type"]'),a=document.querySelector('.pms-pms-invoice-type label[for*="pms_invoice_type"]'),o=document.getElementById("pms_sdi_type"),u=document.querySelector(".pms-pms-sdi-type"),r=document.getElementById("pms_vat_number"),p=document.querySelector(".pms-pms-vat-number"),y=document.getElementById("pms_tax_code"),v=document.querySelector(".pms-pms-tax-code"),_=null;y&&(_=y.nextElementSibling)&&_.classList.contains("no-valid-cf")&&_.remove();var f=document.getElementById("pms_choice_type");if(u&&(u.style.display="none",o&&(o.classList.add("hide-field"),o.removeAttribute("required"),o.value="")),"change"===n.type&&(o&&(o.value=""),r&&(r.value="",m()),y&&(y.value="")),i&&"show"!==t.hide_outside_ue&&-1===t.eu_vat_country.indexOf(i.value))return c("private"),l&&(l.style.display="none",d&&d.firstElementChild&&d.firstElementChild.remove()),s&&(s.style.display="none",a&&a.firstElementChild&&a.firstElementChild.remove()),v&&(v.style.display="none",y.value="",y.classList.add("hide-field"),y.removeAttribute("required")),void(p&&(p.style.display="none",r.value="",r.classList.add("hide-field"),r.removeAttribute("required")));switch(l&&(d&&d.firstElementChild&&d.firstElementChild.remove(),l.style.display="block"),s&&(a&&a.firstElementChild&&a.firstElementChild.remove(),s.style.display="block"),"1"===t.invoice_required?(l&&(l.style.display="block"),s&&(s.style.display="block"),v&&(v.style.display="block",y&&(y.classList.remove("hide-field"),y.setAttribute("required","required"))),p&&(p.style.display="block",r&&(r.classList.remove("hide-field"),r.setAttribute("required","required")))):(v&&y&&y.removeAttribute("required"),p&&r&&r.removeAttribute("required")),s&&(s.style.display="block"),f&&"receipt"===f.value&&(s.style.display="none"),f&&"receipt"===f.value&&(e=""),e){default:case"private":r&&(p.style.display="none",r.classList.add("hide-field"),r.removeAttribute("required")),y&&(v.style.display="block",y.classList.remove("hide-field"));break;case"company":case"freelance":r&&(p.style.display="block",r.classList.remove("hide-field")),y&&"on"===t.disable_cf&&(v&&(v.style.display="none"),y&&(y.classList.add("hide-field"),y.removeAttribute("required")));break;case"":v&&(v.style.display="none",y.classList.add("hide-field")),u&&(u.style.display="none",o.classList.add("hide-field")),p&&(p.style.display="none",r.classList.add("hide-field"))}y&&"private"!==e&&"company"!==e&&"freelance"!==e&&_&&_.classList.contains("no-valid-cf")&&_.remove(),c(e)}function c(e){var t=document.getElementById("pms_billing_company");t&&(console.log("toggleBillingCompany"),"company"===e?t.setAttribute("required","required"):t.removeAttribute("required"))}function u(e,n){var i=document.getElementById("pms_billing_country"),l=document.querySelector(".pms-pms-choice-type"),s=document.querySelector(".pms-pms-invoice-type"),d=document.getElementById("pms_choice_type"),a=document.getElementById("pms_sdi_type"),o=document.querySelector(".pms-pms-sdi-type"),u=document.getElementById("pms_vat_number"),y=document.querySelector(".pms-pms-vat-number"),v=document.getElementById("pms_tax_code"),_=document.querySelector(".pms-pms-tax-code"),f=v.nextElementSibling;if(-1!==t.eu_vat_country.indexOf(i.value)&&"IT"===i.value){switch("change"===n.type&&(a&&(a.value=""),u&&(u.value="",m()),v&&(v.value="")),l&&(l.style.display="block"),s&&(s.style.display="block"),_&&(_.style.display="block",v.classList.remove("hide-field")),y&&(y.style.display="block",u.classList.remove("hide-field")),e){default:case"private":v&&(i&&"IT"===i.value&&v&&"on"===t.active_js_cf_check&&(p(),v.dispatchEvent(new Event("change"))),_.style.display="block",v.classList.remove("hide-field"),v.setAttribute("required","required")),o&&(o.style.display="none",a&&(a.value="",a.classList.add("hide-field"),a.removeAttribute("required"))),y&&(y.style.display="none",u&&(u.classList.add("hide-field"),u.removeAttribute("required")));break;case"company":case"freelance":o&&("on"!==t.disable_pec_sdi?(o.style.display="block",a&&(a.classList.remove("hide-field"),a.setAttribute("required","required"))):(o.style.display="none",a&&(a.classList.add("hide-field"),a.removeAttribute("required")))),y&&(y.style.display="block",u&&(u.classList.remove("hide-field"),u.setAttribute("required","required"))),v&&"on"!==t.disable_cf?(_.style.display="block",v.classList.remove("hide-field"),v.setAttribute("required","required")):v&&"on"===t.disable_cf&&_&&(_.style.display="none",v.classList.add("hide-field"),v.removeAttribute("required")),v&&f&&f.remove();break;case"":_&&(_.style.display="none",v.classList.add("hide-field")),o&&(o.style.display="none",a.classList.add("hide-field")),y&&(y.style.display="none",u.classList.add("hide-field"))}if(v&&"private"!==e&&"company"!==e&&"freelance"!==e&&f&&f.classList.contains("no-valid-cf")&&f.remove(),d){var h=d.options[d.selectedIndex];h&&"receipt"===h.value&&r(h.value,n)}c(e)}}function r(e,t){var n=document.getElementById("pms_invoice_type"),i=document.querySelector(".pms-pms-invoice-type"),l=document.querySelector(".pms-pms-sdi-type"),s=document.querySelector(".pms-pms-vat-number"),d=document.querySelector(".pms-pms-tax-code"),a=document.getElementById("pms_sdi_type"),o=document.getElementById("pms_vat_number"),r=document.getElementById("pms_tax_code");switch(console.log("toggle:",e,"event:",t.type),e){case"invoice":var p=document.getElementById("pms_billing_country");""===n.options[n.selectedIndex].value?i.style.display="block":(i.style.display="block","private"===n.options[n.selectedIndex].value?(d&&(d.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==r.value||(r.value="")):"company"!==n.options[n.selectedIndex].value&&"freelance"!==n.options[n.selectedIndex].value||(o&&(s.style.display="block","load"!==t.type&&(o.classList.remove("hide-field"),o.value="",m())),"IT"===p.value&&a&&(l.style.display="block","load"!==t.type&&(a.classList.remove("hide-field"),a.value="")),r&&(d.style.display="block","load"!==t.type&&(r.classList.remove("hide-field"),r.value=""))),u(n.options[n.selectedIndex].value,t));break;case"receipt":c(null),o&&(o.value="IT11111111111",s.style.display="none",o.classList.add("hide-field")),a&&(a.value="1111111",l.style.display="none",a.classList.add("hide-field")),r&&(r.value="XXXXXX00L00L000X",d.style.display="none",r.classList.add("hide-field")),i.style.display="none";break;case"reset":c(null),o&&(o.value="",m()),a&&(a.value=""),r&&(r.value="")}}function m(){var e=document.getElementById("pms_vat_number"),t=document.getElementById("pms_billing_country").value;e.value=t+e.value.replace(/^[A-Za-z]*/,"")}function p(){var n=document.getElementById("pms_billing_first_name"),i=document.getElementById("pms_billing_last_name"),l=document.getElementById("pms_tax_code"),s=document.getElementById("pms_invoice_type"),d=!1,a={};l.classList.contains("hide-field")||(e(n).on("change",(function(){l.value=""})),e(i).on("change",(function(){l.value=""})),e(l).on("change",(function(){l.setCustomValidity("");var e=this.value.toUpperCase(),n=CodiceFiscale.check(e);if("private"===s.options[s.selectedIndex].value){if(this.value.length<=16&&!0===n){a=CodiceFiscale.computeInverse(e);var i={name:document.getElementById("pms_billing_first_name").value,surname:document.getElementById("pms_billing_last_name").value,gender:a.gender,birthday:a.birthday,birthplace:a.birthplace},o=new CodiceFiscale(i);console.log("CodiceFiscale di "+i.name+" "+i.surname,o),d=0===o.code.indexOf(a.surname+a.name)}else d=!1;if(console.log("Check CF:",d),d){var c=l.nextElementSibling;return c&&c.classList.contains("no-valid-cf")&&c.remove(),l.setCustomValidity(""),!0}return setTimeout((function(){var n=l.nextElementSibling;n&&n.remove(),console.log(t.pop_invalid_tax_code),l.insertAdjacentHTML("afterend","<p class='no-valid-cf'><small>(*) <b>"+e+"</b> "+t.invalid_tax_code+"</small></p>"),l.setCustomValidity(t.pop_invalid_tax_code)}),200),!1}l.setCustomValidity("")})))}function y(){var n=document.getElementById("pms_vat_number"),i=document.getElementById("pms_billing_country"),s=document.getElementById("pms_invoice_type");n.classList.contains("hide-field")||(e(document).ready((function(){m()})),e(i).on("change",(function(){m()})),e(s).on("change",(function(){m()})),e(n).on("change",(function(e){var t=document.querySelectorAll(".pms_field-success-wrapper");if(setTimeout((function(){t.forEach((function(e,t){e.remove()}))}),500),l.test(n.value)){var i=document.querySelector(".pms_field-errors-wrapper.pms-is-js");i&&i.remove()}})),e(n).on("input",(function(){var e=i.value;0!==n.value.indexOf(e)&&(n.value=e+n.value.slice(e.length)),l.test(n.value)?n.setCustomValidity(""):n.setCustomValidity(t.pop_invalid_vat_number),n.reportValidity()})),e(n).on("keydown",(function(e){var t=i.value;n.selectionStart<t.length&&e.preventDefault()})))}function v(){var l=document.getElementById("pms_sdi_type");l.classList.contains("hide-field")||e(l).on("change",(function(){n.test(l.value)||i.test(l.value)?l.setCustomValidity(""):(console.log(t.pop_invalid_sdi_pec),l.setCustomValidity(t.pop_invalid_sdi_pec)),l.reportValidity()}))}!function(){var e=document.getElementById("pms_invoice_type"),t=document.getElementById("pms_billing_country");if(!e||!t)return!1;document.addEventListener("DOMContentLoaded",(function(){e.onchange=a}),!1),document.addEventListener("DOMContentLoaded",(function(){t.onchange=d}),!1)}(),e(document).ajaxComplete((function(e,t,n){var i=document.getElementById("pms_vat_number"),l=new URLSearchParams(n.data);l.has("action")&&("pms_tax_validate_vat"===l.get("action")&&(y(),i.dispatchEvent(new Event("change"))))})),window.addEventListener("load",(function(n){var i=document.getElementById("pms_invoice_type"),l=document.getElementById("pms_billing_country"),d=document.getElementById("pms_tax_code"),a=document.getElementById("pms_sdi_type"),c=document.getElementById("pms_vat_number");if(!i)return!1;if(!l)return!1;(l&&"IT"===l.value&&-1!==t.eu_vat_country.indexOf(t.country)?"select"===i.tagName.toLowerCase()?u(i.options[i.selectedIndex].value,n):"input"===i.tagName.toLowerCase()&&u(i.value,n):"select"===i.tagName.toLowerCase()?o(i.options[i.selectedIndex].value,n):"input"===i.tagName.toLowerCase()&&o(i.value,n),l&&function(e,t,n){"IT"!==e?o(t,n):u(t,n)}(l.value,i.value,n),function(t){var n=document.getElementById("pms_choice_type");s(),n&&"load"===t.type&&r(n.options[n.selectedIndex].value,t),n&&e(n).on("change",(function(e){r(this.value,e)}))}(n),s(),function(){var e=document.getElementById("pms_invoice_type"),n=document.getElementById("pms_vat_number"),i=document.getElementById("pms_tax_code");"on"!==t.disable_cf&&!(!n&&!i)&&n.addEventListener("keyup",(function(t){if(e&&"company"!==e.value)return!1;i.value=this.value,i.dispatchEvent(new Event("change"))}))}(),l&&"IT"===l.value&&!d.classList.contains("hide-field")&&"on"===t.active_js_cf_check&&(p(),d.dispatchEvent(new Event("change"))),l&&"IT"===l.value&&c.classList.contains("hide-field")&&(y(),c.dispatchEvent(new Event("change"))),l&&"IT"===l.value&&!a.classList.contains("hide-field")&&(v(),a.dispatchEvent(new Event("change"))),l&&"IT"===l.value&&(c||a||d))&&[document.getElementsByName("pms_change_subscription")[0],document.getElementsByName("pms_new_subscription")[0]].forEach((function(e){e&&e.addEventListener("submit",(function(e){console.log(e.type),d.classList.contains("hide-field")||"IT"!==l.value||p(),c.classList.contains("hide-field")||y(),a.classList.contains("hide-field")||"IT"!==l.value||v(),this.checkValidity()||e.preventDefault()}))}))}))}(jQuery,window.wc_el_inv_invoice);26 !function(e,t){const i=/^[a-zA-Z0-9]{7}$/,n=/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:\w*.?pec(?:.?\w+)*)$/i,l=/^(ATU[0-9]{8}|BE0[0-9]{9}|BG[0-9]{9,10}|CY[0-9]{8}L|CZ[0-9]{8,10}|DE[0-9]{9}|DK[0-9]{8}|EE[0-9]{9}|(EL|GR)[0-9]{9}|ES[0-9A-Z][0-9]{7}[0-9A-Z]|FI[0-9]{8}|FR[0-9A-Z]{2}[0-9]{9}|GB([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{13})|HU[0-9]{8}|IE[0-9][A-Z0-9][0-9]{5}[A-Z]{1,2}|IT[0-9]{11}|LT([0-9]{9}|[0-9]{12})|LU[0-9]{8}|LV[0-9]{11}|MT[0-9]{8}|NL[0-9]{9}B[0-9]{2}|PL[0-9]{10}|PT[0-9]{9}|RO[0-9]{2,10}|SE[0-9]{12}|SI[0-9]{8}|SK[0-9]{10})$/i;function s(){var t=document.getElementById("pms_invoice_type");if(!t)return!1;void 0!==window.PMS_ChosenStrings&&void 0!==e.fn.chosen&&e(t).chosen(PMS_ChosenStrings);var i=document.getElementById("pms_choice_type");if(!i)return!1;void 0!==e(i).select2&&e(i).chosen(PMS_ChosenStrings)}function d(e){var t=e.target.value,i=document.getElementById("pms_invoice_type"),n=document.getElementById("pms_choice_type");if(n&&r(n.value,e),!i)return console.log("[POP-CZM] changeCountryEventHandler: missing invoiceType, aborting."),!1;"IT"!==t?o(i.value,e):u(i.value,e),y(),v(),p()}function a(e){var i=document.getElementById("pms_billing_country"),n=e.target.value;i&&"IT"===i.value&&-1!==t.eu_vat_country.indexOf(i.value)?u(n,e):o(n,e),y(),v(),p()}function o(e,i){var n=document.getElementById("pms_billing_country"),l=document.querySelector(".pms-pms-choice-type"),s=document.querySelector(".pms-pms-invoice-type"),d=document.querySelector('.pms-pms-choice-type label[for*="pms_choice_type"]'),a=document.querySelector('.pms-pms-invoice-type label[for*="pms_invoice_type"]'),o=document.getElementById("pms_sdi_type"),u=document.querySelector(".pms-pms-sdi-type"),r=document.getElementById("pms_vat_number"),p=document.querySelector(".pms-pms-vat-number"),y=document.getElementById("pms_tax_code"),v=document.querySelector(".pms-pms-tax-code"),_=null;y&&(_=y.nextElementSibling)&&_.classList.contains("no-valid-cf")&&_.remove();var f=document.getElementById("pms_choice_type");if(u&&(u.style.display="none",o&&(o.classList.add("hide-field"),o.removeAttribute("required"),o.value="")),"change"===i.type&&(o&&(o.value=""),r&&(r.value="",m()),y&&(y.value="")),n&&"show"!==t.hide_outside_ue&&-1===t.eu_vat_country.indexOf(n.value))return c("private"),l&&(l.style.display="none",d&&d.firstElementChild&&d.firstElementChild.remove()),s&&(s.style.display="none",a&&a.firstElementChild&&a.firstElementChild.remove()),v&&(v.style.display="none",y.value="",y.classList.add("hide-field"),y.removeAttribute("required")),void(p&&(p.style.display="none",r.value="",r.classList.add("hide-field"),r.removeAttribute("required")));switch(l&&(d&&d.firstElementChild&&d.firstElementChild.remove(),l.style.display="block"),s&&(a&&a.firstElementChild&&a.firstElementChild.remove(),s.style.display="block"),"1"===t.invoice_required?(l&&(l.style.display="block"),s&&(s.style.display="block"),v&&(v.style.display="block",y&&(y.classList.remove("hide-field"),y.setAttribute("required","required"))),p&&(p.style.display="block",r&&(r.classList.remove("hide-field"),r.setAttribute("required","required")))):(v&&y&&y.removeAttribute("required"),p&&r&&r.removeAttribute("required")),s&&(s.style.display="block"),f&&"receipt"===f.value&&(s.style.display="none"),f&&"receipt"===f.value&&(e=""),e){default:case"private":r&&(p.style.display="none",r.classList.add("hide-field"),r.removeAttribute("required")),y&&(v.style.display="block",y.classList.remove("hide-field"));break;case"company":case"freelance":r&&(p.style.display="block",r.classList.remove("hide-field")),y&&"on"===t.disable_cf&&(v&&(v.style.display="none"),y&&(y.classList.add("hide-field"),y.removeAttribute("required")));break;case"":v&&(v.style.display="none",y.classList.add("hide-field")),u&&(u.style.display="none",o.classList.add("hide-field")),p&&(p.style.display="none",r.classList.add("hide-field"))}y&&"private"!==e&&"company"!==e&&"freelance"!==e&&_&&_.classList.contains("no-valid-cf")&&_.remove(),c(e)}function c(e){var t=document.getElementById("pms_billing_company");t&&(console.log("[POP-CZM] toggleBillingCompany"),"company"===e?t.setAttribute("required","required"):t.removeAttribute("required"))}function u(e,i){var n=document.getElementById("pms_billing_country");if(n){var l=document.querySelector(".pms-pms-choice-type"),s=document.querySelector(".pms-pms-invoice-type"),d=document.getElementById("pms_choice_type"),a=document.getElementById("pms_sdi_type"),o=document.querySelector(".pms-pms-sdi-type"),u=document.getElementById("pms_vat_number"),y=document.querySelector(".pms-pms-vat-number"),v=document.getElementById("pms_tax_code"),_=document.querySelector(".pms-pms-tax-code"),f=v?v.nextElementSibling:null;if(-1!==t.eu_vat_country.indexOf(n.value)&&"IT"===n.value){switch("change"===i.type&&(a&&(a.value=""),u&&(u.value="",m()),v&&(v.value="")),l&&(l.style.display="block"),s&&(s.style.display="block"),_&&(_.style.display="block",v.classList.remove("hide-field")),y&&(y.style.display="block",u.classList.remove("hide-field")),e){default:case"private":v&&(n&&"IT"===n.value&&v&&"on"===t.active_js_cf_check&&(p(),v.dispatchEvent(new Event("change"))),_.style.display="block",v.classList.remove("hide-field"),v.setAttribute("required","required")),o&&(o.style.display="none",a&&(a.value="",a.classList.add("hide-field"),a.removeAttribute("required"))),y&&(y.style.display="none",u&&(u.classList.add("hide-field"),u.removeAttribute("required")));break;case"company":case"freelance":o&&("on"!==t.disable_pec_sdi?(o.style.display="block",a&&(a.classList.remove("hide-field"),a.setAttribute("required","required"))):(o.style.display="none",a&&(a.classList.add("hide-field"),a.removeAttribute("required")))),y&&(y.style.display="block",u&&(u.classList.remove("hide-field"),u.setAttribute("required","required"))),v&&"on"!==t.disable_cf?(_.style.display="block",v.classList.remove("hide-field"),v.setAttribute("required","required")):v&&"on"===t.disable_cf&&_&&(_.style.display="none",v.classList.add("hide-field"),v.removeAttribute("required")),v&&f&&f.remove();break;case"":_&&(_.style.display="none",v.classList.add("hide-field")),o&&(o.style.display="none",a.classList.add("hide-field")),y&&(y.style.display="none",u.classList.add("hide-field"))}if(v&&"private"!==e&&"company"!==e&&"freelance"!==e&&f&&f.classList.contains("no-valid-cf")&&f.remove(),d){var g=d.options[d.selectedIndex];g&&"receipt"===g.value&&r(g.value,i)}c(e)}}else console.log("[POP-CZM] switchType: missing country, aborting.")}function r(e,t){var i=document.getElementById("pms_invoice_type"),n=document.querySelector(".pms-pms-invoice-type"),l=document.querySelector(".pms-pms-sdi-type"),s=document.querySelector(".pms-pms-vat-number"),d=document.querySelector(".pms-pms-tax-code"),a=document.getElementById("pms_sdi_type"),o=document.getElementById("pms_vat_number"),r=document.getElementById("pms_tax_code");if(i)switch(console.log("[POP-CZM] toggle:",e,"event:",t.type),e){case"invoice":var p=document.getElementById("pms_billing_country");""===i.options[i.selectedIndex].value?n.style.display="block":(n.style.display="block","private"===i.options[i.selectedIndex].value?(d&&(d.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==r.value||(r.value="")):"company"!==i.options[i.selectedIndex].value&&"freelance"!==i.options[i.selectedIndex].value||(o&&(s.style.display="block","load"!==t.type&&(o.classList.remove("hide-field"),o.value="",m())),"IT"===p.value&&a&&(l.style.display="block","load"!==t.type&&(a.classList.remove("hide-field"),a.value="")),r&&(d.style.display="block","load"!==t.type&&(r.classList.remove("hide-field"),r.value=""))),u(i.options[i.selectedIndex].value,t));break;case"receipt":c(null),o&&(o.value="IT11111111111",s.style.display="none",o.classList.add("hide-field")),a&&(a.value="1111111",l.style.display="none",a.classList.add("hide-field")),r&&(r.value="XXXXXX00L00L000X",d.style.display="none",r.classList.add("hide-field")),n.style.display="none";break;case"reset":c(null),o&&(o.value="",m()),a&&(a.value=""),r&&(r.value="")}else console.log("[POP-CZM] toggleFieldsDisplay: missing invoiceType, aborting.")}function m(){var e=document.getElementById("pms_vat_number"),t=document.getElementById("pms_billing_country").value;e.value=t+e.value.replace(/^[A-Za-z]*/,"")}function p(){var i=document.getElementById("pms_billing_first_name"),n=document.getElementById("pms_billing_last_name"),l=document.getElementById("pms_tax_code"),s=document.getElementById("pms_invoice_type"),d=!1,a={};l.classList.contains("hide-field")||(e(i).on("change",(function(){l.value=""})),e(n).on("change",(function(){l.value=""})),e(l).on("change",(function(){l.setCustomValidity("");var e=this.value.toUpperCase(),i=CodiceFiscale.check(e);if("private"===s.options[s.selectedIndex].value){if(this.value.length<=16&&!0===i){a=CodiceFiscale.computeInverse(e);var n={name:document.getElementById("pms_billing_first_name").value,surname:document.getElementById("pms_billing_last_name").value,gender:a.gender,birthday:a.birthday,birthplace:a.birthplace},o=new CodiceFiscale(n);console.log("[POP-CZM] CodiceFiscale di "+n.name+" "+n.surname,o),d=0===o.code.indexOf(a.surname+a.name)}else d=!1;if(console.log("[POP-CZM] Check CF:",d),d){var c=l.nextElementSibling;return c&&c.classList.contains("no-valid-cf")&&c.remove(),l.setCustomValidity(""),!0}return setTimeout((function(){var i=l.nextElementSibling;i&&i.remove(),console.log("[POP-CZM] pop_invalid_tax_code",t.pop_invalid_tax_code),l.insertAdjacentHTML("afterend","<p class='no-valid-cf'><small>(*) <b>"+e+"</b> "+t.invalid_tax_code+"</small></p>"),l.setCustomValidity(t.pop_invalid_tax_code)}),200),!1}l.setCustomValidity("")})))}function y(){var i=document.getElementById("pms_vat_number"),n=document.getElementById("pms_billing_country"),s=document.getElementById("pms_invoice_type");i.classList.contains("hide-field")||(e(document).ready((function(){m()})),e(n).on("change",(function(){m()})),e(s).on("change",(function(){m()})),e(i).on("change",(function(e){var t=document.querySelectorAll(".pms_field-success-wrapper");if(setTimeout((function(){t.forEach((function(e,t){e.remove()}))}),500),l.test(i.value)){var n=document.querySelector(".pms_field-errors-wrapper.pms-is-js");n&&n.remove()}})),e(i).on("input",(function(){var e=n.value;0!==i.value.indexOf(e)&&(i.value=e+i.value.slice(e.length)),l.test(i.value)?i.setCustomValidity(""):i.setCustomValidity(t.pop_invalid_vat_number),i.reportValidity()})),e(i).on("keydown",(function(e){var t=n.value;i.selectionStart<t.length&&e.preventDefault()})))}function v(){var l=document.getElementById("pms_sdi_type");l.classList.contains("hide-field")||e(l).on("change",(function(){i.test(l.value)||n.test(l.value)?l.setCustomValidity(""):(console.log("[POP-CZM] pop_invalid_sdi_pec",t.pop_invalid_sdi_pec),l.setCustomValidity(t.pop_invalid_sdi_pec)),l.reportValidity()}))}!function(){var e=document.getElementById("pms_invoice_type"),t=document.getElementById("pms_billing_country");if(!e||!t)return!1;document.addEventListener("DOMContentLoaded",(function(){e.onchange=a}),!1),document.addEventListener("DOMContentLoaded",(function(){t.onchange=d}),!1)}(),e(document).ajaxComplete((function(e,t,i){var n=document.getElementById("pms_vat_number"),l=new URLSearchParams(i.data);l.has("action")&&("pms_tax_validate_vat"===l.get("action")&&(y(),n.dispatchEvent(new Event("change"))))})),window.addEventListener("load",(function(i){var n=document.getElementById("pms_invoice_type"),l=document.getElementById("pms_billing_country"),d=document.getElementById("pms_tax_code"),a=document.getElementById("pms_sdi_type"),c=document.getElementById("pms_vat_number");if(!n)return!1;if(!l)return!1;(l&&"IT"===l.value&&-1!==t.eu_vat_country.indexOf(t.country)?"select"===n.tagName.toLowerCase()?u(n.options[n.selectedIndex].value,i):"input"===n.tagName.toLowerCase()&&u(n.value,i):"select"===n.tagName.toLowerCase()?o(n.options[n.selectedIndex].value,i):"input"===n.tagName.toLowerCase()&&o(n.value,i),l&&function(e,t,i){"IT"!==e?o(t,i):u(t,i)}(l.value,n.value,i),function(t){var i=document.getElementById("pms_choice_type");s(),i&&"load"===t.type&&r(i.options[i.selectedIndex].value,t),i&&e(i).on("change",(function(e){r(this.value,e)}))}(i),s(),function(){var e=document.getElementById("pms_invoice_type"),i=document.getElementById("pms_vat_number"),n=document.getElementById("pms_tax_code");"on"!==t.disable_cf&&!(!i&&!n)&&i.addEventListener("keyup",(function(t){if(e&&"company"!==e.value)return!1;n.value=this.value,n.dispatchEvent(new Event("change"))}))}(),l&&"IT"===l.value&&!d.classList.contains("hide-field")&&"on"===t.active_js_cf_check&&(p(),d.dispatchEvent(new Event("change"))),l&&"IT"===l.value&&c.classList.contains("hide-field")&&(y(),c.dispatchEvent(new Event("change"))),l&&"IT"===l.value&&!a.classList.contains("hide-field")&&(v(),a.dispatchEvent(new Event("change"))),l&&"IT"===l.value&&(c||a||d))&&[document.getElementsByName("pms_change_subscription")[0],document.getElementsByName("pms_new_subscription")[0]].forEach((function(e){e&&e.addEventListener("submit",(function(e){console.log("[POP-CZM] submit event type:",e.type),d.classList.contains("hide-field")||"IT"!==l.value||p(),c.classList.contains("hide-field")||y(),a.classList.contains("hide-field")||"IT"!==l.value||v(),this.checkValidity()||e.preventDefault()}))}))}))}(jQuery,window.wc_el_inv_invoice); -
woopop-electronic-invoice-free/trunk/addon/for/cozmos/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/assets/js/pmpro-invoiceFields.js
r3418379 r3460146 139 139 var choiceType = document.getElementById('billing_choice_type'); 140 140 141 toggleFieldsDisplay(choiceType.value, event); 141 if (choiceType) { 142 toggleFieldsDisplay(choiceType.value, event); 143 } 142 144 143 145 if (!invoiceType) { 146 console.log('[POP-PMPRO] changeCountryEventHandler: missing invoiceType, aborting.'); 144 147 return false; 145 148 } … … 806 809 var taxCode = document.getElementById('billing_tax_code'); 807 810 808 console.log('toggle:', type, 'event:', ev.type); 811 if (!invoiceType) { 812 console.log('[POP-PMPRO] toggleFieldsDisplay: missing invoiceType, aborting.'); 813 return; 814 } 815 816 console.log('[POP-PMPRO] toggle:', type, 'event:', ev.type); 809 817 810 818 switch (type) { … … 961 969 }).then(response => response.json()) 962 970 .then(data => { 963 console.log( data);971 console.log('[POP-PMPRO] vies response:', data); 964 972 965 973 if (data.data.price) { … … 976 984 }) 977 985 .catch(err => { 978 console.log( err);986 console.log('[POP-PMPRO] vies error:', err); 979 987 }); 980 988 … … 1023 1031 }; 1024 1032 var cfDataFinal = new CodiceFiscale(args); 1025 console.log(' CodiceFiscale di ' + args.name + ' ' + args.surname, cfDataFinal);1033 console.log('[POP-PMPRO] CodiceFiscale di ' + args.name + ' ' + args.surname, cfDataFinal); 1026 1034 checkCodeFinal = (0 === cfDataFinal.code.indexOf(computeInverse.surname + computeInverse.name)); 1027 1035 } else { 1028 1036 checkCodeFinal = false; 1029 1037 } 1030 console.log(' Check CF:', checkCodeFinal);1038 console.log('[POP-PMPRO] Check CF:', checkCodeFinal); 1031 1039 if (!checkCodeFinal) { 1032 1040 setTimeout(function () { … … 1067 1075 } 1068 1076 1069 if (!invoiceType) { 1077 if (!invoiceType || (invoiceType.length !== undefined && !invoiceType.length)) { 1078 console.log('[POP-PMPRO] window.load: missing invoiceType, aborting.'); 1070 1079 return false; 1071 1080 } -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/assets/js/pmpro-invoiceFields.min.js
r3418379 r3460146 24 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 25 */ 26 !function(e,t){function i(){var t=document.getElementById("billing_invoice_type");if(!t)return!1;if(e(t).data("select2"))return!1;void 0!==e(t).select2&&e(t).select2({minimumResultsForSearch:3});var i=document.getElementById("billing_choice_type");return!!i&&(!e(i).data("select2")&&void(void 0!==e(i).select2&&e(i).select2({minimumResultsForSearch:3})))}function l(e){var t=e.target.value,i=document.getElementById("billing_invoice_type") ;if(s(document.getElementById("billing_choice_type").value,e),!i)return!1;"IT"!==t?a(i.value,e):d(i.value,e)}function n(e){var i=document.getElementById("bcountry"),l=e.target.value;i&&"IT"===i.value&&-1!==t.eu_vat_country.indexOf(i.value)?d(l,e):a(l,e)}function r(e,t,i){"IT"!==e?a(t,i):d(t,i)}function a(i,l){var n=document.getElementById("bcountry"),r=document.getElementById("billing_choice_type_div"),a=document.getElementById("billing_invoice_type_div"),d=document.querySelector('#billing_choice_type_div label[for*="billing_choice_type"]'),s=document.querySelector('#billing_invoice_type_div label[for*="billing_invoice_type"]'),c=document.getElementById("billing_sdi_type"),u=document.getElementById("billing_sdi_type_div"),m=document.querySelector('#billing_sdi_type_div label[for*="billing_sdi_type"]');if(m)var v=m.querySelector(".pmpro_asterisk");var y=document.getElementById("billing_vat_number"),_=document.getElementById("billing_vat_number_div"),p=document.querySelector('#billing_vat_number_div label[for="billing_vat_number"]');if(p)var b=p.querySelector(".pmpro_asterisk");var g=document.getElementById("billing_tax_code"),f=document.getElementById("billing_tax_code_div"),q=document.querySelector('#billing_tax_code_div label[for="billing_tax_code"]');if(g){if(q)var E=q.querySelector(".pmpro_asterisk");(h=g.nextElementSibling)&&h.classList.contains("no-valid-cf")&&h.remove()}var h,I=document.getElementById("billing_choice_type");if(u&&m&&(u.style.display="none",v&&(v.classList.remove("required"),v.classList.add("optional"),u.classList.remove("validate-required"),v.innerText="("+t.not_required_text+")"),c.removeAttribute("required"),c.value=""),"change"===l.type&&(c&&(c.value=""),y&&(y.value=""),g&&(g.value="")),n&&"show"!==t.hide_outside_ue&&-1===t.eu_vat_country.indexOf(n.value))return o("private"),r&&(r.style.display="none",d&&d.firstElementChild&&d.firstElementChild.remove()),a&&(a.style.display="none",s&&s.firstElementChild&&s.firstElementChild.remove()),f&&(f.style.display="none",g.value="",E&&E.classList.remove("required"),f.classList.remove("validate-required"),g.removeAttribute("required")),void(_&&(_.style.display="none",y.value="",_.classList.remove("validate-required"),y.removeAttribute("required")));switch(r&&(d&&d.firstElementChild&&d.firstElementChild.remove(),r.style.display="block"),a&&(s&&s.firstElementChild&&s.firstElementChild.remove(),a.style.display="block"),"1"===t.invoice_required?(r&&(r.style.display="block",(d&&d.firstElementChild&&"ABBR"!==d.firstElementChild.nodeName&&!d.querySelector(".pmpro_asterisk")||d&&null===d.firstElementChild)&&e(d).append('<abbr class="pmpro_asterisk required">*</abbr>')),a&&(a.style.display="block",(s&&s.firstElementChild&&"ABBR"!==s.firstElementChild.nodeName&&!s.querySelector(".pmpro_asterisk")||s&&null===s.firstElementChild)&&e(s).append('<abbr class="pmpro_asterisk required">*</abbr>')),f&&(f.style.display="block",f.classList.add("validate-required"),E&&(E.classList.remove("optional"),E.classList.add("required"),E.innerText="*",E.setAttribute("title",t.required_text)),g&&g.setAttribute("required","required")),_&&(_.style.display="block",_.classList.add("validate-required"),p&&!b&&e(p).append('<abbr class="pmpro_asterisk required">*</abbr>'),y&&y.setAttribute("required","required"))):(f&&(f.classList.remove("validate-required"),E&&(E.classList.remove("required"),E.classList.add("optional"),E.innerText="("+t.not_required_text+")"),g&&g.removeAttribute("required")),_&&(_.classList.remove("validate-required"),p&&!b&&e(p).append('<abbr class="pmpro_asterisk required">*</abbr>'),y&&y.removeAttribute("required"))),a&&(a.style.display="block"),I&&"receipt"===I.value&&(a.style.display="none"),I&&"receipt"===I.value&&(i=""),i){default:case"private":y&&(_.style.display="none",b&&(b.classList.remove("required"),b.classList.add("optional")),_.classList.remove("validate-required"),b&&b.remove(),y.removeAttribute("required")),g&&(f.style.display="block");break;case"company":case"freelance":y&&(_.style.display="block"),g&&"on"===t.disable_cf&&(f&&(f.style.display="none"),E&&(E.classList.remove("required"),E.classList.add("optional")),f&&f.classList.remove("validate-required"),E&&(E.innerText="("+t.not_required_text+")"),b&&(b.innerText="("+t.not_required_text+")"),g&&g.removeAttribute("required"));break;case"":f&&(f.style.display="none"),u&&(u.style.display="none"),_&&(_.style.display="none")}g&&"private"!==i&&"company"!==i&&"freelance"!==i&&((h=g.nextElementSibling)&&h.classList.contains("no-valid-cf")&&h.remove());o(i)}function o(t){var i=document.getElementById("billing_company_div");if(i){var l=document.getElementById("billing_company"),n=i.querySelector("label"),r=n.querySelector(".pmpro_asterisk");"company"===t?(i&&!r&&e(n).append('<abbr class="pmpro_asterisk required">*</abbr>'),i.style.display="block",l.setAttribute("required","required")):(r&&r.remove(),l.removeAttribute("required"),i.style.display="none")}}function d(i,l){var n=document.getElementById("bcountry"),r=document.getElementById("billing_choice_type_div"),a=document.getElementById("billing_invoice_type_div"),d=document.querySelector('#billing_choice_type_div label[for*="billing_choice_type"]'),c=document.querySelector('#billing_invoice_type_div label[for*="billing_invoice_type"]'),m=document.getElementById("billing_choice_type"),v=document.getElementById("billing_sdi_type"),y=document.getElementById("billing_sdi_type_div"),_=document.getElementById("billing_sdi_type"),p=document.querySelector('#billing_sdi_type_div label[for="billing_sdi_type"]'),b=document.querySelector("#billing_sdi_type_div #billing_sdi_type-description");if(v&&p)var g=p.querySelector(".pmpro_asterisk");var f=document.getElementById("billing_vat_number"),q=document.getElementById("billing_vat_number_div"),E=document.querySelector('#billing_vat_number_div label[for="billing_vat_number"]');if(E)var h=E.querySelector(".pmpro_asterisk");var I=document.getElementById("billing_tax_code"),x=document.getElementById("billing_tax_code_div"),B=document.querySelector('#billing_tax_code_div label[for="billing_tax_code"]');if(I&&B)var L=B.querySelector(".pmpro_asterisk");if(-1!==t.eu_vat_country.indexOf(n.value)&&"IT"===n.value){switch("change"===l.type&&(v&&(v.value=""),f&&(f.value=""),I&&(I.value="")),r&&(r.style.display="block",(d&&d.firstElementChild&&"ABBR"!==d.firstElementChild.nodeName&&!d.querySelector(".pmpro_asterisk")||d&&null===d.firstElementChild)&&e(d).append('<abbr class="pmpro_asterisk required">*</abbr>')),a&&(a.style.display="block",(c&&c.firstElementChild&&"ABBR"!==c.firstElementChild.nodeName&&!c.querySelector(".pmpro_asterisk")||c&&null===c.firstElementChild)&&e(c).append('<abbr class="pmpro_asterisk required">*</abbr>')),x&&(x.style.display="block"),q&&(q.style.display="block"),i){default:case"private":I&&(n&&"IT"===n.value&&I&&"on"===t.active_js_cf_check&&(u(),I.dispatchEvent(new Event("change"))),x.style.display="block",L&&(L.classList.remove("optional"),L.classList.add("required")),x.classList.add("validate-required"),L&&(L.innerText="*"),I.setAttribute("required","required")),y&&(y.style.display="none",v.value="",g&&(g.classList.remove("required"),g.classList.add("optional")),y.classList.remove("validate-required"),g&&(g.innerText="("+t.not_required_text+")"),v.removeAttribute("required")),q&&(q.style.display="none",h&&(h.classList.remove("required"),h.classList.add("optional")),q.classList.remove("validate-required"),h&&h.remove(),f&&f.removeAttribute("required"));break;case"company":case"freelance":if(y&&("on"!==t.disable_pec_sdi?(y.style.display="block",y.classList.add("validate-required"),g&&(g.classList.remove("optional"),g.classList.add("required"),g.innerText="*",g.setAttribute("title",t.required_text)),v.setAttribute("required","required"),b&&(b.innerText=t.sdi_description),_.placeholder=t.sdi_placeholder):(y.style.display="none",v.removeAttribute("required"))),q&&(q.style.display="block",q.classList.add("validate-required"),E&&!h&&e(E).append('<abbr class="pmpro_asterisk required">*</abbr>'),f&&f.setAttribute("required","required")),I&&"on"!==t.disable_cf?(x.style.display="block",x.classList.add("validate-required"),L&&(L.classList.remove("optional"),L.classList.add("required"),L.innerText="*",L.setAttribute("title",t.required_text)),I.setAttribute("required","required")):I&&"on"===t.disable_cf&&x&&(x.style.display="none",I.removeAttribute("required")),I)(k=I.nextElementSibling)&&k.remove();break;case"":x&&(x.style.display="none"),y&&(y.style.display="none"),q&&(q.style.display="none")}var k;if(I&&"private"!==i&&"company"!==i&&"freelance"!==i)(k=I.nextElementSibling)&&k.classList.contains("no-valid-cf")&&k.remove();var C=null;r&&m&&(C=m.options[m.selectedIndex]),C&&"receipt"===C.value&&s(C.value,l),o(i)}}function s(e,t){var i=document.getElementById("billing_invoice_type_div"),l=document.getElementById("billing_sdi_type_div"),n=document.getElementById("billing_vat_number_div"),r=document.getElementById("billing_tax_code_div"),a=document.getElementById("billing_invoice_type"),s=document.getElementById("billing_sdi_type"),c=document.getElementById("billing_company"),u=document.getElementById("billing_vat_number"),m=document.getElementById("billing_tax_code");switch(console.log("toggle:",e,"event:",t.type),e){case"invoice":var v=document.getElementById("bcountry");""===a.options[a.selectedIndex].value?i.style.display="block":(i.style.display="block","private"===a.options[a.selectedIndex].value?(r&&(r.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==m.value||(m.value="")):"company"!==a.options[a.selectedIndex].value&&"freelance"!==a.options[a.selectedIndex].value||(u&&(n.style.display="block","load"!==t.type&&(u.value="")),"IT"===v.value&&s&&(l.style.display="block","load"!==t.type&&(s.value="")),m&&(r.style.display="block","load"!==t.type&&(m.value=""))),d(a.options[a.selectedIndex].value,t));break;case"receipt":o(null),c&&(c.value=""),u&&(u.value="11111111111",n.style.display="none"),s&&(s.value="1111111",l.style.display="none"),m&&(m.value="XXXXXX00L00L000X",r.style.display="none"),i.style.display="none";break;case"reset":o(null),c&&(c.value=""),u&&(u.value=""),s&&(s.value=""),m&&(m.value="")}}function c(){!function(e){let i,l="",n="";e("#billing_vat_number, #billing_tax_code, #billing_choice_type, #billing_invoice_type").on("change blur",(function(){var r=e("#billing_vat_number_div .pmpro_form_label .valid_vies");clearTimeout(i),i=setTimeout((function(){const i=((a=jQuery("#pmpro_level").val())||(a=jQuery("#level").val()),a);var a;const o=e("#billing_invoice_type").val().trim(),d=e("#billing_vat_number").val().trim(),s=e("#bcountry").val().trim();d===l&&s===n||(r&&r.remove(),l=d,n=s,fetch(t.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"pmProViesCheck",vat_number:d,invoice_type:o,level:i,country:s})}).then((e=>e.json())).then((t=>{(console.log(t),t.data.price)&&(document.querySelector("#pmpro_level_cost .pmpro_level_cost_text strong").innerHTML=t.data.price);const i=e("#billing_vat_number_div label"),l=e('<small class="valid_vies" style="margin-left:10px;"></small>');l.text(t.data.message),l.css("color",t.success?"green":"red"),i.append(l)})).catch((e=>{console.log(e)})))}),300)}))}(jQuery)}function u(){var i=document.getElementById("billing_first_name"),l=document.getElementById("billing_last_name"),n=document.getElementById("billing_tax_code"),r=document.getElementById("billing_invoice_type"),a=!1,o={};e(i).on("change",(function(){n.value=""})),e(l).on("change",(function(){n.value=""})),e(n).on("change",(function(){n.setCustomValidity(""),n.classList.remove("pmpro_form_input-error");var e=this.value.toUpperCase(),i=CodiceFiscale.check(e);if("private"===r.options[r.selectedIndex].value){if(this.value.length<=16&&!0===i){o=CodiceFiscale.computeInverse(e);var l={name:document.getElementById("bfirstname").value,surname:document.getElementById("blastname").value,gender:o.gender,birthday:o.birthday,birthplace:o.birthplace},d=new CodiceFiscale(l);console.log("CodiceFiscale di "+l.name+" "+l.surname,d),a=0===d.code.indexOf(o.surname+o.name)}else a=!1;if(console.log("Check CF:",a),a){var s=n.nextElementSibling;return s&&s.classList.contains("no-valid-cf")&&s.remove(),!0}return setTimeout((function(){var i=n.nextElementSibling;i&&i.remove(),n.insertAdjacentHTML("afterend","<p class='no-valid-cf'><small>(*) <b>"+e+"</b> "+t.invalid_tax_code+"</small></p>"),n.classList.add("pmpro_form_input-error"),n.setCustomValidity(t.invalid_tax_code)}),200),!1}}))}!function(){var e=document.getElementById("billing_invoice_type"),t=document.getElementById("bcountry");if(!e||!t)return!1;document.addEventListener("DOMContentLoaded",(function(){e.onchange=n}),!1),document.addEventListener("DOMContentLoaded",(function(){t.onchange=l}),!1)}(),window.addEventListener("load",(function(l){var n=document.getElementById("billing_invoice_type"),o=document.getElementById("bcountry"),m=document.getElementById("billing_tax_code");if(n||(n=document.querySelectorAll("#billing_invoice_type.form-radios input[type=radio]")),!n)return!1;if(!o)return!1;if(o){var v=o.getAttribute("readonly");v&&"readonly"===v&&(o.closest("#bcountry").style.display="none")}var y=document.querySelector('label[for="billing_invoice_type"] .optional');y&&y.remove(),"SELECT"===n.tagName?(o&&"IT"===o.value&&-1!==t.eu_vat_country.indexOf(t.country)?"select"===n.tagName.toLowerCase()?d(n.options[n.selectedIndex].value,l):"input"===n.tagName.toLowerCase()&&d(n.value,l):"select"===n.tagName.toLowerCase()?a(n.options[n.selectedIndex].value,l):"input"===n.tagName.toLowerCase()&&a(n.value,l),o&&r(o.value,n.value,l)):(o&&"IT"===o.value&&-1!==t.eu_vat_country.indexOf(t.country)?d(n[0].value,l):a(n[0].value,l),o&&r(o.value,n[0].value,l)),function(t){var l=document.getElementById("billing_choice_type");i();var n=document.querySelector('#billing_choice_type label[for="billing_choice_type"] span.optional');n&&n.remove(),l&&"load"===t.type&&s(l.options[l.selectedIndex].value,t),l&&e(l).on("change",(function(e){s(this.value,e)}))}(l),i(),function(){var e=document.getElementById("billing_invoice_type"),i=document.getElementById("billing_vat_number"),l=document.getElementById("billing_tax_code");"on"!==t.disable_cf&&!(!i&&!l)&&(i&&i.addEventListener("keyup",(function(t){if(e&&"company"!==e.value)return!1;l.value=this.value})))}(),c(),o&&"IT"===o.value&&m&&"on"===t.active_js_cf_check&&(u(),m.dispatchEvent(new Event("change")))}))}(jQuery,window.wc_el_inv_invoice);26 !function(e,t){function i(){var t=document.getElementById("billing_invoice_type");if(!t)return!1;if(e(t).data("select2"))return!1;void 0!==e(t).select2&&e(t).select2({minimumResultsForSearch:3});var i=document.getElementById("billing_choice_type");return!!i&&(!e(i).data("select2")&&void(void 0!==e(i).select2&&e(i).select2({minimumResultsForSearch:3})))}function l(e){var t=e.target.value,i=document.getElementById("billing_invoice_type"),l=document.getElementById("billing_choice_type");if(l&&s(l.value,e),!i)return console.log("[POP-PMPRO] changeCountryEventHandler: missing invoiceType, aborting."),!1;"IT"!==t?a(i.value,e):d(i.value,e)}function n(e){var i=document.getElementById("bcountry"),l=e.target.value;i&&"IT"===i.value&&-1!==t.eu_vat_country.indexOf(i.value)?d(l,e):a(l,e)}function r(e,t,i){"IT"!==e?a(t,i):d(t,i)}function a(i,l){var n=document.getElementById("bcountry"),r=document.getElementById("billing_choice_type_div"),a=document.getElementById("billing_invoice_type_div"),d=document.querySelector('#billing_choice_type_div label[for*="billing_choice_type"]'),s=document.querySelector('#billing_invoice_type_div label[for*="billing_invoice_type"]'),c=document.getElementById("billing_sdi_type"),u=document.getElementById("billing_sdi_type_div"),m=document.querySelector('#billing_sdi_type_div label[for*="billing_sdi_type"]');if(m)var v=m.querySelector(".pmpro_asterisk");var y=document.getElementById("billing_vat_number"),_=document.getElementById("billing_vat_number_div"),p=document.querySelector('#billing_vat_number_div label[for="billing_vat_number"]');if(p)var b=p.querySelector(".pmpro_asterisk");var g=document.getElementById("billing_tax_code"),f=document.getElementById("billing_tax_code_div"),q=document.querySelector('#billing_tax_code_div label[for="billing_tax_code"]');if(g){if(q)var E=q.querySelector(".pmpro_asterisk");(h=g.nextElementSibling)&&h.classList.contains("no-valid-cf")&&h.remove()}var h,I=document.getElementById("billing_choice_type");if(u&&m&&(u.style.display="none",v&&(v.classList.remove("required"),v.classList.add("optional"),u.classList.remove("validate-required"),v.innerText="("+t.not_required_text+")"),c.removeAttribute("required"),c.value=""),"change"===l.type&&(c&&(c.value=""),y&&(y.value=""),g&&(g.value="")),n&&"show"!==t.hide_outside_ue&&-1===t.eu_vat_country.indexOf(n.value))return o("private"),r&&(r.style.display="none",d&&d.firstElementChild&&d.firstElementChild.remove()),a&&(a.style.display="none",s&&s.firstElementChild&&s.firstElementChild.remove()),f&&(f.style.display="none",g.value="",E&&E.classList.remove("required"),f.classList.remove("validate-required"),g.removeAttribute("required")),void(_&&(_.style.display="none",y.value="",_.classList.remove("validate-required"),y.removeAttribute("required")));switch(r&&(d&&d.firstElementChild&&d.firstElementChild.remove(),r.style.display="block"),a&&(s&&s.firstElementChild&&s.firstElementChild.remove(),a.style.display="block"),"1"===t.invoice_required?(r&&(r.style.display="block",(d&&d.firstElementChild&&"ABBR"!==d.firstElementChild.nodeName&&!d.querySelector(".pmpro_asterisk")||d&&null===d.firstElementChild)&&e(d).append('<abbr class="pmpro_asterisk required">*</abbr>')),a&&(a.style.display="block",(s&&s.firstElementChild&&"ABBR"!==s.firstElementChild.nodeName&&!s.querySelector(".pmpro_asterisk")||s&&null===s.firstElementChild)&&e(s).append('<abbr class="pmpro_asterisk required">*</abbr>')),f&&(f.style.display="block",f.classList.add("validate-required"),E&&(E.classList.remove("optional"),E.classList.add("required"),E.innerText="*",E.setAttribute("title",t.required_text)),g&&g.setAttribute("required","required")),_&&(_.style.display="block",_.classList.add("validate-required"),p&&!b&&e(p).append('<abbr class="pmpro_asterisk required">*</abbr>'),y&&y.setAttribute("required","required"))):(f&&(f.classList.remove("validate-required"),E&&(E.classList.remove("required"),E.classList.add("optional"),E.innerText="("+t.not_required_text+")"),g&&g.removeAttribute("required")),_&&(_.classList.remove("validate-required"),p&&!b&&e(p).append('<abbr class="pmpro_asterisk required">*</abbr>'),y&&y.removeAttribute("required"))),a&&(a.style.display="block"),I&&"receipt"===I.value&&(a.style.display="none"),I&&"receipt"===I.value&&(i=""),i){default:case"private":y&&(_.style.display="none",b&&(b.classList.remove("required"),b.classList.add("optional")),_.classList.remove("validate-required"),b&&b.remove(),y.removeAttribute("required")),g&&(f.style.display="block");break;case"company":case"freelance":y&&(_.style.display="block"),g&&"on"===t.disable_cf&&(f&&(f.style.display="none"),E&&(E.classList.remove("required"),E.classList.add("optional")),f&&f.classList.remove("validate-required"),E&&(E.innerText="("+t.not_required_text+")"),b&&(b.innerText="("+t.not_required_text+")"),g&&g.removeAttribute("required"));break;case"":f&&(f.style.display="none"),u&&(u.style.display="none"),_&&(_.style.display="none")}g&&"private"!==i&&"company"!==i&&"freelance"!==i&&((h=g.nextElementSibling)&&h.classList.contains("no-valid-cf")&&h.remove());o(i)}function o(t){var i=document.getElementById("billing_company_div");if(i){var l=document.getElementById("billing_company"),n=i.querySelector("label"),r=n.querySelector(".pmpro_asterisk");"company"===t?(i&&!r&&e(n).append('<abbr class="pmpro_asterisk required">*</abbr>'),i.style.display="block",l.setAttribute("required","required")):(r&&r.remove(),l.removeAttribute("required"),i.style.display="none")}}function d(i,l){var n=document.getElementById("bcountry"),r=document.getElementById("billing_choice_type_div"),a=document.getElementById("billing_invoice_type_div"),d=document.querySelector('#billing_choice_type_div label[for*="billing_choice_type"]'),c=document.querySelector('#billing_invoice_type_div label[for*="billing_invoice_type"]'),m=document.getElementById("billing_choice_type"),v=document.getElementById("billing_sdi_type"),y=document.getElementById("billing_sdi_type_div"),_=document.getElementById("billing_sdi_type"),p=document.querySelector('#billing_sdi_type_div label[for="billing_sdi_type"]'),b=document.querySelector("#billing_sdi_type_div #billing_sdi_type-description");if(v&&p)var g=p.querySelector(".pmpro_asterisk");var f=document.getElementById("billing_vat_number"),q=document.getElementById("billing_vat_number_div"),E=document.querySelector('#billing_vat_number_div label[for="billing_vat_number"]');if(E)var h=E.querySelector(".pmpro_asterisk");var I=document.getElementById("billing_tax_code"),x=document.getElementById("billing_tax_code_div"),B=document.querySelector('#billing_tax_code_div label[for="billing_tax_code"]');if(I&&B)var L=B.querySelector(".pmpro_asterisk");if(-1!==t.eu_vat_country.indexOf(n.value)&&"IT"===n.value){switch("change"===l.type&&(v&&(v.value=""),f&&(f.value=""),I&&(I.value="")),r&&(r.style.display="block",(d&&d.firstElementChild&&"ABBR"!==d.firstElementChild.nodeName&&!d.querySelector(".pmpro_asterisk")||d&&null===d.firstElementChild)&&e(d).append('<abbr class="pmpro_asterisk required">*</abbr>')),a&&(a.style.display="block",(c&&c.firstElementChild&&"ABBR"!==c.firstElementChild.nodeName&&!c.querySelector(".pmpro_asterisk")||c&&null===c.firstElementChild)&&e(c).append('<abbr class="pmpro_asterisk required">*</abbr>')),x&&(x.style.display="block"),q&&(q.style.display="block"),i){default:case"private":I&&(n&&"IT"===n.value&&I&&"on"===t.active_js_cf_check&&(u(),I.dispatchEvent(new Event("change"))),x.style.display="block",L&&(L.classList.remove("optional"),L.classList.add("required")),x.classList.add("validate-required"),L&&(L.innerText="*"),I.setAttribute("required","required")),y&&(y.style.display="none",v.value="",g&&(g.classList.remove("required"),g.classList.add("optional")),y.classList.remove("validate-required"),g&&(g.innerText="("+t.not_required_text+")"),v.removeAttribute("required")),q&&(q.style.display="none",h&&(h.classList.remove("required"),h.classList.add("optional")),q.classList.remove("validate-required"),h&&h.remove(),f&&f.removeAttribute("required"));break;case"company":case"freelance":if(y&&("on"!==t.disable_pec_sdi?(y.style.display="block",y.classList.add("validate-required"),g&&(g.classList.remove("optional"),g.classList.add("required"),g.innerText="*",g.setAttribute("title",t.required_text)),v.setAttribute("required","required"),b&&(b.innerText=t.sdi_description),_.placeholder=t.sdi_placeholder):(y.style.display="none",v.removeAttribute("required"))),q&&(q.style.display="block",q.classList.add("validate-required"),E&&!h&&e(E).append('<abbr class="pmpro_asterisk required">*</abbr>'),f&&f.setAttribute("required","required")),I&&"on"!==t.disable_cf?(x.style.display="block",x.classList.add("validate-required"),L&&(L.classList.remove("optional"),L.classList.add("required"),L.innerText="*",L.setAttribute("title",t.required_text)),I.setAttribute("required","required")):I&&"on"===t.disable_cf&&x&&(x.style.display="none",I.removeAttribute("required")),I)(k=I.nextElementSibling)&&k.remove();break;case"":x&&(x.style.display="none"),y&&(y.style.display="none"),q&&(q.style.display="none")}var k;if(I&&"private"!==i&&"company"!==i&&"freelance"!==i)(k=I.nextElementSibling)&&k.classList.contains("no-valid-cf")&&k.remove();var C=null;r&&m&&(C=m.options[m.selectedIndex]),C&&"receipt"===C.value&&s(C.value,l),o(i)}}function s(e,t){var i=document.getElementById("billing_invoice_type_div"),l=document.getElementById("billing_sdi_type_div"),n=document.getElementById("billing_vat_number_div"),r=document.getElementById("billing_tax_code_div"),a=document.getElementById("billing_invoice_type"),s=document.getElementById("billing_sdi_type"),c=document.getElementById("billing_company"),u=document.getElementById("billing_vat_number"),m=document.getElementById("billing_tax_code");if(a)switch(console.log("[POP-PMPRO] toggle:",e,"event:",t.type),e){case"invoice":var v=document.getElementById("bcountry");""===a.options[a.selectedIndex].value?i.style.display="block":(i.style.display="block","private"===a.options[a.selectedIndex].value?(r&&(r.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==m.value||(m.value="")):"company"!==a.options[a.selectedIndex].value&&"freelance"!==a.options[a.selectedIndex].value||(u&&(n.style.display="block","load"!==t.type&&(u.value="")),"IT"===v.value&&s&&(l.style.display="block","load"!==t.type&&(s.value="")),m&&(r.style.display="block","load"!==t.type&&(m.value=""))),d(a.options[a.selectedIndex].value,t));break;case"receipt":o(null),c&&(c.value=""),u&&(u.value="11111111111",n.style.display="none"),s&&(s.value="1111111",l.style.display="none"),m&&(m.value="XXXXXX00L00L000X",r.style.display="none"),i.style.display="none";break;case"reset":o(null),c&&(c.value=""),u&&(u.value=""),s&&(s.value=""),m&&(m.value="")}else console.log("[POP-PMPRO] toggleFieldsDisplay: missing invoiceType, aborting.")}function c(){!function(e){let i,l="",n="";e("#billing_vat_number, #billing_tax_code, #billing_choice_type, #billing_invoice_type").on("change blur",(function(){var r=e("#billing_vat_number_div .pmpro_form_label .valid_vies");clearTimeout(i),i=setTimeout((function(){const i=((a=jQuery("#pmpro_level").val())||(a=jQuery("#level").val()),a);var a;const o=e("#billing_invoice_type").val().trim(),d=e("#billing_vat_number").val().trim(),s=e("#bcountry").val().trim();d===l&&s===n||(r&&r.remove(),l=d,n=s,fetch(t.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"pmProViesCheck",vat_number:d,invoice_type:o,level:i,country:s})}).then((e=>e.json())).then((t=>{(console.log("[POP-PMPRO] vies response:",t),t.data.price)&&(document.querySelector("#pmpro_level_cost .pmpro_level_cost_text strong").innerHTML=t.data.price);const i=e("#billing_vat_number_div label"),l=e('<small class="valid_vies" style="margin-left:10px;"></small>');l.text(t.data.message),l.css("color",t.success?"green":"red"),i.append(l)})).catch((e=>{console.log("[POP-PMPRO] vies error:",e)})))}),300)}))}(jQuery)}function u(){var i=document.getElementById("billing_first_name"),l=document.getElementById("billing_last_name"),n=document.getElementById("billing_tax_code"),r=document.getElementById("billing_invoice_type"),a=!1,o={};e(i).on("change",(function(){n.value=""})),e(l).on("change",(function(){n.value=""})),e(n).on("change",(function(){n.setCustomValidity(""),n.classList.remove("pmpro_form_input-error");var e=this.value.toUpperCase(),i=CodiceFiscale.check(e);if("private"===r.options[r.selectedIndex].value){if(this.value.length<=16&&!0===i){o=CodiceFiscale.computeInverse(e);var l={name:document.getElementById("bfirstname").value,surname:document.getElementById("blastname").value,gender:o.gender,birthday:o.birthday,birthplace:o.birthplace},d=new CodiceFiscale(l);console.log("[POP-PMPRO] CodiceFiscale di "+l.name+" "+l.surname,d),a=0===d.code.indexOf(o.surname+o.name)}else a=!1;if(console.log("[POP-PMPRO] Check CF:",a),a){var s=n.nextElementSibling;return s&&s.classList.contains("no-valid-cf")&&s.remove(),!0}return setTimeout((function(){var i=n.nextElementSibling;i&&i.remove(),n.insertAdjacentHTML("afterend","<p class='no-valid-cf'><small>(*) <b>"+e+"</b> "+t.invalid_tax_code+"</small></p>"),n.classList.add("pmpro_form_input-error"),n.setCustomValidity(t.invalid_tax_code)}),200),!1}}))}!function(){var e=document.getElementById("billing_invoice_type"),t=document.getElementById("bcountry");if(!e||!t)return!1;document.addEventListener("DOMContentLoaded",(function(){e.onchange=n}),!1),document.addEventListener("DOMContentLoaded",(function(){t.onchange=l}),!1)}(),window.addEventListener("load",(function(l){var n=document.getElementById("billing_invoice_type"),o=document.getElementById("bcountry"),m=document.getElementById("billing_tax_code");if(n||(n=document.querySelectorAll("#billing_invoice_type.form-radios input[type=radio]")),!n||void 0!==n.length&&!n.length)return console.log("[POP-PMPRO] window.load: missing invoiceType, aborting."),!1;if(!o)return!1;if(o){var v=o.getAttribute("readonly");v&&"readonly"===v&&(o.closest("#bcountry").style.display="none")}var y=document.querySelector('label[for="billing_invoice_type"] .optional');y&&y.remove(),"SELECT"===n.tagName?(o&&"IT"===o.value&&-1!==t.eu_vat_country.indexOf(t.country)?"select"===n.tagName.toLowerCase()?d(n.options[n.selectedIndex].value,l):"input"===n.tagName.toLowerCase()&&d(n.value,l):"select"===n.tagName.toLowerCase()?a(n.options[n.selectedIndex].value,l):"input"===n.tagName.toLowerCase()&&a(n.value,l),o&&r(o.value,n.value,l)):(o&&"IT"===o.value&&-1!==t.eu_vat_country.indexOf(t.country)?d(n[0].value,l):a(n[0].value,l),o&&r(o.value,n[0].value,l)),function(t){var l=document.getElementById("billing_choice_type");i();var n=document.querySelector('#billing_choice_type label[for="billing_choice_type"] span.optional');n&&n.remove(),l&&"load"===t.type&&s(l.options[l.selectedIndex].value,t),l&&e(l).on("change",(function(e){s(this.value,e)}))}(l),i(),function(){var e=document.getElementById("billing_invoice_type"),i=document.getElementById("billing_vat_number"),l=document.getElementById("billing_tax_code");"on"!==t.disable_cf&&!(!i&&!l)&&(i&&i.addEventListener("keyup",(function(t){if(e&&"company"!==e.value)return!1;l.value=this.value})))}(),c(),o&&"IT"===o.value&&m&&"on"===t.active_js_cf_check&&(u(),m.dispatchEvent(new Event("change")))}))}(jQuery,window.wc_el_inv_invoice); -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/inc/filtersFront.php
r3418379 r3460146 311 311 } 312 312 313 // Update renewal order metas from user metas 313 global $wpdb; 314 315 // Data to sync on renewal 314 316 $meta_keys_group1 = [ 'billing_address1', 'billing_address2', 'billing_city', 'billing_postcode', 'billing_country', 'billing_state' ]; 315 317 $meta_keys_group2 = [ 'billing_choice_type', 'billing_invoice_type', 'billing_sdi_type', 'billing_vat_number', 'billing_company', 'billing_tax_code' ]; 316 318 317 // Since this will work as an override, let's ensure the user metas got updated during checkout. 318 if ( ! empty( get_user_meta( $order->user_id, 'billing_city', true ) ) ) { 319 // Try to fetch previous order for this subscription (may provide missing data) 320 $previous_order_id = $wpdb->get_var( $wpdb->prepare( " 321 SELECT id FROM {$wpdb->pmpro_membership_orders} 322 WHERE subscription_transaction_id = %s 323 AND id <> %d 324 ORDER BY id DESC 325 LIMIT 1 326 ", $order->subscription_transaction_id, $order->id ) ); 327 $previous_order = $previous_order_id ? \WcElectronInvoice\Providers\OrderQuery::instance()->getProviderOrder( $previous_order_id, 'pmpro' ) : null; 328 329 // Helper to pick the best available value: current order (if already set), user meta, previous order meta 330 $pick_value = function ( $meta_key, $order_prop = null ) use ( $order, $previous_order, $previous_order_id ) { 331 $current = ''; 332 if ( $order_prop && isset( $order->billing->$order_prop ) ) { 333 $current = $order->billing->$order_prop; 334 } else { 335 $current = get_pmpro_membership_order_meta( $order->id, $meta_key, true ); 336 } 337 338 if ( ! empty( $current ) ) { 339 return $current; 340 } 341 342 $user_value = $order->user_id ? get_user_meta( $order->user_id, $meta_key, true ) : ''; 343 if ( ! empty( $user_value ) ) { 344 return $user_value; 345 } 346 347 if ( $previous_order_id ) { 348 // Prefer explicit meta; fallback to billing property if available 349 $prev = get_pmpro_membership_order_meta( $previous_order_id, $meta_key, true ); 350 if ( empty( $prev ) && $previous_order && $order_prop && isset( $previous_order->billing->$order_prop ) ) { 351 $prev = $previous_order->billing->$order_prop; 352 } 353 354 if ( ! empty( $prev ) ) { 355 return $prev; 356 } 357 } 358 359 return ''; 360 }; 361 362 // Sync address data (fill blanks from user meta or previous order) 363 $billing_changed = false; 364 if ( ! isset( $order->billing ) ) { 319 365 $order->billing = new stdClass(); 320 foreach ( $meta_keys_group1 as $meta_key ) { 321 $meta_value = get_user_meta( $order->user_id, $meta_key, true ) ?: ''; 322 $order_prop_name = str_replace( 'billing_', '', $meta_key ); 323 324 $order->billing->$order_prop_name = $meta_value; 325 } 326 366 } 367 368 foreach ( $meta_keys_group1 as $meta_key ) { 369 $order_prop_name = str_replace( 'billing_', '', $meta_key ); 370 $best_value = $pick_value( $meta_key, $order_prop_name ); 371 372 if ( $best_value !== '' && ( ! isset( $order->billing->$order_prop_name ) || $order->billing->$order_prop_name !== $best_value ) ) { 373 $order->billing->$order_prop_name = $best_value; 374 $billing_changed = true; 375 } 376 } 377 378 if ( $billing_changed ) { 327 379 $order->saveOrder(); 328 380 } 329 381 330 // Same. Since this will work as an override, let's ensure the user metas got updated during checkout. 331 // This second group was introduced earlier, still some users might not have them in user meta. 332 if ( ! empty( get_user_meta( $order->user_id, 'billing_sdi_type', true ) ) ) { 333 foreach ( $meta_keys_group2 as $meta_key ) { 334 $meta_value = get_user_meta( $order->user_id, $meta_key, true ) ?: ''; 335 update_pmpro_membership_order_meta( $order->id, $meta_key, $meta_value ); 382 // Sync fiscal extras (invoice type, VAT, CF, etc.) 383 foreach ( $meta_keys_group2 as $meta_key ) { 384 $current_order_value = get_pmpro_membership_order_meta( $order->id, $meta_key, true ); 385 $best_value = $pick_value( $meta_key ); 386 387 if ( $best_value !== '' && $current_order_value !== $best_value ) { 388 update_pmpro_membership_order_meta( $order->id, $meta_key, $best_value ); 336 389 } 337 390 } -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/inc/snippets/billing-fields.php
r3409381 r3460146 7 7 8 8 $fields = apply_filters( 'wc_el_inv-billing_fields', [] ); 9 10 // @todo migliorare questo codice capendo il motivo per cui il filtro non torna i fields 11 if ( empty( $fields ) ) { 12 $fields = include_once \WcElectronInvoice\Plugin::getPluginDirPath( '/inc/billingFields.php' ); 13 } 9 14 10 15 $pop_mandatory_fields = []; -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/inc/snippets/council-directive-2006-112-ec.php
r3409381 r3460146 24 24 $fields[] = array( 25 25 'name' => 'enable_tax_calculation', 26 'field_name' => 'enable_tax_calculation', 26 27 'field_type' => 'callback', 27 28 'label' => __( 'Tax Calculation', WC_EL_INV_TEXTDOMAIN ), -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/src/Providers/Product.php
r3341137 r3460146 14 14 15 15 function get_id() { 16 return $this->product->level_id; 16 return ( is_object( $this->product ) && isset( $this->product->level_id ) ) 17 ? $this->product->level_id 18 : 0; 17 19 } 18 20 19 21 function get_sku() 20 22 { 23 // Guard against missing/invalid product to avoid "First parameter must either be an object..." notices. 24 if ( ! is_object( $this->product ) ) { 25 return ''; 26 } 27 21 28 $level_id = property_exists($this->product, 'level_id') ? $this->product->level_id : null; 22 29 if(! $level_id) { … … 36 43 37 44 function get_name() { 38 return $this->product->name;45 return is_object( $this->product ) && isset( $this->product->name ) ? $this->product->name : ''; 39 46 } 40 47 41 48 function get_short_description() { 42 return $this->product->description;49 return is_object( $this->product ) && isset( $this->product->description ) ? $this->product->description : ''; 43 50 } 44 51 45 52 function get_description() { 46 return $this-> product->description;53 return $this->get_short_description(); 47 54 } 48 55 } -
woopop-electronic-invoice-free/trunk/addon/for/pmpro/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woopop-electronic-invoice-free/trunk/addon/to/aruba/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woopop-electronic-invoice-free/trunk/addon/to/fattureincloud-stock/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woopop-electronic-invoice-free/trunk/addon/to/fattureincloud/changelog.txt
r3248026 r3460146 1 == 2.6.9 - 11/02/2026 == 2 Change: document date now always uses emission time (now); od_date uses operation date for invoices or linked document date for credit notes; invoice_date for credit notes uses the linked invoice date. 3 Removed: hook 'wfc-create-invoice_datetime-invoice' to prevent external overrides on od_date. 4 1 5 == 2.6.8 - 28/10/2024 == 2 6 Fixed: sendInvoice order check -
woopop-electronic-invoice-free/trunk/addon/to/fattureincloud/index.php
r3248026 r3460146 23 23 define('WP_FATT_CLOUD_NAME', 'POP to Fatture in Cloud'); 24 24 define('WP_FATT_CLOUD_TEXTDOMAIN', 'wfc'); 25 define('WP_FATT_CLOUD_VERSION', '2.6. 8');25 define('WP_FATT_CLOUD_VERSION', '2.6.9'); 26 26 define('WP_FATT_CLOUD_API', get_option('wfc_api_url')); 27 27 // Plugin DIR -
woopop-electronic-invoice-free/trunk/addon/to/fattureincloud/src/Functions/Api.php
r3382725 r3460146 1597 1597 } 1598 1598 1599 // Invoice date1599 // Dates handling 1600 1600 $invoiceDateTime = CreateXml::dateInvoice( 1601 1601 (object)[ … … 1613 1613 } 1614 1614 1615 /** 1616 * Filter invoice date 1617 */ 1618 $invoiceDateTime = apply_filters('wfc-create-invoice_datetime-invoice', $invoiceDateTime); 1619 1620 $invoiceDate = $invoiceDateTime->format('Y-m-d'); 1621 if ('shop_order_refund' === $orderType) { 1622 $invoiceDate = $parser[0]->FatturaElettronicaBody->DatiGenerali->DatiFattureCollegate->Data->__toString(); 1623 } 1624 1625 // Prev day 1615 // Data emissione documento: sempre adesso 1616 $docDateNow = new \DateTimeImmutable('now', $timeZone); 1617 1618 // Data fattura collegata (per note di credito) 1619 $linkedInvDate = null; 1620 if ('shop_order_refund' === $orderType && isset($parser[0]->FatturaElettronicaBody->DatiGenerali->DatiFattureCollegate->Data)) { 1621 $linkedInvDate = $parser[0]->FatturaElettronicaBody->DatiGenerali->DatiFattureCollegate->Data->__toString(); 1622 } 1623 1624 // Prev day safeguard kept for od_date only (SDI rifiuta date "indietro" se l'ora è troppo bassa) 1626 1625 \WooPoPToFattureInCloud\Functions\log("OrderID {$order->get_id()} - invoiceDate time: " . $invoiceDateTime->format('Y-m-d H:i')); 1627 1626 if ((int)$invoiceDateTime->format('H') <= 2) { 1628 1627 $invoiceDateTime->modify('- 1 day'); 1629 $invoiceDate = $invoiceDateTime->format('Y-m-d');1630 1628 \WooPoPToFattureInCloud\Functions\log("OrderID {$order->get_id()} - Set Prev invoiceDate: " . $invoiceDateTime->format('Y-m-d')); 1631 1629 } 1630 1631 // od_date da usare nel body (operazione per fatture, data doc originale per NC) 1632 $odDateValue = ('shop_order_refund' === $orderType && $linkedInvDate) 1633 ? $linkedInvDate 1634 : $invoiceDateTime->format('Y-m-d'); 1632 1635 1633 1636 // Options … … 1708 1711 'original_document_type' => 'ordine', 1709 1712 'od_number' => "{$orderID}", 1710 'invoice_date' => $invoiceDate,1713 // invoice_date viene valorizzato più sotto per gestire NC e fatture 1711 1714 'payment_method' => "{$payCode}", 1712 1715 ), … … 2098 2101 $body['data']['show_payments'] = true; 2099 2102 if (false === apply_filters('wfc-disabled_data_date_document', false, $jobEvent)) { 2100 $body['data']['date'] = $invoiceDate; 2101 } 2102 $body['data']['ei_data']['od_date'] = $invoiceDate; 2103 // data: data di emissione documento 2104 $body['data']['date'] = $docDateNow->format('Y-m-d'); 2105 } 2106 // od_date: documento originario (operazione per fatture, data fattura collegata per NC) 2107 $body['data']['ei_data']['od_date'] = $odDateValue; 2108 2109 // invoice_date: per NC è la data della fattura stornata; per le fatture impostiamo la data emissione 2110 if ('credit_note' === $documentType && $linkedInvDate) { 2111 $body['data']['ei_data']['invoice_date'] = $linkedInvDate; 2112 } else { 2113 $body['data']['ei_data']['invoice_date'] = $docDateNow->format('Y-m-d'); 2114 } 2103 2115 2104 2116 if ('credit_note' === $documentType) { -
woopop-electronic-invoice-free/trunk/addon/to/fattureincloud/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woopop-electronic-invoice-free/trunk/addon/to/sdi-pec/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woopop-electronic-invoice-free/trunk/assets/js/invoiceFields.js
r3418379 r3460146 33 33 function init() 34 34 { 35 console.log(' POP user level:', wc_el_inv_invoice.user_level);35 console.log('[POP-WC] user level:', wc_el_inv_invoice.user_level); 36 36 const wcBlockCheckout = window.wcSettings?.isCheckoutBlock || document.querySelector('.wc-block-checkout'); 37 37 … … 208 208 { 209 209 var country = event.target.value; 210 var invoiceType = document.getElementById('billing_invoice_type'); 211 var choiceType = document.getElementById('billing_choice_type'); 212 213 if (!invoiceType) { 214 invoiceType = document.querySelectorAll('#billing_invoice_type_field.form-radio_fields input[type=radio]'); 215 } 216 217 if (!choiceType) { 218 var choiceType = document.querySelectorAll('#billing_choice_type_field.form-radio_fields input[type=radio]'); 219 } 220 221 if (choiceType.length !== 0) { 222 if ('SELECT' === choiceType.tagName) { 223 toggleFieldsDisplay(choiceType.value, event); 224 } else { 225 var type = choiceType.length > 0 ? choiceType[0].getAttribute('type') : null; 226 var currentChoiceTypeValue = null; 227 if ('radio' === type) { 228 choiceType.forEach(function (radio) { 229 if (radio.checked) { 230 currentChoiceTypeValue = radio.value; 231 } 232 }) 233 } 234 console.log('changeCountryEventHandler > RADIO > currentChoiceTypeValue', currentChoiceTypeValue) 235 if (currentChoiceTypeValue) { 236 toggleFieldsDisplay(currentChoiceTypeValue, event); 237 } 238 } 239 } 240 241 if (!invoiceType) { 210 var invoiceTypeSelect = document.getElementById('billing_invoice_type'); 211 var invoiceTypeRadios = document.querySelectorAll('#billing_invoice_type_field.form-radio_fields input[type=radio]'); 212 var choiceTypeSelect = document.getElementById('billing_choice_type'); 213 var choiceTypeRadios = document.querySelectorAll('#billing_choice_type_field.form-radio_fields input[type=radio]'); 214 215 // Toggle fields based on choice type (handle select or radios safely) 216 if (choiceTypeSelect) { 217 toggleFieldsDisplay(choiceTypeSelect.value || '', event); 218 } else if (choiceTypeRadios.length) { 219 var currentChoiceTypeValue = null; 220 choiceTypeRadios.forEach(function (radio) { 221 if (radio.checked) { 222 currentChoiceTypeValue = radio.value; 223 } 224 }); 225 if (currentChoiceTypeValue) { 226 toggleFieldsDisplay(currentChoiceTypeValue, event); 227 } 228 } 229 230 // Work out current invoice type value 231 var invoiceTypeValue = null; 232 if (invoiceTypeSelect) { 233 invoiceTypeValue = invoiceTypeSelect.value; 234 } else if (invoiceTypeRadios.length) { 235 invoiceTypeRadios.forEach(function (radio) { 236 if (radio.checked) { 237 invoiceTypeValue = radio.value; 238 } 239 }); 240 } 241 242 if (!invoiceTypeValue) { 243 console.log('[POP-WC] changeCountryEventHandler: missing invoice type value, aborting.'); 242 244 return false; 243 245 } 244 246 245 if ('SELECT' === invoiceType.tagName) { 246 if ('IT' !== country) { 247 switchTypeNoIT(invoiceType.value, event); 248 } else { 249 switchType(invoiceType.value, event); 250 } 247 if ('IT' !== country) { 248 switchTypeNoIT(invoiceTypeValue, event); 251 249 } else { 252 if ('IT' !== country) { 253 switchTypeNoIT(invoiceType[0].value, event); 254 } else { 255 switchType(invoiceType[0].value, event); 256 } 250 switchType(invoiceTypeValue, event); 257 251 } 258 252 } … … 663 657 664 658 if (companyFiled) { 665 console.log(' toggleBillingCompany');659 console.log('[POP-WC] toggleBillingCompany'); 666 660 var companyFieldWrap = companyFiled.closest('p'); 667 661 var companyLabel = null; … … 983 977 } 984 978 } else { 979 if (!choiceType || !choiceType.length) { 980 console.log('[POP-WC] switchType: choiceType radios missing, aborting.'); 981 return; 982 } 985 983 var currentChoiceTypeValue = null; 986 984 choiceType.forEach(function (radio) { … … 1017 1015 } 1018 1016 }) 1019 console.log(' RADIO > choiceTypeRadioValue', choiceTypeRadioValue);1017 console.log('[POP-WC] RADIO > choiceTypeRadioValue', choiceTypeRadioValue); 1020 1018 toggleFieldsDisplay(choiceTypeRadioValue, ev); 1021 1019 // Change … … 1070 1068 var taxCode = document.getElementById('billing_tax_code'); 1071 1069 1072 console.log(' toggle:', type, 'event:', ev.type);1070 console.log('[POP-WC] toggle:', type, 'event:', ev.type); 1073 1071 1074 1072 switch (type) { … … 1124 1122 } 1125 1123 } else { 1124 if (!invoiceType.length) { 1125 console.log('[POP-WC] toggleFieldsDisplay: invoiceType radios empty, aborting.'); 1126 return false; 1127 } 1126 1128 var invoiceTypeValue = invoiceType[0].value; 1127 1129 invoiceType.forEach(function (radio) { … … 1130 1132 } 1131 1133 }) 1132 console.log(' RADIO > invoiceTypeValue', invoiceTypeValue);1134 console.log('[POP-WC] RADIO > invoiceTypeValue', invoiceTypeValue); 1133 1135 // Check condition for display fields based on country and invoice type selected 1134 1136 if ('' === invoiceTypeValue) { … … 1246 1248 function callViesCheck(vatNumber, taxCode, invoiceType, choiceType, country) 1247 1249 { 1248 console.log(' callViesCheck fetch:', country, choiceType, invoiceType, vatNumber, taxCode);1250 console.log('[POP-WC] callViesCheck fetch:', country, choiceType, invoiceType, vatNumber, taxCode); 1249 1251 fetch(wc_el_inv_invoice.ajax_url, { 1250 1252 method: 'POST', … … 1261 1263 .then(response => response.json()) 1262 1264 .then(data => { 1263 console.log(" VIES response:", data);1265 console.log("[POP-WC] VIES response:", data); 1264 1266 var vatField = $('#billing_vat_number_field label'); 1265 1267 var valid = $('#billing_vat_number_field label .valid_vies'); … … 1362 1364 1363 1365 if ('dev' === wc_el_inv_invoice.mode) { 1364 console.log(' forceBatchRequest?', evt && evt.target && evt.target.id !== 'billing-country')1366 console.log('[POP-WC block] forceBatchRequest?', evt && evt.target && evt.target.id !== 'billing-country') 1365 1367 } 1366 1368 if (evt && evt.target && evt.target.id !== 'billing-country') { … … 1383 1385 ]).then(([cartData, cartTotals, checkoutStatus]) => { 1384 1386 if ('dev' === wc_el_inv_invoice.mode) { 1385 console.log('[POPblock] Batch refresh completato:', {1387 console.log('[POP-WC block] Batch refresh completato:', { 1386 1388 cartData, 1387 1389 cartTotals, … … 1408 1410 { 1409 1411 if ('dev' === wc_el_inv_invoice.mode) { 1410 console.log('[POP block] vies fetch:', country, choiceType, invoiceType, vatNumber, taxCode);1412 console.log('[POP-WC block] vies fetch:', country, choiceType, invoiceType, vatNumber, taxCode); 1411 1413 } 1412 1414 … … 1426 1428 .then(data => { 1427 1429 if ('dev' === wc_el_inv_invoice.mode) { 1428 console.log("[POP block] vies response:", data);1430 console.log("[POP-WC block] vies response:", data); 1429 1431 } 1430 1432 const label = $('#billing_vat_number_field label.components-base-control__label'); … … 1508 1510 }; 1509 1511 var cfDataFinal = new CodiceFiscale(args); 1510 console.log(' CodiceFiscale di ' + args.name + ' ' + args.surname, cfDataFinal);1512 console.log('[POP-WC] CodiceFiscale di ' + args.name + ' ' + args.surname, cfDataFinal); 1511 1513 checkCodeFinal = (0 === cfDataFinal.code.indexOf(computeInverse.surname + computeInverse.name)); 1512 1514 } else { 1513 1515 checkCodeFinal = false; 1514 1516 } 1515 console.log(' Check CF:', checkCodeFinal);1517 console.log('[POP-WC] Check CF:', checkCodeFinal); 1516 1518 if (!checkCodeFinal) { 1517 1519 setTimeout(function () { -
woopop-electronic-invoice-free/trunk/assets/js/invoiceFields.min.js
r3418379 r3460146 24 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 25 */ 26 !function(e,t){function l(){console.log(" POP user level: ",t.user_level);const l=window.wcSettings?.isCheckoutBlock||document.querySelector(".wc-block-checkout");function i(){if(l)return!1;var t=document.getElementById("billing_invoice_type");if(!t)return!1;if(e(t).data("select2"))return!1;void 0!==e(t).select2&&e(t).select2({minimumResultsForSearch:3});var i=document.getElementById("billing_choice_type");return!!i&&(!e(i).data("select2")&&void(void 0!==e(i).select2&&e(i).select2({minimumResultsForSearch:3})))}function n(){if(l){const e=setInterval((()=>{var t=document.getElementById("billing_invoice_type"),l=document.getElementById("billing-country");if(t||(t=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!t||!l)return!1;"SELECT"===t.tagName?t.addEventListener("change",a):t.forEach((function(e){e.addEventListener("click",(function(e){a(e)}))})),l.addEventListener("change",o),clearInterval(e)}),300)}else{var e=document.getElementById("billing_invoice_type"),t=document.getElementById("billing_country");if(e||(e=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!e||!t)return!1;"SELECT"===e.tagName?document.addEventListener("DOMContentLoaded",(function(){e.onchange=a}),!1):e.forEach((function(e){e.addEventListener("click",(function(e){a(e)}))})),document.addEventListener("DOMContentLoaded",(function(){t.onchange=o}),!1)}}function o(e){var t=e.target.value,l=document.getElementById("billing_invoice_type"),i=document.getElementById("billing_choice_type");if(l||(l=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!i)i=document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]");if(0!==i.length)if("SELECT"===i.tagName)u(i.value,e);else{var n=i.length>0?i[0].getAttribute("type"):null,o=null;"radio"===n&&i.forEach((function(e){e.checked&&(o=e.value)})),console.log("changeCountryEventHandler > RADIO > currentChoiceTypeValue",o),o&&u(o,e)}if(!l)return!1;"SELECT"===l.tagName?"IT"!==t?c(l.value,e):s(l.value,e):"IT"!==t?c(l[0].value,e):s(l[0].value,e)}function a(e){var i=document.getElementById("billing_country");l&&(i=document.getElementById("billing-country"));var n=e.target.value;i&&"IT"===i.value&&-1!==t.eu_vat_country.indexOf(i.value)?s(n,e):c(n,e)}function r(e,t,l){"IT"!==e?c(t,l):s(t,l)}function c(i,n){var o=document.getElementById("billing_country");l&&(o=document.getElementById("billing-country"));var a=document.getElementById("billing_choice_type_field"),r=document.getElementById("billing_invoice_type_field"),c=document.querySelector('#billing_choice_type_field label[for*="billing_choice_type"]'),s=document.querySelector('#billing_invoice_type_field label[for*="billing_invoice_type"]');l&&(a&&(c=a.querySelector(".components-base-control__label")),s=r.querySelector(".components-base-control__label"));var u=document.getElementById("billing_sdi_type"),m=document.getElementById("billing_sdi_type_field"),y=document.querySelector('#billing_sdi_type_field label[for*="billing_sdi_type"]');if(y)var _=y.firstElementChild;l&&(m&&(y=m.querySelector(".components-base-control__label")),_=!1);var v=document.getElementById("billing_vat_number"),b=document.getElementById("billing_vat_number_field"),p=document.querySelector('#billing_vat_number_field label[for="billing_vat_number"]');if(p)var g=p.firstElementChild;l&&(p=b.querySelector(".components-base-control__label"),g=!1);var f=document.getElementById("billing_tax_code"),h=document.getElementById("billing_tax_code_field"),E=document.querySelector('#billing_tax_code_field label[for="billing_tax_code"]');if(f){if(E)var q=E.firstElementChild;l&&(h&&(E=h.querySelector(".components-base-control__label")),q=!1),(L=f.nextElementSibling)&&L.classList.contains("no-valid-cf")&&L.remove()}var L,I=document.getElementById("billing_choice_type"),k=null;I||document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]").forEach((function(e){e.checked&&(k=e.value)}));if(m&&(m.style.display="none",m.classList.remove("validate-required"),_&&(_.classList.remove("required"),_.classList.add("optional"),_.innerText="("+t.not_required_text+")",_.outerHTML=_.outerHTML.replace(/abbr/g,"span")),u.removeAttribute("required"),u.value=""),"change"===n.type&&(u&&(u.value=""),v&&(v.value=""),f&&(f.value="")),o&&"show"!==t.hide_outside_ue&&-1===t.eu_vat_country.indexOf(o.value))return d("private"),a&&(a.style.display="none",c&&c.firstElementChild&&c.firstElementChild.remove()),r&&(r.style.display="none",s&&s.firstElementChild&&s.firstElementChild.remove()),h&&(h.style.display="none",f.value="",q&&q.classList.remove("required"),h.classList.remove("validate-required"),f.removeAttribute("required")),void(b&&(b.style.display="none",v.value="",g&&g.classList.remove("required"),b.classList.remove("validate-required"),v.removeAttribute("required")));switch(a&&(c&&c.firstElementChild&&c.firstElementChild.remove(),a.style.display="block"),r&&(s&&s.firstElementChild&&s.firstElementChild.remove(),r.style.display="block"),"1"===t.invoice_required?(a&&(a.style.display="block",(c&&c.firstElementChild&&"ABBR"!==c.firstElementChild.nodeName&&!c.querySelector(".required")||c&&null===c.firstElementChild)&&e(c).append('<abbr class="required">*</abbr>')),r&&(r.style.display="block",(s&&s.firstElementChild&&"ABBR"!==s.firstElementChild.nodeName&&!s.querySelector(".required")||s&&null===s.firstElementChild)&&e(s).append('<abbr class="required">*</abbr>')),h&&(h.style.display="block",h.classList.add("validate-required"),q&&(q.classList.remove("optional"),q.classList.add("required"),q.innerText="*",q.setAttribute("title",t.required_text),q.outerHTML=q.outerHTML.replace(/span/g,"abbr")),f&&f.setAttribute("required","required")),b&&(b.style.display="block",b.classList.add("validate-required"),g&&(g.classList.remove("optional"),g.classList.add("required"),g.innerText="*",g.setAttribute("title",t.required_text),g.outerHTML=g.outerHTML.replace(/span/g,"abbr")),v&&v.setAttribute("required","required"))):(h&&(h.classList.remove("validate-required"),q&&(q.classList.remove("required"),q.classList.add("optional"),q.innerText="("+t.not_required_text+")",q.outerHTML=q.outerHTML.replace(/abbr/g,"span")),f&&f.removeAttribute("required")),b&&(b.classList.remove("validate-required"),g&&(g.classList.remove("required"),g.classList.add("optional"),g.innerText="("+t.not_required_text+")",g.outerHTML=g.outerHTML.replace(/abbr/g,"span")),v&&v.removeAttribute("required"))),r&&(r.style.display="block"),k&&"receipt"===k&&(r.style.display="none"),I&&"receipt"===I.value&&(r.style.display="none"),(k&&"receipt"===k||I&&"receipt"===I.value)&&(i=""),i){default:case"private":v&&(b.style.display="none",g&&(g.classList.remove("required"),g.classList.add("optional")),b.classList.remove("validate-required"),g&&(g.innerText="("+t.not_required_text+")",g.innerHTML=g.outerHTML.replace(/abbr/g,"span")),v.removeAttribute("required")),f&&(h.style.display="block");break;case"company":case"freelance":v&&(b.style.display="block"),f&&"on"===t.disable_cf&&(h&&(h.style.display="none"),q&&(q.classList.remove("required"),q.classList.add("optional")),h&&h.classList.remove("validate-required"),q&&(q.innerText="("+t.not_required_text+")"),g&&q&&(q.innerText=g.outerHTML.replace(/abbr/g,"span")),f&&f.removeAttribute("required"));break;case"":h&&(h.style.display="none"),m&&(m.style.display="none"),b&&(b.style.display="none")}f&&"private"!==i&&"company"!==i&&"freelance"!==i&&((L=f.nextElementSibling)&&L.classList.contains("no-valid-cf")&&L.remove());d(i)}function d(e){var t=document.getElementById("billing_company");if(l&&(t=document.getElementById("billing-company")),t){console.log("toggleBillingCompany");var i=t.closest("p"),n=null,o=null,a=null;i&&((n=i.querySelector("label"))&&(a=n.querySelector(".required"),o=i.querySelector("label span.optional")),"company"===e?(t.setAttribute("required","required"),i.classList.add("validate-required"),o&&(o.style.display="none"),!a&&n&&n.insertAdjacentHTML("beforeend",'<abbr class="required">*</abbr>')):a&&(t.removeAttribute("required"),i.classList.remove("validate-required"),o&&(o.style.display="inline"),a.remove()))}}function s(i,n){var o=document.getElementById("billing_country");l&&(o=document.getElementById("billing-country"));var a=document.getElementById("billing_choice_type_field"),r=document.getElementById("billing_invoice_type_field"),c=document.querySelector('#billing_choice_type_field label[for*="billing_choice_type"]'),s=document.querySelector('#billing_invoice_type_field label[for*="billing_invoice_type"]');if(l&&(a&&(c=a.querySelector(".components-base-control__label")),s=r.querySelector(".components-base-control__label")),!(m=document.getElementById("billing_choice_type")))var m=document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]");var y=document.getElementById("billing_sdi_type"),v=document.getElementById("billing_sdi_type_field"),b=document.getElementById("billing_sdi_type"),p=document.querySelector('#billing_sdi_type_field label[for="billing_sdi_type"]'),g=document.querySelector("#billing_sdi_type_field #billing_sdi_type-description");if(y&&p)var f=p.firstElementChild;l&&(v&&(p=v.querySelector(".components-base-control__label")),f=!1);var h=document.getElementById("billing_vat_number"),E=document.getElementById("billing_vat_number_field"),q=document.querySelector('#billing_vat_number_field label[for="billing_vat_number"]');if(q)var L=q.firstElementChild;l&&(q=E.querySelector(".components-base-control__label"),L=!1);var I=document.getElementById("billing_tax_code"),k=document.getElementById("billing_tax_code_field"),x=document.querySelector('#billing_tax_code_field label[for="billing_tax_code"]');if(I&&x)var T=x.firstElementChild;if(l&&(k&&(x=k.querySelector(".components-base-control__label")),T=!1),-1!==t.eu_vat_country.indexOf(o.value)&&"IT"===o.value){switch("change"===n.type&&(y&&(y.value=""),h&&(h.value=""),I&&(I.value="")),a&&(a.style.display="block",(c&&c.firstElementChild&&"ABBR"!==c.firstElementChild.nodeName&&!c.querySelector(".required")||c&&null===c.firstElementChild)&&e(c).append('<abbr class="required">*</abbr>')),r&&(r.style.display="block",(s&&s.firstElementChild&&"ABBR"!==s.firstElementChild.nodeName&&!s.querySelector(".required")||s&&null===s.firstElementChild)&&e(s).append('<abbr class="required">*</abbr>')),k&&(k.style.display="block"),E&&(E.style.display="block"),i){default:case"private":I&&(o&&"IT"===o.value&&I&&"on"===t.active_js_cf_check&&(_(),I.dispatchEvent(new Event("change"))),k.style.display="block",T&&(T.classList.remove("optional"),T.classList.add("required")),k.classList.add("validate-required"),T&&(T.innerText="*",T.outerHTML=T.outerHTML.replace(/span/g,"abbr")),I.setAttribute("required","required")),v&&(v.style.display="none",v.classList.remove("validate-required"),y.removeAttribute("required"),y.value="",f&&(f.classList.remove("required"),f.classList.add("optional"),f.innerText="("+t.not_required_text+")",f.outerHTML=f.outerHTML.replace(/abbr/g,"span"))),E&&(E.style.display="none",E.classList.remove("validate-required"),L&&(L.classList.remove("required"),L.classList.add("optional"),L.innerText="("+t.not_required_text+")",L.outerHTML=L.outerHTML.replace(/abbr/g,"span")),h&&h.removeAttribute("required"));break;case"company":case"freelance":if(v&&("on"!==t.disable_pec_sdi?(v.style.display="block",v.classList.add("validate-required"),f&&(f.classList.remove("optional"),f.classList.add("required"),f.innerText="*",f.setAttribute("title",t.required_text),f.outerHTML=f.outerHTML.replace(/span/g,"abbr")),y.setAttribute("required","required"),g&&(g.innerText=t.sdi_description),b.placeholder=t.sdi_placeholder):(v.style.display="none",y.removeAttribute("required"))),E&&(E.style.display="block",E.classList.add("validate-required"),L&&(L.classList.remove("optional"),L.classList.add("required"),L.innerText="*",L.setAttribute("title",t.required_text),L.outerHTML=L.outerHTML.replace(/span/g,"abbr")),h&&h.setAttribute("required","required")),I&&"on"!==t.disable_cf?(k.style.display="block",k.classList.add("validate-required"),T&&(T.classList.remove("optional"),T.classList.add("required"),T.innerText="*",T.setAttribute("title",t.required_text),T.outerHTML=T.outerHTML.replace(/span/g,"abbr")),I.setAttribute("required","required")):I&&"on"===t.disable_cf&&k&&(k.style.display="none",I.removeAttribute("required")),I)(S=I.nextElementSibling)&&S.remove();break;case"":k&&(k.style.display="none"),v&&(v.style.display="none"),E&&(E.style.display="none")}var S;if(I&&"private"!==i&&"company"!==i&&"freelance"!==i)(S=I.nextElementSibling)&&S.classList.contains("no-valid-cf")&&S.remove();if("SELECT"===m.tagName){var B=m.options[m.selectedIndex];B&&"receipt"===B.value&&u(B.value,n)}else{var C=null;m.forEach((function(e){e.checked&&(C=e.value)})),C&&"receipt"===C&&u(C,n)}d(i)}}function u(e,t){var i=document.getElementById("billing_invoice_type");i||(i=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]"));var n=document.getElementById("billing_invoice_type_field"),o=document.getElementById("billing_sdi_type_field"),a=document.getElementById("billing_vat_number_field"),r=document.getElementById("billing_tax_code_field"),c=document.getElementById("billing_sdi_type"),u=document.getElementById("billing_vat_number"),m=document.getElementById("billing_tax_code");switch(console.log("toggle:",e,"event:",t.type),e){case"invoice":var y=document.getElementById("billing_country");if(l&&(y=document.getElementById("billing-country")),"SELECT"===i.tagName)""===i.options[i.selectedIndex].value?n.style.display="block":(n.style.display="block","private"===i.options[i.selectedIndex].value?(r&&(r.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==m.value||(m.value="")):"company"!==i.options[i.selectedIndex].value&&"freelance"!==i.options[i.selectedIndex].value||(u&&(a.style.display="block","load"!==t.type&&(u.value="")),"IT"===y.value&&c&&(o.style.display="block","load"!==t.type&&(c.value="")),m&&(r.style.display="block","load"!==t.type&&(m.value=""))),s(i.options[i.selectedIndex].value,t));else{var _=i[0].value;i.forEach((function(e){e.checked&&(_=e.value)})),console.log("RADIO > invoiceTypeValue",_),""===_?n.style.display="block":(n.style.display="block","private"===_?(r&&(r.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==m.value||(m.value="")):"company"!==_&&"freelance"!==_||(u&&(a.style.display="block","load"!==t.type&&(u.value="")),"IT"===y.value&&c&&(o.style.display="block","load"!==t.type&&(c.value="")),m&&(r.style.display="block","load"!==t.type&&(m.value=""))),s(_,t))}break;case"receipt":d(null),u&&(u.value="11111111111",a.style.display="none"),c&&(c.value="1111111",o.style.display="none"),m&&(m.value="XXXXXX00L00L000X",r.style.display="none"),n.style.display="none";break;case"reset":d(null),u&&(u.value=""),c&&(c.value=""),m&&(m.value="");break;case"edit-address":""!==m.value&&(r.style.display="block"),""!==u.value&&(a.style.display="block"),""!==c.value&&(o.style.display="block")}}function m(){if(l)return!1;var i;function n(){clearTimeout(i),i=setTimeout((()=>{const l=e("#billing_vat_number").val()?.trim(),i=e("#billing_tax_code").val()?.trim(),n=e("#billing_invoice_type").val()?.trim(),o=e("#billing_choice_type").val()?.trim(),a=e("#billing_country").val()?.trim();!function(l,i,n,o,a){console.log("callViesCheck fetch:",a,o,n,l,i),fetch(t.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"popCheckoutViesCheck",vat_number:l,tax_code:i,invoice_type:n,choice_type:o,country:a})}).then((e=>e.json())).then((t=>{console.log("VIES response:",t);var l=e("#billing_vat_number_field label"),i=e("#billing_vat_number_field label .valid_vies"),n=e("#billing_vat_number_field label .not_valid_vies"),o=e(".order-total #wc_el_inv_vies_trigger");0!==o.length&&o.remove(),0!==i.length&&i.remove(),0!==n.length&&n.remove(),"not_necessary"!==t.data.vies&&(t.success?l.append(' <small style="color:green;" class="valid_vies">'+t.data.message+"</small>"):l.append(' <small style="color:red;" class="not_valid_vies">'+t.data.message+"</small>"),e("body").trigger("update_checkout"))})).catch((e=>{console.error("VIES fetch error:",e)}))}(l,i,n,o,a)}),300)}e("#billing_choice_type, #billing_invoice_type, #billing_country, #billing_vat_number, #billing_tax_code").on("change",n),n()}function y(){l&&function(e){var l;async function i(l,i,n,o){wp.data.dispatch("wc/store/cart").invalidateResolution("getCartTotals"),wp.data.dispatch("wc/store/checkout").invalidateResolution("getCheckoutStatus");await wp.data.resolveSelect("wc/store/cart").getCartTotals(),await wp.data.resolveSelect("wc/store/checkout").getCheckoutStatus();const a=e("#billing_vat_number_field label.components-base-control__label"),r=e('<small class="message_vies" style="margin-left:10px;"></small>');if(r.addClass(i.success?"valid":"not_valid"),r.text(i.data.message),r.css("color",i.success?"green":"red"),a.append(r),i.data.update_totals){const e=wp.data.select("wc/store/checkout").getAdditionalFields()||{};wp.data.dispatch("wc/store/checkout").setAdditionalFields({...e,billing_tax_code:""})}"dev"===t.mode&&console.log("forceBatchRequest?",l&&l.target&&"billing-country"!==l.target.id),l&&l.target&&"billing-country"!==l.target.id&&(wp.data.dispatch("wc/store/cart").invalidateResolution("getCartData"),wp.data.dispatch("wc/store/cart").invalidateResolution("getCartTotals"),wp.data.dispatch("wc/store/checkout").invalidateResolution("getCheckoutStatus"),Promise.all([wp.data.resolveSelect("wc/store/cart").getCartData(),wp.data.resolveSelect("wc/store/cart").getCartTotals(),wp.data.resolveSelect("wc/store/checkout").getCheckoutStatus()]).then((([e,l,i])=>("dev"===t.mode&&console.log("[POP block] Batch refresh completato:",{cartData:e,cartTotals:l,checkoutStatus:i}),{cartData:e,cartTotals:l,checkoutStatus:i}))).catch((e=>{"dev"===t.mode&&console.error("[POP block] Errore nel forzare batch request:",e)})))}function n(n){clearTimeout(l),l=setTimeout((()=>{const l=e("#billing_vat_number").val()?.trim(),o=e("#billing_tax_code").val()?.trim(),a=e("#billing_invoice_type").val()?.trim(),r=e("#billing_choice_type").val()?.trim(),c=e("#billing-country").val()?.trim();!function(l,n,o,a,r,c){"dev"===t.mode&&console.log("[POP block] vies fetch:",c,r,a,n,o),fetch(t.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"popCheckoutViesCheck",vat_number:n,tax_code:o,invoice_type:a,choice_type:r,country:c})}).then((e=>e.json())).then((n=>{"dev"===t.mode&&console.log("[POP block] vies response:",n);const o=e("#billing_vat_number_field label.components-base-control__label").find(".message_vies");o.length&&o.remove(),i(l,n)})).catch((e=>{console.error("VIES fetch error:",e)}))}(n,l,o,a,r,c)}),300)}e("#billing_choice_type, #billing_invoice_type, #billing-country, #billing_vat_number, #billing_tax_code").on("change blur",n),n()}(jQuery)}function _(){var i=document.getElementById("billing_first_name"),n=document.getElementById("billing_last_name");l&&(i=document.getElementById("billing-first_name"),n=document.getElementById("billing-last_name"));var o=document.getElementById("billing_tax_code"),a=document.getElementById("billing_invoice_type"),r=!1,c={};e(i).on("change",(function(){o.value=""})),e(n).on("change",(function(){o.value=""})),e(o).on("change",(function(){o.setCustomValidity(""),o.setCustomValidity("");var e=this.value.toUpperCase(),l=CodiceFiscale.check(e);if("private"===a.options[a.selectedIndex].value){if(this.value.length<=16&&!0===l){c=CodiceFiscale.computeInverse(e);var d={name:i.value,surname:n.value,gender:c.gender,birthday:c.birthday,birthplace:c.birthplace},s=new CodiceFiscale(d);console.log("CodiceFiscale di "+d.name+" "+d.surname,s),r=0===s.code.indexOf(c.surname+c.name)}else r=!1;if(console.log("Check CF:",r),r){var u=o.nextElementSibling;return u&&u.classList.contains("no-valid-cf")&&u.remove(),!0}return setTimeout((function(){var l=o.nextElementSibling;l&&l.remove(),o.insertAdjacentHTML("afterend","<p class='no-valid-cf'><small>(*) <b>"+e+"</b> "+t.invalid_tax_code+"</small></p>"),o.setCustomValidity(t.pop_invalid_tax_code)}),200),!1}}))}function v(n){var o=document.getElementById("billing_invoice_type"),a=document.getElementById("billing_country");l&&(a=document.getElementById("billing-country"));var d=document.getElementById("billing_tax_code");if(o||(o=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!o)return!1;if(!a)return!1;if(a){var v=a.getAttribute("readonly");v&&"readonly"===v&&(a.closest("#billing_country_field").style.display="none")}var b=document.querySelector('label[for="billing_invoice_type"] .optional');b&&b.remove(),"SELECT"===o.tagName?(a&&"IT"===a.value&&-1!==t.eu_vat_country.indexOf(t.country)?"select"===o.tagName.toLowerCase()?s(o.options[o.selectedIndex].value,n):"input"===o.tagName.toLowerCase()&&s(o.value,n):"select"===o.tagName.toLowerCase()?c(o.options[o.selectedIndex].value,n):"input"===o.tagName.toLowerCase()&&c(o.value,n),a&&r(a.value,o.value,n)):(a&&"IT"===a.value&&-1!==t.eu_vat_country.indexOf(t.country)?s(o[0].value,n):c(o[0].value,n),a&&r(a.value,o[0].value,n)),function(t){var l=document.querySelector("body.woocommerce-edit-address"),n=document.getElementById("billing_choice_type"),o=document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]");if(!n&&o){var a="";o.forEach((function(e){e.checked&&(a=e.value)})),console.log("RADIO > choiceTypeRadioValue",a),u(a,t),o.forEach((function(e){e.addEventListener("change",(function(e){u(this.value,e)}))}))}i();var r=document.querySelector('#billing_choice_type_field label[for="billing_choice_type"] span.optional');r&&r.remove(),n&&"load"===t.type&&!l&&u(n.options[n.selectedIndex].value,t),n&&e(n).on("change",(function(e){u(this.value,e)})),l&&u("edit-address",t)}(n),i(),function(){if(l)return!1;var e=document.getElementById("billing_invoice_type"),i=(document.getElementById("billing_country"),document.getElementById("billing_vat_number")),n=document.getElementById("billing_tax_code");"on"!==t.disable_cf&&!(!i&&!n)&&(i&&i.addEventListener("keyup",(function(t){if(e&&"company"!==e.value)return!1;n.value=this.value})))}(),"free"!==t.user_level&&(m(),y()),function(){const e=document.getElementById("billing-company");l&&e&&(e.nextElementSibling.innerText=t.company_label)}(),a&&"IT"===a.value&&d&&"on"===t.active_js_cf_check&&(_(),d.dispatchEvent(new Event("change")))}l||n(),window.addEventListener("load",(function(e){if(l){const t=setInterval((()=>{v(e),n(),clearInterval(t)}),300)}else v(e)}))}document.querySelector(".wc-block-checkout")?document.addEventListener("DOMContentLoaded",(()=>{new MutationObserver((function(e,t){document.querySelector(".pop-checkout-fields")&&(t.disconnect(),l())})).observe(document.body,{childList:!0,subtree:!0})})):l()}(jQuery,window.wc_el_inv_invoice);26 !function(e,t){function l(){console.log("[POP-WC] user level:",t.user_level);const l=window.wcSettings?.isCheckoutBlock||document.querySelector(".wc-block-checkout");function i(){if(l)return!1;var t=document.getElementById("billing_invoice_type");if(!t)return!1;if(e(t).data("select2"))return!1;void 0!==e(t).select2&&e(t).select2({minimumResultsForSearch:3});var i=document.getElementById("billing_choice_type");return!!i&&(!e(i).data("select2")&&void(void 0!==e(i).select2&&e(i).select2({minimumResultsForSearch:3})))}function n(){if(l){const e=setInterval((()=>{var t=document.getElementById("billing_invoice_type"),l=document.getElementById("billing-country");if(t||(t=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!t||!l)return!1;"SELECT"===t.tagName?t.addEventListener("change",a):t.forEach((function(e){e.addEventListener("click",(function(e){a(e)}))})),l.addEventListener("change",o),clearInterval(e)}),300)}else{var e=document.getElementById("billing_invoice_type"),t=document.getElementById("billing_country");if(e||(e=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!e||!t)return!1;"SELECT"===e.tagName?document.addEventListener("DOMContentLoaded",(function(){e.onchange=a}),!1):e.forEach((function(e){e.addEventListener("click",(function(e){a(e)}))})),document.addEventListener("DOMContentLoaded",(function(){t.onchange=o}),!1)}}function o(e){var t=e.target.value,l=document.getElementById("billing_invoice_type"),i=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]"),n=document.getElementById("billing_choice_type"),o=document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]");if(n)u(n.value||"",e);else if(o.length){var a=null;o.forEach((function(e){e.checked&&(a=e.value)})),a&&u(a,e)}var r=null;if(l?r=l.value:i.length&&i.forEach((function(e){e.checked&&(r=e.value)})),!r)return console.log("[POP-WC] changeCountryEventHandler: missing invoice type value, aborting."),!1;"IT"!==t?c(r,e):s(r,e)}function a(e){var i=document.getElementById("billing_country");l&&(i=document.getElementById("billing-country"));var n=e.target.value;i&&"IT"===i.value&&-1!==t.eu_vat_country.indexOf(i.value)?s(n,e):c(n,e)}function r(e,t,l){"IT"!==e?c(t,l):s(t,l)}function c(i,n){var o=document.getElementById("billing_country");l&&(o=document.getElementById("billing-country"));var a=document.getElementById("billing_choice_type_field"),r=document.getElementById("billing_invoice_type_field"),c=document.querySelector('#billing_choice_type_field label[for*="billing_choice_type"]'),s=document.querySelector('#billing_invoice_type_field label[for*="billing_invoice_type"]');l&&(a&&(c=a.querySelector(".components-base-control__label")),s=r.querySelector(".components-base-control__label"));var u=document.getElementById("billing_sdi_type"),m=document.getElementById("billing_sdi_type_field"),y=document.querySelector('#billing_sdi_type_field label[for*="billing_sdi_type"]');if(y)var _=y.firstElementChild;l&&(m&&(y=m.querySelector(".components-base-control__label")),_=!1);var v=document.getElementById("billing_vat_number"),b=document.getElementById("billing_vat_number_field"),p=document.querySelector('#billing_vat_number_field label[for="billing_vat_number"]');if(p)var g=p.firstElementChild;l&&(p=b.querySelector(".components-base-control__label"),g=!1);var f=document.getElementById("billing_tax_code"),h=document.getElementById("billing_tax_code_field"),E=document.querySelector('#billing_tax_code_field label[for="billing_tax_code"]');if(f){if(E)var q=E.firstElementChild;l&&(h&&(E=h.querySelector(".components-base-control__label")),q=!1),(L=f.nextElementSibling)&&L.classList.contains("no-valid-cf")&&L.remove()}var L,I=document.getElementById("billing_choice_type"),C=null;I||document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]").forEach((function(e){e.checked&&(C=e.value)}));if(m&&(m.style.display="none",m.classList.remove("validate-required"),_&&(_.classList.remove("required"),_.classList.add("optional"),_.innerText="("+t.not_required_text+")",_.outerHTML=_.outerHTML.replace(/abbr/g,"span")),u.removeAttribute("required"),u.value=""),"change"===n.type&&(u&&(u.value=""),v&&(v.value=""),f&&(f.value="")),o&&"show"!==t.hide_outside_ue&&-1===t.eu_vat_country.indexOf(o.value))return d("private"),a&&(a.style.display="none",c&&c.firstElementChild&&c.firstElementChild.remove()),r&&(r.style.display="none",s&&s.firstElementChild&&s.firstElementChild.remove()),h&&(h.style.display="none",f.value="",q&&q.classList.remove("required"),h.classList.remove("validate-required"),f.removeAttribute("required")),void(b&&(b.style.display="none",v.value="",g&&g.classList.remove("required"),b.classList.remove("validate-required"),v.removeAttribute("required")));switch(a&&(c&&c.firstElementChild&&c.firstElementChild.remove(),a.style.display="block"),r&&(s&&s.firstElementChild&&s.firstElementChild.remove(),r.style.display="block"),"1"===t.invoice_required?(a&&(a.style.display="block",(c&&c.firstElementChild&&"ABBR"!==c.firstElementChild.nodeName&&!c.querySelector(".required")||c&&null===c.firstElementChild)&&e(c).append('<abbr class="required">*</abbr>')),r&&(r.style.display="block",(s&&s.firstElementChild&&"ABBR"!==s.firstElementChild.nodeName&&!s.querySelector(".required")||s&&null===s.firstElementChild)&&e(s).append('<abbr class="required">*</abbr>')),h&&(h.style.display="block",h.classList.add("validate-required"),q&&(q.classList.remove("optional"),q.classList.add("required"),q.innerText="*",q.setAttribute("title",t.required_text),q.outerHTML=q.outerHTML.replace(/span/g,"abbr")),f&&f.setAttribute("required","required")),b&&(b.style.display="block",b.classList.add("validate-required"),g&&(g.classList.remove("optional"),g.classList.add("required"),g.innerText="*",g.setAttribute("title",t.required_text),g.outerHTML=g.outerHTML.replace(/span/g,"abbr")),v&&v.setAttribute("required","required"))):(h&&(h.classList.remove("validate-required"),q&&(q.classList.remove("required"),q.classList.add("optional"),q.innerText="("+t.not_required_text+")",q.outerHTML=q.outerHTML.replace(/abbr/g,"span")),f&&f.removeAttribute("required")),b&&(b.classList.remove("validate-required"),g&&(g.classList.remove("required"),g.classList.add("optional"),g.innerText="("+t.not_required_text+")",g.outerHTML=g.outerHTML.replace(/abbr/g,"span")),v&&v.removeAttribute("required"))),r&&(r.style.display="block"),C&&"receipt"===C&&(r.style.display="none"),I&&"receipt"===I.value&&(r.style.display="none"),(C&&"receipt"===C||I&&"receipt"===I.value)&&(i=""),i){default:case"private":v&&(b.style.display="none",g&&(g.classList.remove("required"),g.classList.add("optional")),b.classList.remove("validate-required"),g&&(g.innerText="("+t.not_required_text+")",g.innerHTML=g.outerHTML.replace(/abbr/g,"span")),v.removeAttribute("required")),f&&(h.style.display="block");break;case"company":case"freelance":v&&(b.style.display="block"),f&&"on"===t.disable_cf&&(h&&(h.style.display="none"),q&&(q.classList.remove("required"),q.classList.add("optional")),h&&h.classList.remove("validate-required"),q&&(q.innerText="("+t.not_required_text+")"),g&&q&&(q.innerText=g.outerHTML.replace(/abbr/g,"span")),f&&f.removeAttribute("required"));break;case"":h&&(h.style.display="none"),m&&(m.style.display="none"),b&&(b.style.display="none")}f&&"private"!==i&&"company"!==i&&"freelance"!==i&&((L=f.nextElementSibling)&&L.classList.contains("no-valid-cf")&&L.remove());d(i)}function d(e){var t=document.getElementById("billing_company");if(l&&(t=document.getElementById("billing-company")),t){console.log("[POP-WC] toggleBillingCompany");var i=t.closest("p"),n=null,o=null,a=null;i&&((n=i.querySelector("label"))&&(a=n.querySelector(".required"),o=i.querySelector("label span.optional")),"company"===e?(t.setAttribute("required","required"),i.classList.add("validate-required"),o&&(o.style.display="none"),!a&&n&&n.insertAdjacentHTML("beforeend",'<abbr class="required">*</abbr>')):a&&(t.removeAttribute("required"),i.classList.remove("validate-required"),o&&(o.style.display="inline"),a.remove()))}}function s(i,n){var o=document.getElementById("billing_country");l&&(o=document.getElementById("billing-country"));var a=document.getElementById("billing_choice_type_field"),r=document.getElementById("billing_invoice_type_field"),c=document.querySelector('#billing_choice_type_field label[for*="billing_choice_type"]'),s=document.querySelector('#billing_invoice_type_field label[for*="billing_invoice_type"]');if(l&&(a&&(c=a.querySelector(".components-base-control__label")),s=r.querySelector(".components-base-control__label")),!(m=document.getElementById("billing_choice_type")))var m=document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]");var y=document.getElementById("billing_sdi_type"),v=document.getElementById("billing_sdi_type_field"),b=document.getElementById("billing_sdi_type"),p=document.querySelector('#billing_sdi_type_field label[for="billing_sdi_type"]'),g=document.querySelector("#billing_sdi_type_field #billing_sdi_type-description");if(y&&p)var f=p.firstElementChild;l&&(v&&(p=v.querySelector(".components-base-control__label")),f=!1);var h=document.getElementById("billing_vat_number"),E=document.getElementById("billing_vat_number_field"),q=document.querySelector('#billing_vat_number_field label[for="billing_vat_number"]');if(q)var L=q.firstElementChild;l&&(q=E.querySelector(".components-base-control__label"),L=!1);var I=document.getElementById("billing_tax_code"),C=document.getElementById("billing_tax_code_field"),k=document.querySelector('#billing_tax_code_field label[for="billing_tax_code"]');if(I&&k)var x=k.firstElementChild;if(l&&(C&&(k=C.querySelector(".components-base-control__label")),x=!1),-1!==t.eu_vat_country.indexOf(o.value)&&"IT"===o.value){switch("change"===n.type&&(y&&(y.value=""),h&&(h.value=""),I&&(I.value="")),a&&(a.style.display="block",(c&&c.firstElementChild&&"ABBR"!==c.firstElementChild.nodeName&&!c.querySelector(".required")||c&&null===c.firstElementChild)&&e(c).append('<abbr class="required">*</abbr>')),r&&(r.style.display="block",(s&&s.firstElementChild&&"ABBR"!==s.firstElementChild.nodeName&&!s.querySelector(".required")||s&&null===s.firstElementChild)&&e(s).append('<abbr class="required">*</abbr>')),C&&(C.style.display="block"),E&&(E.style.display="block"),i){default:case"private":I&&(o&&"IT"===o.value&&I&&"on"===t.active_js_cf_check&&(_(),I.dispatchEvent(new Event("change"))),C.style.display="block",x&&(x.classList.remove("optional"),x.classList.add("required")),C.classList.add("validate-required"),x&&(x.innerText="*",x.outerHTML=x.outerHTML.replace(/span/g,"abbr")),I.setAttribute("required","required")),v&&(v.style.display="none",v.classList.remove("validate-required"),y.removeAttribute("required"),y.value="",f&&(f.classList.remove("required"),f.classList.add("optional"),f.innerText="("+t.not_required_text+")",f.outerHTML=f.outerHTML.replace(/abbr/g,"span"))),E&&(E.style.display="none",E.classList.remove("validate-required"),L&&(L.classList.remove("required"),L.classList.add("optional"),L.innerText="("+t.not_required_text+")",L.outerHTML=L.outerHTML.replace(/abbr/g,"span")),h&&h.removeAttribute("required"));break;case"company":case"freelance":if(v&&("on"!==t.disable_pec_sdi?(v.style.display="block",v.classList.add("validate-required"),f&&(f.classList.remove("optional"),f.classList.add("required"),f.innerText="*",f.setAttribute("title",t.required_text),f.outerHTML=f.outerHTML.replace(/span/g,"abbr")),y.setAttribute("required","required"),g&&(g.innerText=t.sdi_description),b.placeholder=t.sdi_placeholder):(v.style.display="none",y.removeAttribute("required"))),E&&(E.style.display="block",E.classList.add("validate-required"),L&&(L.classList.remove("optional"),L.classList.add("required"),L.innerText="*",L.setAttribute("title",t.required_text),L.outerHTML=L.outerHTML.replace(/span/g,"abbr")),h&&h.setAttribute("required","required")),I&&"on"!==t.disable_cf?(C.style.display="block",C.classList.add("validate-required"),x&&(x.classList.remove("optional"),x.classList.add("required"),x.innerText="*",x.setAttribute("title",t.required_text),x.outerHTML=x.outerHTML.replace(/span/g,"abbr")),I.setAttribute("required","required")):I&&"on"===t.disable_cf&&C&&(C.style.display="none",I.removeAttribute("required")),I)(T=I.nextElementSibling)&&T.remove();break;case"":C&&(C.style.display="none"),v&&(v.style.display="none"),E&&(E.style.display="none")}var T;if(I&&"private"!==i&&"company"!==i&&"freelance"!==i)(T=I.nextElementSibling)&&T.classList.contains("no-valid-cf")&&T.remove();if("SELECT"===m.tagName){var S=m.options[m.selectedIndex];S&&"receipt"===S.value&&u(S.value,n)}else{if(!m||!m.length)return void console.log("[POP-WC] switchType: choiceType radios missing, aborting.");var B=null;m.forEach((function(e){e.checked&&(B=e.value)})),B&&"receipt"===B&&u(B,n)}d(i)}}function u(e,t){var i=document.getElementById("billing_invoice_type");i||(i=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]"));var n=document.getElementById("billing_invoice_type_field"),o=document.getElementById("billing_sdi_type_field"),a=document.getElementById("billing_vat_number_field"),r=document.getElementById("billing_tax_code_field"),c=document.getElementById("billing_sdi_type"),u=document.getElementById("billing_vat_number"),m=document.getElementById("billing_tax_code");switch(console.log("[POP-WC] toggle:",e,"event:",t.type),e){case"invoice":var y=document.getElementById("billing_country");if(l&&(y=document.getElementById("billing-country")),"SELECT"===i.tagName)""===i.options[i.selectedIndex].value?n.style.display="block":(n.style.display="block","private"===i.options[i.selectedIndex].value?(r&&(r.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==m.value||(m.value="")):"company"!==i.options[i.selectedIndex].value&&"freelance"!==i.options[i.selectedIndex].value||(u&&(a.style.display="block","load"!==t.type&&(u.value="")),"IT"===y.value&&c&&(o.style.display="block","load"!==t.type&&(c.value="")),m&&(r.style.display="block","load"!==t.type&&(m.value=""))),s(i.options[i.selectedIndex].value,t));else{if(!i.length)return console.log("[POP-WC] toggleFieldsDisplay: invoiceType radios empty, aborting."),!1;var _=i[0].value;i.forEach((function(e){e.checked&&(_=e.value)})),console.log("[POP-WC] RADIO > invoiceTypeValue",_),""===_?n.style.display="block":(n.style.display="block","private"===_?(r&&(r.style.display="block"),"load"!==e&&"XXXXXX00L00L000X"!==m.value||(m.value="")):"company"!==_&&"freelance"!==_||(u&&(a.style.display="block","load"!==t.type&&(u.value="")),"IT"===y.value&&c&&(o.style.display="block","load"!==t.type&&(c.value="")),m&&(r.style.display="block","load"!==t.type&&(m.value=""))),s(_,t))}break;case"receipt":d(null),u&&(u.value="11111111111",a.style.display="none"),c&&(c.value="1111111",o.style.display="none"),m&&(m.value="XXXXXX00L00L000X",r.style.display="none"),n.style.display="none";break;case"reset":d(null),u&&(u.value=""),c&&(c.value=""),m&&(m.value="");break;case"edit-address":""!==m.value&&(r.style.display="block"),""!==u.value&&(a.style.display="block"),""!==c.value&&(o.style.display="block")}}function m(){if(l)return!1;var i;function n(){clearTimeout(i),i=setTimeout((()=>{const l=e("#billing_vat_number").val()?.trim(),i=e("#billing_tax_code").val()?.trim(),n=e("#billing_invoice_type").val()?.trim(),o=e("#billing_choice_type").val()?.trim(),a=e("#billing_country").val()?.trim();!function(l,i,n,o,a){console.log("[POP-WC] callViesCheck fetch:",a,o,n,l,i),fetch(t.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"popCheckoutViesCheck",vat_number:l,tax_code:i,invoice_type:n,choice_type:o,country:a})}).then((e=>e.json())).then((t=>{console.log("[POP-WC] VIES response:",t);var l=e("#billing_vat_number_field label"),i=e("#billing_vat_number_field label .valid_vies"),n=e("#billing_vat_number_field label .not_valid_vies"),o=e(".order-total #wc_el_inv_vies_trigger");0!==o.length&&o.remove(),0!==i.length&&i.remove(),0!==n.length&&n.remove(),"not_necessary"!==t.data.vies&&(t.success?l.append(' <small style="color:green;" class="valid_vies">'+t.data.message+"</small>"):l.append(' <small style="color:red;" class="not_valid_vies">'+t.data.message+"</small>"),e("body").trigger("update_checkout"))})).catch((e=>{console.error("VIES fetch error:",e)}))}(l,i,n,o,a)}),300)}e("#billing_choice_type, #billing_invoice_type, #billing_country, #billing_vat_number, #billing_tax_code").on("change",n),n()}function y(){l&&function(e){var l;async function i(l,i,n,o){wp.data.dispatch("wc/store/cart").invalidateResolution("getCartTotals"),wp.data.dispatch("wc/store/checkout").invalidateResolution("getCheckoutStatus");await wp.data.resolveSelect("wc/store/cart").getCartTotals(),await wp.data.resolveSelect("wc/store/checkout").getCheckoutStatus();const a=e("#billing_vat_number_field label.components-base-control__label"),r=e('<small class="message_vies" style="margin-left:10px;"></small>');if(r.addClass(i.success?"valid":"not_valid"),r.text(i.data.message),r.css("color",i.success?"green":"red"),a.append(r),i.data.update_totals){const e=wp.data.select("wc/store/checkout").getAdditionalFields()||{};wp.data.dispatch("wc/store/checkout").setAdditionalFields({...e,billing_tax_code:""})}"dev"===t.mode&&console.log("[POP-WC block] forceBatchRequest?",l&&l.target&&"billing-country"!==l.target.id),l&&l.target&&"billing-country"!==l.target.id&&(wp.data.dispatch("wc/store/cart").invalidateResolution("getCartData"),wp.data.dispatch("wc/store/cart").invalidateResolution("getCartTotals"),wp.data.dispatch("wc/store/checkout").invalidateResolution("getCheckoutStatus"),Promise.all([wp.data.resolveSelect("wc/store/cart").getCartData(),wp.data.resolveSelect("wc/store/cart").getCartTotals(),wp.data.resolveSelect("wc/store/checkout").getCheckoutStatus()]).then((([e,l,i])=>("dev"===t.mode&&console.log("[POP-WC block] Batch refresh completato:",{cartData:e,cartTotals:l,checkoutStatus:i}),{cartData:e,cartTotals:l,checkoutStatus:i}))).catch((e=>{"dev"===t.mode&&console.error("[POP block] Errore nel forzare batch request:",e)})))}function n(n){clearTimeout(l),l=setTimeout((()=>{const l=e("#billing_vat_number").val()?.trim(),o=e("#billing_tax_code").val()?.trim(),a=e("#billing_invoice_type").val()?.trim(),r=e("#billing_choice_type").val()?.trim(),c=e("#billing-country").val()?.trim();!function(l,n,o,a,r,c){"dev"===t.mode&&console.log("[POP-WC block] vies fetch:",c,r,a,n,o),fetch(t.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"popCheckoutViesCheck",vat_number:n,tax_code:o,invoice_type:a,choice_type:r,country:c})}).then((e=>e.json())).then((n=>{"dev"===t.mode&&console.log("[POP-WC block] vies response:",n);const o=e("#billing_vat_number_field label.components-base-control__label").find(".message_vies");o.length&&o.remove(),i(l,n)})).catch((e=>{console.error("VIES fetch error:",e)}))}(n,l,o,a,r,c)}),300)}e("#billing_choice_type, #billing_invoice_type, #billing-country, #billing_vat_number, #billing_tax_code").on("change blur",n),n()}(jQuery)}function _(){var i=document.getElementById("billing_first_name"),n=document.getElementById("billing_last_name");l&&(i=document.getElementById("billing-first_name"),n=document.getElementById("billing-last_name"));var o=document.getElementById("billing_tax_code"),a=document.getElementById("billing_invoice_type"),r=!1,c={};e(i).on("change",(function(){o.value=""})),e(n).on("change",(function(){o.value=""})),e(o).on("change",(function(){o.setCustomValidity(""),o.setCustomValidity("");var e=this.value.toUpperCase(),l=CodiceFiscale.check(e);if("private"===a.options[a.selectedIndex].value){if(this.value.length<=16&&!0===l){c=CodiceFiscale.computeInverse(e);var d={name:i.value,surname:n.value,gender:c.gender,birthday:c.birthday,birthplace:c.birthplace},s=new CodiceFiscale(d);console.log("[POP-WC] CodiceFiscale di "+d.name+" "+d.surname,s),r=0===s.code.indexOf(c.surname+c.name)}else r=!1;if(console.log("[POP-WC] Check CF:",r),r){var u=o.nextElementSibling;return u&&u.classList.contains("no-valid-cf")&&u.remove(),!0}return setTimeout((function(){var l=o.nextElementSibling;l&&l.remove(),o.insertAdjacentHTML("afterend","<p class='no-valid-cf'><small>(*) <b>"+e+"</b> "+t.invalid_tax_code+"</small></p>"),o.setCustomValidity(t.pop_invalid_tax_code)}),200),!1}}))}function v(n){var o=document.getElementById("billing_invoice_type"),a=document.getElementById("billing_country");l&&(a=document.getElementById("billing-country"));var d=document.getElementById("billing_tax_code");if(o||(o=document.querySelectorAll("#billing_invoice_type_field.form-radio_fields input[type=radio]")),!o)return!1;if(!a)return!1;if(a){var v=a.getAttribute("readonly");v&&"readonly"===v&&(a.closest("#billing_country_field").style.display="none")}var b=document.querySelector('label[for="billing_invoice_type"] .optional');b&&b.remove(),"SELECT"===o.tagName?(a&&"IT"===a.value&&-1!==t.eu_vat_country.indexOf(t.country)?"select"===o.tagName.toLowerCase()?s(o.options[o.selectedIndex].value,n):"input"===o.tagName.toLowerCase()&&s(o.value,n):"select"===o.tagName.toLowerCase()?c(o.options[o.selectedIndex].value,n):"input"===o.tagName.toLowerCase()&&c(o.value,n),a&&r(a.value,o.value,n)):(a&&"IT"===a.value&&-1!==t.eu_vat_country.indexOf(t.country)?s(o[0].value,n):c(o[0].value,n),a&&r(a.value,o[0].value,n)),function(t){var l=document.querySelector("body.woocommerce-edit-address"),n=document.getElementById("billing_choice_type"),o=document.querySelectorAll("#billing_choice_type_field.form-radio_fields input[type=radio]");if(!n&&o){var a="";o.forEach((function(e){e.checked&&(a=e.value)})),console.log("[POP-WC] RADIO > choiceTypeRadioValue",a),u(a,t),o.forEach((function(e){e.addEventListener("change",(function(e){u(this.value,e)}))}))}i();var r=document.querySelector('#billing_choice_type_field label[for="billing_choice_type"] span.optional');r&&r.remove(),n&&"load"===t.type&&!l&&u(n.options[n.selectedIndex].value,t),n&&e(n).on("change",(function(e){u(this.value,e)})),l&&u("edit-address",t)}(n),i(),function(){if(l)return!1;var e=document.getElementById("billing_invoice_type"),i=(document.getElementById("billing_country"),document.getElementById("billing_vat_number")),n=document.getElementById("billing_tax_code");"on"!==t.disable_cf&&!(!i&&!n)&&(i&&i.addEventListener("keyup",(function(t){if(e&&"company"!==e.value)return!1;n.value=this.value})))}(),"free"!==t.user_level&&(m(),y()),function(){const e=document.getElementById("billing-company");l&&e&&(e.nextElementSibling.innerText=t.company_label)}(),a&&"IT"===a.value&&d&&"on"===t.active_js_cf_check&&(_(),d.dispatchEvent(new Event("change")))}l||n(),window.addEventListener("load",(function(e){if(l){const t=setInterval((()=>{v(e),n(),clearInterval(t)}),300)}else v(e)}))}document.querySelector(".wc-block-checkout")?document.addEventListener("DOMContentLoaded",(()=>{new MutationObserver((function(e,t){document.querySelector(".pop-checkout-fields")&&(t.disconnect(),l())})).observe(document.body,{childList:!0,subtree:!0})})):l()}(jQuery,window.wc_el_inv_invoice); -
woopop-electronic-invoice-free/trunk/changelog.txt
r3445528 r3460146 1 = 6.6.1 - 12/02/2026 = 2 Added: isCheckout and isAccountPage utility 3 Added: overrides filter "wc_el_inv-language_force_apply" for default PDF language 4 Added: billingFields.php to pmpro addon 5 Fixed: Harden PMPro product provider by validating membership level objects before accessing properties, preventing fatal errors when SKU/name data is missing. 6 Fixed: Sanitize empty value in $refundFee array 7 Fixed: pmpro chckout scripts 8 Fixed: pmpro admin label undefined field_name 9 Fixed: PMPro renewals now always restore billing/fiscal data (private: codice fiscale; company/freelance: P.IVA/SDI) from user or previous order, avoiding loss when SDI is absent. 10 Change: document date now always uses emission time (now); od_date uses operation date for invoices or linked document date for credit notes; invoice_date for credit notes uses the linked invoice date. 11 Removed: hook 'wfc-create-invoice_datetime-invoice' to prevent external overrides on od_date. 12 1 13 = 6.6.0 - 23/01/2026 = 2 14 Fixed: run checkout block validation/save hooks only when WooCommerce is active. -
woopop-electronic-invoice-free/trunk/inc/settings/pageSettingsFields.php
r3409381 r3460146 72 72 73 73 $taxEnable = false; 74 if(! empty($taxProviderWC) && $taxProviderWC->is_tax_enabled()) {74 if(! empty($taxProviderWC) && 'yes' === $taxProviderWC->is_tax_enabled()) { 75 75 $taxEnable = true; 76 } elseif (! empty($taxProviderPMPro) && $taxProviderPMPro->is_tax_enabled()) {76 } elseif (! empty($taxProviderPMPro) && 'yes' === $taxProviderPMPro->is_tax_enabled()) { 77 77 $taxEnable = true; 78 } elseif (! empty($taxProviderCozmos) && $taxProviderCozmos->is_tax_enabled()) {78 } elseif (! empty($taxProviderCozmos) && 'yes' === $taxProviderCozmos->is_tax_enabled()) { 79 79 $taxEnable = true; 80 80 } -
woopop-electronic-invoice-free/trunk/inc/wc/settings/pageSettingsFields.php
r3409381 r3460146 176 176 ) { 177 177 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 178 if (\WcElectronInvoice\Wizard::isUserLevelGte($level, 'growth') ) {178 if (\WcElectronInvoice\Wizard::isUserLevelGte($level, 'growth') && 'basic' !== $level) { 179 179 echo sprintf('<li><a href="#reverse-charge">%s</a></li>', 180 180 esc_html__('Reverse Charge', WC_EL_INV_TEXTDOMAIN) … … 201 201 202 202 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 203 if (\WcElectronInvoice\Wizard::isUserLevelGte($level, 'growth') ) {203 if (\WcElectronInvoice\Wizard::isUserLevelGte($level, 'growth') && 'basic' !== $level) { 204 204 // Reverse Charge help Link for woocommerce 205 205 echo sprintf('<div class="pop-notice notice-info"><p><span class="dashicons dashicons-info"></span> ' . -
woopop-electronic-invoice-free/trunk/index.php
r3445528 r3460146 7 7 * Description: POP automatically configures your e-commerce to comply with European tax regulations. Your e-commerce can generate electronic invoices in XML format and, thanks to our APIs, automatically transmit them to your accounting software and tax authorities. 8 8 * 9 * Version: 6.6. 09 * Version: 6.6.1 10 10 * Author: POP 11 11 * Author URI: https://popapi.io/ … … 52 52 define('WC_EL_INV_NAME', 'POP Electronic Invoice'); 53 53 define('WC_EL_INV_TEXTDOMAIN', 'el-inv'); 54 define('WC_EL_INV_VERSION', '6.6. 0');54 define('WC_EL_INV_VERSION', '6.6.1'); 55 55 define('WC_EL_INV_VERSION_CLASS', str_replace('.', '_', WC_EL_INV_VERSION)); 56 56 define('WC_EL_INV_PLUGIN_DIR', basename(plugin_dir_path(__FILE__))); -
woopop-electronic-invoice-free/trunk/languages/el-inv-es_ES.po
r3444920 r3460146 3 3 "Project-Id-Version: POP Electronic Invoice\n" 4 4 "POT-Creation-Date: 2025-12-11 10:11+0100\n" 5 "PO-Revision-Date: 2026-0 1-19 09:12+0100\n"5 "PO-Revision-Date: 2026-02-11 11:00+0100\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: Angelo Giammarresi - info@wocmultimedia.biz\n" … … 3261 3261 msgstr "Error: El plan gratuito no permite la creación de abonos." 3262 3262 3263 #: src/Xml/CreateXml.php:2090 3264 msgid "Bulk XML download is not available for your plan." 3265 msgstr "La descarga masiva de XML no está disponible para tu plan." 3266 3263 3267 #: src/Xml/CreateXml.php:2694 3264 3268 msgid "Virtual stamp duty charged to the customer" -
woopop-electronic-invoice-free/trunk/languages/el-inv-fr_FR.po
r3444920 r3460146 3 3 "Project-Id-Version: POP Electronic Invoice\n" 4 4 "POT-Creation-Date: 2025-12-11 10:08+0100\n" 5 "PO-Revision-Date: 2026-0 1-19 09:12+0100\n"5 "PO-Revision-Date: 2026-02-11 11:00+0100\n" 6 6 "Last-Translator: Automatically generated\n" 7 7 "Language-Team: none\n" … … 3377 3377 msgstr "Erreur : le plan Free ne permet pas la création d’avoirs." 3378 3378 3379 #: src/Xml/CreateXml.php:2090 3380 msgid "Bulk XML download is not available for your plan." 3381 msgstr "Le téléchargement massif des XML n’est pas disponible pour votre offre." 3382 3379 3383 #: src/Xml/CreateXml.php:2694 3380 3384 msgid "Virtual stamp duty charged to the customer" -
woopop-electronic-invoice-free/trunk/languages/el-inv-it_IT.po
r3444920 r3460146 3 3 "Project-Id-Version: POP Electronic Invoice\n" 4 4 "POT-Creation-Date: 2025-12-11 10:09+0100\n" 5 "PO-Revision-Date: 2026-0 1-19 09:12+0100\n"5 "PO-Revision-Date: 2026-02-11 11:00+0100\n" 6 6 "Last-Translator: Alfio <alfio.piccione@gmail.com>\n" 7 7 "Language-Team: \n" … … 3409 3409 msgstr "Errore: il piano gratuito non consente la creazione di note di accredito." 3410 3410 3411 #: src/Xml/CreateXml.php:2090 3412 msgid "Bulk XML download is not available for your plan." 3413 msgstr "Il download massivo degli XML non è disponibile per il tuo piano." 3414 3411 3415 #: src/Xml/CreateXml.php:2694 3412 3416 msgid "Virtual stamp duty charged to the customer" -
woopop-electronic-invoice-free/trunk/languages/el-inv.pot
r3444920 r3460146 3425 3425 msgstr "" 3426 3426 3427 #: src/Xml/CreateXml.php:2090 3428 msgid "Bulk XML download is not available for your plan." 3429 msgstr "" 3430 3427 3431 #: src/Xml/CreateXml.php:2694 3428 3432 msgid "Virtual stamp duty charged to the customer" -
woopop-electronic-invoice-free/trunk/readme.md
r3445528 r3460146 4 4 * **Requires at least:** 4.6 5 5 * **Tested up to:** 6.9 6 * **Stable tag:** 6.6. 06 * **Stable tag:** 6.6.1 7 7 * **Requires PHP:** 5.6 8 8 * **License:** GPLv2 or later … … 150 150 ## Changelog 151 151 == Changelog == 152 = 6.6.1 - 12/02/2026 = 153 * Add: isCheckout and isAccountPage utility 154 * Add: overrides filter "wc_el_inv-language_force_apply" for default PDF language 155 * Add: billingFields.php to pmpro addon 156 * Fix: Harden PMPro product provider by validating membership level objects before accessing properties, preventing fatal errors when SKU/name data is missing. 157 * Fix: Sanitize empty value in $refundFee array 158 * Fix: pmpro chckout scripts 159 * Fix: pmpro admin label undefined field_name 160 * Fix: PMPro renewals now always restore billing/fiscal data (private: codice fiscale; company/freelance: P.IVA/SDI) from user or previous order, avoiding loss when SDI is absent. 161 * Change: document date now always uses emission time (now); od_date uses operation date for invoices or linked document date for credit notes; invoice_date for credit notes uses the linked invoice date. 162 * Removed: hook 'wfc-create-invoice_datetime-invoice' to prevent external overrides on od_date. 163 152 164 = 6.6.0 - 23/01/2026 = 153 165 * Fix: run checkout block validation/save hooks only when WooCommerce is active. -
woopop-electronic-invoice-free/trunk/readme.txt
r3445528 r3460146 4 4 Requires at least: 4.6 5 5 Tested up to: 6.9 6 Stable tag: 6.6. 06 Stable tag: 6.6.1 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later … … 129 129 130 130 == Changelog == 131 = 6.6.1 - 12/02/2026 = 132 * Add: isCheckout and isAccountPage utility 133 * Add: overrides filter "wc_el_inv-language_force_apply" for default PDF language 134 * Add: billingFields.php to pmpro addon 135 * Fix: Harden PMPro product provider by validating membership level objects before accessing properties, preventing fatal errors when SKU/name data is missing. 136 * Fix: Sanitize empty value in $refundFee array 137 * Fix: pmpro chckout scripts 138 * Fix: pmpro admin label undefined field_name 139 * Fix: PMPro renewals now always restore billing/fiscal data (private: codice fiscale; company/freelance: P.IVA/SDI) from user or previous order, avoiding loss when SDI is absent. 140 * Change: document date now always uses emission time (now); od_date uses operation date for invoices or linked document date for credit notes; invoice_date for credit notes uses the linked invoice date. 141 * Removed: hook 'wfc-create-invoice_datetime-invoice' to prevent external overrides on od_date. 142 131 143 = 6.6.0 - 23/01/2026 = 132 144 * Fix: run checkout block validation/save hooks only when WooCommerce is active. -
woopop-electronic-invoice-free/trunk/src/Admin/Settings/Fields/XmlOrdersList.php
r3370892 r3460146 265 265 266 266 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 267 if (\WcElectronInvoice\Wizard::isUserLevelGte($level, 'growth')) { 267 // Mass download non disponibile per il piano Basic 268 if (\WcElectronInvoice\Wizard::isUserLevelGte($level, 'growth') && 'basic' !== $level) { 268 269 if (0 !== $orders) { 269 270 $filtered = (isset($dateIN) && false !== $dateIN || isset($dateOUT) && false !== $dateOUT) ? 'yes' : 'no'; -
woopop-electronic-invoice-free/trunk/src/Functions/Invoice.php
r3435218 r3460146 379 379 $invoiceNumber = (int)$orderInvoiceNumber; 380 380 } 381 if ( false === $invoiceNumber) {381 if ($invoiceNumber <= 0) { 382 382 error_log("[WcElectronInvoice] Unable to assign invoice number for order #{$orderID} with numeration type {$numerationType}"); 383 383 -
woopop-electronic-invoice-free/trunk/src/Integrations.php
r3409381 r3460146 201 201 $pmproActive = boolval(get_option('wc_el_inv-addon-pmpro')); 202 202 203 if ($statusFic) { 203 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 204 $proOnly = ! \WcElectronInvoice\Wizard::isUserLevelGte($level, 'pro'); 205 206 if ($statusFic && ! $proOnly) { 204 207 if (! $arubaActive && ! $sdiPecActive && $ficActive) { 205 208 require_once untrailingslashit(self::$addonCore['fattureincloud'] . '.php'); 206 209 } 207 210 } 208 if ($statusFicRc ) {211 if ($statusFicRc && ! $proOnly) { 209 212 if (! $arubaActive && ! $sdiPecActive && $ficActive && $ficReceiptActive) { 210 213 require_once untrailingslashit(self::$addonCore['fattureincloud-receipts'] . '.php'); 211 214 } 212 215 } 213 if ($statusFicMs ) {216 if ($statusFicMs && ! $proOnly) { 214 217 if (! $arubaActive && ! $sdiPecActive && $ficActive && $ficStockActive) { 215 218 require_once untrailingslashit(self::$addonCore['fattureincloud-stock'] . '.php'); 216 219 } 217 220 } 218 if ($statusAruba ) {221 if ($statusAruba && ! $proOnly) { 219 222 if (! $ficActive && ! $sdiPecActive && $arubaActive) { 220 223 require_once untrailingslashit(self::$addonCore['aruba'] . '.php'); 221 224 } 222 225 } 223 if ($statusSdiPec ) {226 if ($statusSdiPec && ! $proOnly) { 224 227 if (! $arubaActive && ! $ficActive && $sdiPecActive) { 225 228 require_once untrailingslashit(self::$addonCore['sdi-pec'] . '.php'); -
woopop-electronic-invoice-free/trunk/src/WooCommerce/Fields/InvoiceFields.php
r3445528 r3460146 1636 1636 1637 1637 // Woo only: if setting is set to NOT check vies and it's NOT forced, skip. 1638 if ((is_checkout() || is_account_page()) && 'yes' !== $optionShouldCheckVies && false === $forceCheck) { 1638 $wooPageContext = self::isCheckout() || self::isAccountPage(); 1639 1640 if ($wooPageContext && 'yes' !== $optionShouldCheckVies && false === $forceCheck) { 1639 1641 return false; 1640 1642 } … … 1784 1786 public static function allowedCheckoutReverseCharge() 1785 1787 { 1788 // Non disponibile per piani Free/Basic 1789 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 1790 if (in_array($level, ['free', 'basic'], true)) { 1791 return false; 1792 } 1793 1786 1794 // Reverse Charge (global active) 1787 1795 $reverseChargeGlobalActive = TaxFields::getReverseChargeActiveGlobally(); … … 1876 1884 1877 1885 // Reverse charge (product) 1886 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 1887 if (in_array($level, ['free', 'basic'], true)) { 1888 return; 1889 } 1890 1878 1891 $reverseCharge = \WcElectronInvoice\Functions\getPostMeta( 1879 1892 '_active_reverse_charge', … … 1955 1968 1956 1969 // Add custom meta to line item 1970 // Reverse charge non applicabile a piani Free/Basic 1971 if (in_array($level, ['free', 'basic'], true)) { 1972 return $fields; 1973 } 1974 1957 1975 if (('yes' === $reverseCharge || 'yes' === $reverseChargeGlobalActive) && $order instanceof \WC_Order) { 1958 1976 if ('' !== $nature && '' !== $refNormativeValue) { … … 3037 3055 // Not required and not IT 3038 3056 if ('IT' !== $country && 'required' !== $required) { 3039 if ( is_checkout()) {3057 if (self::isCheckout()) { 3040 3058 add_filter('woocommerce_checkout_posted_data', function ($data) { 3041 3059 unset($data['billing_choice_type']); … … 3054 3072 '' === $invoiceType) { 3055 3073 // Unset SDI 3056 if ( is_checkout()) {3074 if (self::isCheckout()) { 3057 3075 add_filter('woocommerce_checkout_posted_data', function ($data) { 3058 3076 unset($data['billing_sdi_type']); … … 3212 3230 if ('IT' !== $country && in_array($country, self::$euVatCountry)) { 3213 3231 // Unset SDI 3214 if ( is_checkout()) {3232 if (self::isCheckout()) { 3215 3233 if ($errors instanceof \WP_Error) { 3216 3234 $errors->remove('billing_sdi_type_required'); … … 3265 3283 if ('IT' === $country && 'receipt' !== $choiceDocType && 'private' === $invoiceType) { 3266 3284 // Unset SDI and VAT 3267 if ( is_checkout()) {3285 if (self::isCheckout()) { 3268 3286 if ($errors instanceof \WP_Error) { 3269 3287 $errors->remove('billing_sdi_type_required'); … … 3312 3330 if (! in_array($country, self::$euVatCountry)) { 3313 3331 // Unset SDI 3314 if ( is_checkout()) {3332 if (self::isCheckout()) { 3315 3333 if ($errors instanceof \WP_Error) { 3316 3334 $errors->remove('billing_sdi_type_required'); … … 3436 3454 // Not required and not IT 3437 3455 if ('IT' !== $country && 'required' !== $required) { 3438 if ( is_checkout()) {3456 if (self::isCheckout()) { 3439 3457 add_filter('woocommerce_checkout_posted_data', function ($data) { 3440 3458 unset($data['billing_choice_type']); … … 3453 3471 '' === $invoiceType) { 3454 3472 // Unset SDI 3455 if ( is_checkout()) {3473 if (self::isCheckout()) { 3456 3474 add_filter('woocommerce_checkout_posted_data', function ($data) { 3457 3475 unset($data['billing_sdi_type']); … … 3594 3612 if ('IT' !== $country && in_array($country, self::$euVatCountry)) { 3595 3613 // Unset SDI 3596 if ( is_checkout()) {3614 if (self::isCheckout()) { 3597 3615 add_filter('woocommerce_checkout_posted_data', function ($data) { 3598 3616 unset($data['billing_sdi_type']); … … 3634 3652 if ('IT' === $country && 'receipt' !== $choiceDocType && 'private' === $invoiceType) { 3635 3653 // Unset SDI and VAT 3636 if ( is_checkout()) {3654 if (self::isCheckout()) { 3637 3655 add_filter('woocommerce_checkout_posted_data', function ($data) { 3638 3656 unset($data['billing_sdi_type']); … … 3658 3676 if ($country && ! in_array($country, self::$euVatCountry)) { 3659 3677 // Unset SDI 3660 if ( is_checkout()) {3678 if (self::isCheckout()) { 3661 3679 add_filter('woocommerce_checkout_posted_data', function ($data) { 3662 3680 unset($data['billing_sdi_type']); … … 3851 3869 3852 3870 /** 3871 * Safe wrapper for WooCommerce checkout check. 3872 * 3873 * @return bool 3874 */ 3875 private static function isCheckout(): bool 3876 { 3877 return function_exists('\\is_checkout') && \is_checkout(); 3878 } 3879 3880 /** 3881 * Safe wrapper for WooCommerce account page check. 3882 * 3883 * @return bool 3884 */ 3885 private static function isAccountPage(): bool 3886 { 3887 return function_exists('\\is_account_page') && \is_account_page(); 3888 } 3889 3890 /** 3853 3891 * Checkout Store 3854 3892 * -
woopop-electronic-invoice-free/trunk/src/WooCommerce/Product/QuickEditProduct.php
r3341137 r3460146 50 50 public static function reverseChargeColumn($columns) 51 51 { 52 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 53 if (in_array($level, ['free', 'basic'], true)) { 54 return $columns; 55 } 56 52 57 $reverseChargeGlobalActive = TaxFields::getReverseChargeActiveGlobally(); 53 58 if('yes' !== $reverseChargeGlobalActive) { … … 74 79 public static function customColumn($columnName, $postID) 75 80 { 81 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 82 if (in_array($level, ['free', 'basic'], true)) { 83 return; 84 } 85 76 86 $reverseChargeGlobalActive = TaxFields::getReverseChargeActiveGlobally(); 77 87 if('yes' !== $reverseChargeGlobalActive) { … … 114 124 $output = ''; 115 125 126 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 127 if (in_array($level, ['free', 'basic'], true)) { 128 return; 129 } 130 116 131 $reverseChargeGlobalActive = TaxFields::getReverseChargeActiveGlobally() ?: false; 117 132 if('yes' === $reverseChargeGlobalActive) { … … 157 172 { 158 173 $output = ''; 174 175 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 176 if (in_array($level, ['free', 'basic'], true)) { 177 return; 178 } 159 179 160 180 $reverseChargeGlobalActive = TaxFields::getReverseChargeActiveGlobally() ?: false; … … 203 223 public function store($postID, $post) 204 224 { 225 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 226 if (in_array($level, ['free', 'basic'], true)) { 227 return false; 228 } 229 205 230 $reverseChargeGlobalActive = TaxFields::getReverseChargeActiveGlobally() ?: false; 206 231 if('yes' === $reverseChargeGlobalActive) { -
woopop-electronic-invoice-free/trunk/src/Xml/BuildXml.php
r3409381 r3460146 428 428 // Refund fee - recalculate fee total and total tax 429 429 if (! empty($refundFee)) { 430 // Sanitize empty value in array 431 array_walk($refundFee, function (&$v) { 432 $v = ($v === '' || $v === null) ? 0 : (float)$v; 433 }); 430 434 $itemFeeTotal = abs($itemFeeTotal) - abs($refundFee['total']); 431 435 $itemFeeTotalTax = abs($itemFeeTotalTax) - abs($refundFee['total_tax']); -
woopop-electronic-invoice-free/trunk/src/Xml/CreateXml.php
r3444920 r3460146 2090 2090 $saveBulk = (bool)\WcElectronInvoice\Functions\filterInput($_GET, 'all', FILTER_UNSAFE_RAW); 2091 2091 $choiceType = \WcElectronInvoice\Functions\filterInput($_GET, 'choice_type', FILTER_UNSAFE_RAW); 2092 2093 // Block bulk download for Free e Basic 2094 $level = \WcElectronInvoice\Wizard::popGetUserLevel(); 2095 if ($saveBulk && in_array($level, ['free', 'basic'], true)) { 2096 return __("Bulk XML download is not available for your plan.", WC_EL_INV_TEXTDOMAIN); 2097 } 2092 2098 2093 2099 // GET variable … … 3288 3294 $params['data']['overrides'] = [ 3289 3295 'bollo_force_apply' => apply_filters('wc_el_inv-stamp_duty_force_apply', false), 3296 'language' => apply_filters('wc_el_inv-language_force_apply', null), 3290 3297 ]; 3291 3298 -
woopop-electronic-invoice-free/trunk/vendor/composer/installed.php
r3445528 r3460146 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',6 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 661f7d088dc73adb618150fc1f5bf04b864ffcf5',16 'reference' => '5e149567ab3ebeb4e63844ff34379ac9b2e27ac0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.