lat9 / vat4eu

VAT Processing for European Countries for Zen Cart 1.5.8a and 2.0.x
Other
1 stars 2 forks source link

VAT number not shown in admin>customers>customers #23

Closed webchills closed 7 months ago

webchills commented 7 months ago

Zen Cart 1.5.8a PHP 8.2.13

admin/includes/classes/observers/Vat4EuAdminObserver.php does not recognize VAT numbers so VAT numbers are not shown in the new column in customers>customers

`[23-Feb-2024 16:09:47 Europe/Berlin] Request URI: /158en/admin/index.php?cmd=customers&page=1&cID=1, IP address: 188.22.92.221, Language id 1

0 /www/htdocs/158en/admin/includes/classes/observers/Vat4EuAdminObserver.php(258): zen_debug_error_handler()

1 /www/htdocs/158en/includes/classes/traits/NotifierManager.php(87): Vat4EuAdminObserver->update()

2 /www/htdocs/158en/adminr/customers.php(1591): base->notify()

3 /www/htdocs/158en/admin/index.php(11): require('/www/htdocs/')

--> PHP Warning: Undefined array key "entry_vat_number" in /www/htdocs/158en/manager/includes/classes/observers/Vat4EuAdminObserver.php on line 258.`

$p1['entry_vat_number'] is always empty

lat9 commented 7 months ago

Thanks for the report, @webchills. I'll give that a look real-soon-now.

webchills commented 7 months ago

A quick fix which makes the number showing up is adding the vat fields to the getFormattedAddressBookList function in includes/classes/Customer.php: $sql = "SELECT address_book_id, entry_vat_number, entry_vat_validated, entry_firstname AS firstname, entry_lastname AS lastname,

But this would require editing a core file and does not fit such an observer only plugin.

lat9 commented 7 months ago

Thanks, @webchills; VAT4EU is next on my list. I've been working through another plugin for the past couple of days and am ready for the "next thing"!

lat9 commented 7 months ago

Would it be possible for you to send me (or send me a link to) an exported database that you're using for testing? It would give me a leg-up on correcting this and the other issues you've identified over the past couple of years.

lat9 commented 7 months ago

What's weird is that the Vat4EuAdminObserver has requested that those fields be added to the query, see these lines.

https://github.com/lat9/vat4eu/blob/f51367c811211864a540a7abc2037f8abe972e57/YOUR_ADMIN/includes/classes/observers/Vat4EuAdminObserver.php#L239-L246

Are there any other observers watching for that notification ... and possibly setting the second parameter = something instead of appending their additional fields to the existing string?

webchills commented 7 months ago

This is a vanilla installation of 1.5.8. The only plugin is VatforEU. The same issue is in a 2.0.0 installation. I will send you a link to the database dump via your contact form.